Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/assets/datatables/dataTables.dataTables.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions content/assets/datatables/dataTables.fixedHeader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions content/assets/datatables/dataTables.min.js

Large diffs are not rendered by default.

138 changes: 138 additions & 0 deletions content/assets/datatables/datatables.mark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*!***************************************************
* datatables.mark.js v3.0.0
* https://github.com/julmot/datatables.mark.js
* Copyright (c) 2016–2020, Julian Kühnel, SpryMedia Ltd
* Released under the MIT license https://git.io/voRZ7
*****************************************************/

(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};

if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}

if ( ! $ ) {
$ = jq( root );
}

cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document ) {
'use strict';
var DataTable = $.fn.dataTable;


class MarkDataTables {
instance;
options;
intervalThreshold;
intervalMs;
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 = new DataTable.Api(settings);
let options = false;
if (dtInstance.init().mark) {
options = dtInstance.init().mark;
}
else if (DataTable.defaults.mark) {
options = DataTable.defaults.mark;
}
if (!options) {
return;
}
new MarkDataTables(dtInstance, options);
});


return DataTable;
}));
1 change: 1 addition & 0 deletions content/assets/datatables/datatables.mark.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mark{background:orange;color:black;}
17 changes: 17 additions & 0 deletions content/assets/datatables/fetch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

DATATABLES=2.3.4
FIXEDHEADER=4.0.4
JQUERY=3.7.0

rm *.js *.css

wget \
https://cdn.datatables.net/${DATATABLES}/css/dataTables.dataTables.min.css \
https://cdn.datatables.net/${DATATABLES}/js/dataTables.min.js \
https://cdn.datatables.net/fixedheader/${FIXEDHEADER}/css/fixedHeader.dataTables.min.css \
https://cdn.datatables.net/fixedheader/${FIXEDHEADER}/js/dataTables.fixedHeader.min.js \
https://code.jquery.com/jquery-${JQUERY}.min.js \
https://cdn.datatables.net/plug-ins/${DATATABLES}/features/mark.js/datatables.mark.min.css \
https://cdn.datatables.net/plug-ins/${DATATABLES}/features/mark.js/datatables.mark.js \
"https://cdn.jsdelivr.net/g/mark.js(jquery.mark.min.js)"
1 change: 1 addition & 0 deletions content/assets/datatables/fixedHeader.dataTables.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions content/assets/datatables/jquery-3.7.0.min.js

Large diffs are not rendered by default.

Loading