From bb726ed5915682d348dbb25e0113dd3ee131da03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20K=C3=BChnel?= Date: Mon, 14 Sep 2020 17:40:18 +0200 Subject: [PATCH 1/2] Update datatables.mark.js to v2.0.2 --- features/mark.js/datatables.mark.es6.js | 4 ++-- features/mark.js/datatables.mark.es6.min.js | 4 ++-- features/mark.js/datatables.mark.js | 4 ++-- features/mark.js/datatables.mark.min.js | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/features/mark.js/datatables.mark.es6.js b/features/mark.js/datatables.mark.es6.js index 813bb6e..848d4dc 100644 --- a/features/mark.js/datatables.mark.es6.js +++ b/features/mark.js/datatables.mark.es6.js @@ -1,7 +1,7 @@ /*!*************************************************** - * datatables.mark.js v2.0.1 + * datatables.mark.js v2.0.2 * https://github.com/julmot/datatables.mark.js - * Copyright (c) 2016–2017, Julian Motz + * Copyright (c) 2016–2020, Julian Kühnel * Released under the MIT license https://git.io/voRZ7 *****************************************************/ diff --git a/features/mark.js/datatables.mark.es6.min.js b/features/mark.js/datatables.mark.es6.min.js index f9a7fc5..83f4afa 100644 --- a/features/mark.js/datatables.mark.es6.min.js +++ b/features/mark.js/datatables.mark.es6.min.js @@ -1,7 +1,7 @@ /*!*************************************************** - * datatables.mark.js v2.0.1 + * datatables.mark.js v2.0.2 * https://github.com/julmot/datatables.mark.js - * Copyright (c) 2016–2017, Julian Motz + * Copyright (c) 2016–2020, Julian Kühnel * Released under the MIT license https://git.io/voRZ7 *****************************************************/ 'use strict';((factory,window,document)=>{if(typeof exports==='object'){const jquery=require('jquery');require('datatables.net');require('mark.js/dist/jquery.mark.js');module.exports=factory(window,document,jquery);}else if(typeof define==='function'&&define.amd){define(['jquery','datatables.net','markjs'],jQuery=>{return factory(window,document,jQuery);});}else{factory(window,document,jQuery);}})((window,document,$)=>{class MarkDataTables{constructor(dtInstance,options){if(!$.fn.mark||!$.fn.unmark){throw new Error('jquery.mark.js is necessary for datatables.mark.js');}this.instance=dtInstance;this.options=typeof options==='object'?options:{};this.intervalThreshold=49;this.intervalMs=300;this.initMarkListener();}initMarkListener(){const ev='draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth';let intvl=null;this.instance.on(ev,()=>{const rows=this.instance.rows({filter:'applied',page:'current'}).nodes().length;if(rows>this.intervalThreshold){clearTimeout(intvl);intvl=setTimeout(()=>{this.mark();},this.intervalMs);}else{this.mark();}});this.instance.on('destroy',()=>{this.instance.off(ev);});this.mark();}mark(){const globalSearch=this.instance.search();$(this.instance.table().body()).unmark(this.options);this.instance.columns({search:'applied',page:'current'}).nodes().each((nodes,colIndex)=>{const columnSearch=this.instance.column(colIndex).search(),searchVal=columnSearch||globalSearch;if(searchVal){nodes.forEach(node=>{$(node).mark(searchVal,this.options);});}});}}$(document).on('init.dt.dth',(event,settings)=>{if(event.namespace!=='dt'){return;}const dtInstance=$.fn.dataTable.Api(settings);let options=null;if(dtInstance.init().mark){options=dtInstance.init().mark;}else if($.fn.dataTable.defaults.mark){options=$.fn.dataTable.defaults.mark;}if(options===null){return;}new MarkDataTables(dtInstance,options);});},window,document); diff --git a/features/mark.js/datatables.mark.js b/features/mark.js/datatables.mark.js index 4f4f41a..9937f51 100644 --- a/features/mark.js/datatables.mark.js +++ b/features/mark.js/datatables.mark.js @@ -1,7 +1,7 @@ /*!*************************************************** - * datatables.mark.js v2.0.1 + * datatables.mark.js v2.0.2 * https://github.com/julmot/datatables.mark.js - * Copyright (c) 2016–2017, Julian Motz + * Copyright (c) 2016–2020, Julian Kühnel * Released under the MIT license https://git.io/voRZ7 *****************************************************/ diff --git a/features/mark.js/datatables.mark.min.js b/features/mark.js/datatables.mark.min.js index 4edde4b..1e1ad1f 100644 --- a/features/mark.js/datatables.mark.min.js +++ b/features/mark.js/datatables.mark.min.js @@ -1,7 +1,7 @@ /*!*************************************************** - * datatables.mark.js v2.0.1 + * datatables.mark.js v2.0.2 * https://github.com/julmot/datatables.mark.js - * Copyright (c) 2016–2017, Julian Motz + * Copyright (c) 2016–2020, Julian Kühnel * Released under the MIT license https://git.io/voRZ7 *****************************************************/ -"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;ne.intervalThreshold?(clearTimeout(n),n=setTimeout(function(){e.mark()},e.intervalMs)):e.mark()}),this.instance.on("destroy",function(){e.instance.off(t)}),this.mark()}},{key:"mark",value:function(){var e=this,t=this.instance.search();n(this.instance.table().body()).unmark(this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each(function(r,a){var i=e.instance.column(a).search()||t;i&&r.forEach(function(t){n(t).mark(i,e.options)})})}}]),e}();n(t).on("init.dt.dth",function(e,t){if("dt"===e.namespace){var a=n.fn.dataTable.Api(t),i=null;a.init().mark?i=a.init().mark:n.fn.dataTable.defaults.mark&&(i=n.fn.dataTable.defaults.mark),null!==i&&new r(a,i)}})},window,document); \ No newline at end of file +"use strict";var _createClass=function(){function r(e,t){for(var n=0;ne.intervalThreshold?(clearTimeout(n),n=setTimeout(function(){e.mark()},e.intervalMs)):e.mark()}),this.instance.on("destroy",function(){e.instance.off(t)}),this.mark()}},{key:"mark",value:function(){var r=this,a=this.instance.search();i(this.instance.table().body()).unmark(this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each(function(e,t){var n=r.instance.column(t).search()||a;n&&e.forEach(function(e){i(e).mark(n,r.options)})})}}]),n);function n(e,t){if(_classCallCheck(this,n),!i.fn.mark||!i.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=e,this.options="object"===(void 0===t?"undefined":_typeof(t))?t:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}i(t).on("init.dt.dth",function(e,t){var n,r;"dt"===e.namespace&&(r=null,(n=i.fn.dataTable.Api(t)).init().mark?r=n.init().mark:i.fn.dataTable.defaults.mark&&(r=i.fn.dataTable.defaults.mark),null!==r&&new a(n,r))})},window,document); \ No newline at end of file From 1675b430e7d87c121d9159559f3f03b376fa5376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20K=C3=BChnel?= Date: Thu, 5 Nov 2020 22:03:52 +0100 Subject: [PATCH 2/2] Update datatables.mark.js --- features/mark.js/datatables.mark.es6.js | 23 +++++++++++++-------- features/mark.js/datatables.mark.es6.min.js | 14 ++++++------- features/mark.js/datatables.mark.js | 21 ++++++++++++------- features/mark.js/datatables.mark.min.js | 14 ++++++------- 4 files changed, 41 insertions(+), 31 deletions(-) diff --git a/features/mark.js/datatables.mark.es6.js b/features/mark.js/datatables.mark.es6.js index 848d4dc..e045000 100644 --- a/features/mark.js/datatables.mark.es6.js +++ b/features/mark.js/datatables.mark.es6.js @@ -1,9 +1,9 @@ -/*!*************************************************** - * datatables.mark.js v2.0.2 - * https://github.com/julmot/datatables.mark.js - * Copyright (c) 2016–2020, Julian Kühnel - * Released under the MIT license https://git.io/voRZ7 - *****************************************************/ +/*!*************************************************** + * datatables.mark.js v2.1.0 + * https://github.com/julmot/datatables.mark.js + * Copyright (c) 2016–2020, Julian Kühnel + * Released under the MIT license https://git.io/voRZ7 + *****************************************************/ 'use strict'; @@ -34,7 +34,8 @@ } initMarkListener() { - const ev = 'draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth'; + let ev = 'draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth'; + ev += ' responsive-display.dt.dth'; let intvl = null; this.instance.on(ev, () => { const rows = this.instance.rows({ @@ -58,7 +59,11 @@ mark() { const globalSearch = this.instance.search(); - $(this.instance.table().body()).unmark(this.options); + const $tableBody = $(this.instance.table().body()); + $tableBody.unmark(this.options); + if (this.instance.table().rows({ search: 'applied' }).data().length) { + $tableBody.mark(globalSearch, this.options); + } this.instance.columns({ search: 'applied', page: 'current' @@ -67,7 +72,7 @@ searchVal = columnSearch || globalSearch; if (searchVal) { nodes.forEach(node => { - $(node).mark(searchVal, this.options); + $(node).unmark(this.options).mark(searchVal, this.options); }); } }); diff --git a/features/mark.js/datatables.mark.es6.min.js b/features/mark.js/datatables.mark.es6.min.js index 83f4afa..e0711ea 100644 --- a/features/mark.js/datatables.mark.es6.min.js +++ b/features/mark.js/datatables.mark.es6.min.js @@ -1,7 +1,7 @@ -/*!*************************************************** - * datatables.mark.js v2.0.2 - * https://github.com/julmot/datatables.mark.js - * Copyright (c) 2016–2020, Julian Kühnel - * Released under the MIT license https://git.io/voRZ7 - *****************************************************/ -'use strict';((factory,window,document)=>{if(typeof exports==='object'){const jquery=require('jquery');require('datatables.net');require('mark.js/dist/jquery.mark.js');module.exports=factory(window,document,jquery);}else if(typeof define==='function'&&define.amd){define(['jquery','datatables.net','markjs'],jQuery=>{return factory(window,document,jQuery);});}else{factory(window,document,jQuery);}})((window,document,$)=>{class MarkDataTables{constructor(dtInstance,options){if(!$.fn.mark||!$.fn.unmark){throw new Error('jquery.mark.js is necessary for datatables.mark.js');}this.instance=dtInstance;this.options=typeof options==='object'?options:{};this.intervalThreshold=49;this.intervalMs=300;this.initMarkListener();}initMarkListener(){const ev='draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth';let intvl=null;this.instance.on(ev,()=>{const rows=this.instance.rows({filter:'applied',page:'current'}).nodes().length;if(rows>this.intervalThreshold){clearTimeout(intvl);intvl=setTimeout(()=>{this.mark();},this.intervalMs);}else{this.mark();}});this.instance.on('destroy',()=>{this.instance.off(ev);});this.mark();}mark(){const globalSearch=this.instance.search();$(this.instance.table().body()).unmark(this.options);this.instance.columns({search:'applied',page:'current'}).nodes().each((nodes,colIndex)=>{const columnSearch=this.instance.column(colIndex).search(),searchVal=columnSearch||globalSearch;if(searchVal){nodes.forEach(node=>{$(node).mark(searchVal,this.options);});}});}}$(document).on('init.dt.dth',(event,settings)=>{if(event.namespace!=='dt'){return;}const dtInstance=$.fn.dataTable.Api(settings);let options=null;if(dtInstance.init().mark){options=dtInstance.init().mark;}else if($.fn.dataTable.defaults.mark){options=$.fn.dataTable.defaults.mark;}if(options===null){return;}new MarkDataTables(dtInstance,options);});},window,document); +/*!*************************************************** + * datatables.mark.js v2.1.0 + * https://github.com/julmot/datatables.mark.js + * Copyright (c) 2016–2020, Julian Kühnel + * Released under the MIT license https://git.io/voRZ7 + *****************************************************/ +'use strict';((factory,window,document)=>{if(typeof exports==='object'){const jquery=require('jquery');require('datatables.net');require('mark.js/dist/jquery.mark.js');module.exports=factory(window,document,jquery);}else if(typeof define==='function'&&define.amd){define(['jquery','datatables.net','markjs'],jQuery=>{return factory(window,document,jQuery);});}else{factory(window,document,jQuery);}})((window,document,$)=>{class MarkDataTables{constructor(dtInstance,options){if(!$.fn.mark||!$.fn.unmark){throw new Error('jquery.mark.js is necessary for datatables.mark.js');}this.instance=dtInstance;this.options=typeof options==='object'?options:{};this.intervalThreshold=49;this.intervalMs=300;this.initMarkListener();}initMarkListener(){let ev='draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth';ev+=' responsive-display.dt.dth';let intvl=null;this.instance.on(ev,()=>{const rows=this.instance.rows({filter:'applied',page:'current'}).nodes().length;if(rows>this.intervalThreshold){clearTimeout(intvl);intvl=setTimeout(()=>{this.mark();},this.intervalMs);}else{this.mark();}});this.instance.on('destroy',()=>{this.instance.off(ev);});this.mark();}mark(){const globalSearch=this.instance.search();const $tableBody=$(this.instance.table().body());$tableBody.unmark(this.options);if(this.instance.table().rows({search:'applied'}).data().length){$tableBody.mark(globalSearch,this.options);}this.instance.columns({search:'applied',page:'current'}).nodes().each((nodes,colIndex)=>{const columnSearch=this.instance.column(colIndex).search(),searchVal=columnSearch||globalSearch;if(searchVal){nodes.forEach(node=>{$(node).unmark(this.options).mark(searchVal,this.options);});}});}}$(document).on('init.dt.dth',(event,settings)=>{if(event.namespace!=='dt'){return;}const dtInstance=$.fn.dataTable.Api(settings);let options=null;if(dtInstance.init().mark){options=dtInstance.init().mark;}else if($.fn.dataTable.defaults.mark){options=$.fn.dataTable.defaults.mark;}if(options===null){return;}new MarkDataTables(dtInstance,options);});},window,document); diff --git a/features/mark.js/datatables.mark.js b/features/mark.js/datatables.mark.js index 9937f51..34688f8 100644 --- a/features/mark.js/datatables.mark.js +++ b/features/mark.js/datatables.mark.js @@ -1,9 +1,9 @@ -/*!*************************************************** - * datatables.mark.js v2.0.2 - * https://github.com/julmot/datatables.mark.js - * Copyright (c) 2016–2020, Julian Kühnel - * Released under the MIT license https://git.io/voRZ7 - *****************************************************/ +/*!*************************************************** + * datatables.mark.js v2.1.0 + * https://github.com/julmot/datatables.mark.js + * Copyright (c) 2016–2020, Julian Kühnel + * Released under the MIT license https://git.io/voRZ7 + *****************************************************/ 'use strict'; @@ -47,6 +47,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons var _this = this; var ev = 'draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth'; + ev += ' responsive-display.dt.dth'; var intvl = null; this.instance.on(ev, function () { var rows = _this.instance.rows({ @@ -73,7 +74,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons var _this2 = this; var globalSearch = this.instance.search(); - $(this.instance.table().body()).unmark(this.options); + var $tableBody = $(this.instance.table().body()); + $tableBody.unmark(this.options); + if (this.instance.table().rows({ search: 'applied' }).data().length) { + $tableBody.mark(globalSearch, this.options); + } this.instance.columns({ search: 'applied', page: 'current' @@ -82,7 +87,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons searchVal = columnSearch || globalSearch; if (searchVal) { nodes.forEach(function (node) { - $(node).mark(searchVal, _this2.options); + $(node).unmark(_this2.options).mark(searchVal, _this2.options); }); } }); diff --git a/features/mark.js/datatables.mark.min.js b/features/mark.js/datatables.mark.min.js index 1e1ad1f..4220b8a 100644 --- a/features/mark.js/datatables.mark.min.js +++ b/features/mark.js/datatables.mark.min.js @@ -1,7 +1,7 @@ -/*!*************************************************** - * datatables.mark.js v2.0.2 - * https://github.com/julmot/datatables.mark.js - * Copyright (c) 2016–2020, Julian Kühnel - * Released under the MIT license https://git.io/voRZ7 - *****************************************************/ -"use strict";var _createClass=function(){function r(e,t){for(var n=0;ne.intervalThreshold?(clearTimeout(n),n=setTimeout(function(){e.mark()},e.intervalMs)):e.mark()}),this.instance.on("destroy",function(){e.instance.off(t)}),this.mark()}},{key:"mark",value:function(){var r=this,a=this.instance.search();i(this.instance.table().body()).unmark(this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each(function(e,t){var n=r.instance.column(t).search()||a;n&&e.forEach(function(e){i(e).mark(n,r.options)})})}}]),n);function n(e,t){if(_classCallCheck(this,n),!i.fn.mark||!i.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=e,this.options="object"===(void 0===t?"undefined":_typeof(t))?t:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}i(t).on("init.dt.dth",function(e,t){var n,r;"dt"===e.namespace&&(r=null,(n=i.fn.dataTable.Api(t)).init().mark?r=n.init().mark:i.fn.dataTable.defaults.mark&&(r=i.fn.dataTable.defaults.mark),null!==r&&new a(n,r))})},window,document); \ No newline at end of file +/*!*************************************************** + * datatables.mark.js v2.1.0 + * https://github.com/julmot/datatables.mark.js + * Copyright (c) 2016–2020, Julian Kühnel + * Released under the MIT license https://git.io/voRZ7 + *****************************************************/ +"use strict";var _createClass=function(){function a(t,e){for(var n=0;nt.intervalThreshold?(clearTimeout(n),n=setTimeout(function(){t.mark()},t.intervalMs)):t.mark()}),this.instance.on("destroy",function(){t.instance.off(e)}),this.mark()}},{key:"mark",value:function(){var a=this,r=this.instance.search(),t=i(this.instance.table().body());t.unmark(this.options),this.instance.table().rows({search:"applied"}).data().length&&t.mark(r,this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each(function(t,e){var n=a.instance.column(e).search()||r;n&&t.forEach(function(t){i(t).unmark(a.options).mark(n,a.options)})})}}]),n);function n(t,e){if(_classCallCheck(this,n),!i.fn.mark||!i.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=t,this.options="object"===(void 0===e?"undefined":_typeof(e))?e:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}i(e).on("init.dt.dth",function(t,e){var n,a;"dt"===t.namespace&&(a=null,(n=i.fn.dataTable.Api(e)).init().mark?a=n.init().mark:i.fn.dataTable.defaults.mark&&(a=i.fn.dataTable.defaults.mark),null!==a&&new r(n,a))})},window,document); \ No newline at end of file