You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plugins/features/mark.js/datatables.mark.min.js

7 lines
2.4 KiB
JavaScript

/*!***************************************************
* datatables.mark.js v2.0.0
* https://github.com/julmot/datatables.mark.js
* Copyright (c) 2016, Julian Motz
* Released under the MIT license https://git.io/voRZ7
*****************************************************/
"use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol?"symbol":typeof a};!function(a,b,c){"function"==typeof define&&define.amd?define(["jquery","datatables.net","markjs"],function(d){return a(b,c,d)}):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?(require("datatables.net"),require("markjs"),a(b,c,require("jquery"))):a(b,c,jQuery)}(function(a,b,c){var d=function(){function a(b,d){if(_classCallCheck(this,a),"function"!=typeof c.fn.mark||"function"!=typeof c.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=b,this.options="object"===("undefined"==typeof d?"undefined":_typeof(d))?d:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}return _createClass(a,[{key:"initMarkListener",value:function(){var a=this,b="draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",c=null;this.instance.on(b,function(){var b=a.instance.rows({filter:"applied",page:"current"}).nodes().length;b>a.intervalThreshold?(clearTimeout(c),c=setTimeout(function(){a.mark()},a.intervalMs)):a.mark()}),this.instance.on("destroy",function(){a.instance.off(b)}),this.mark()}},{key:"mark",value:function(){var a=this,b=this.instance.search();c(this.instance.table().body()).unmark(this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each(function(d,e){var f=a.instance.column(e).search(),g=f||b;g&&d.forEach(function(b){c(b).mark(g,a.options)})})}}]),a}();c(b).on("init.dt.dth",function(a,b){if("dt"===a.namespace){var e=c.fn.dataTable.Api(b),f=null;e.init().mark?f=e.init().mark:c.fn.dataTable.defaults.mark&&(f=c.fn.dataTable.defaults.mark),null!==f&&new d(e,f)}})},window,document);