-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#19: Added text highighter for search terms. Added datatables.mark.js…
… and jquery.mark.js libraries and .ABOUT files.
- Loading branch information
Showing
14 changed files
with
747 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
about_resource: datatables.mark.css | ||
download_url: https://github.com/julmot/datatables.mark.js/releases/tag/v2.0.0 | ||
|
||
version: 2.0.0 | ||
name: datatables.mark.js | ||
home_url: https://github.com/julmot/datatables.mark.js | ||
owner: Julian Motz | ||
copyright: Copyright (c) 2016, Julian Motz | ||
|
||
license_url: https://raw.githubusercontent.com/julmot/datatables.mark.js/v2.0.0/LICENSE | ||
dje_license: mit | ||
license_text_file: datatables.mark.LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Julian Motz | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
mark { | ||
background: #EEFF41; | ||
color: black; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mark{background:orange;color:black;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
about_resource: datatables.mark.js | ||
download_url: https://github.com/julmot/datatables.mark.js/releases/tag/v2.0.0 | ||
|
||
version: 2.0.0 | ||
name: datatables.mark.js | ||
home_url: https://github.com/julmot/datatables.mark.js | ||
owner: Julian Motz | ||
copyright: Copyright (c) 2016, Julian Motz | ||
|
||
license_url: https://raw.githubusercontent.com/julmot/datatables.mark.js/v2.0.0/LICENSE | ||
dje_license: mit | ||
license_text_file: datatables.mark.LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Julian Motz | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/*!*************************************************** | ||
* 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"; | ||
|
||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
|
||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
|
||
(function (factory, window, document) { | ||
if (typeof define === "function" && define.amd) { | ||
define(["jquery", "datatables.net", "markjs"], function (jQuery) { | ||
return factory(window, document, jQuery); | ||
}); | ||
} else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object") { | ||
require("datatables.net"); | ||
require("markjs"); | ||
factory(window, document, require("jquery")); | ||
} else { | ||
factory(window, document, jQuery); | ||
} | ||
})(function (window, document, $) { | ||
var Mark_DataTables = function () { | ||
function Mark_DataTables(dtInstance, options) { | ||
_classCallCheck(this, Mark_DataTables); | ||
|
||
if (typeof $.fn.mark !== "function" || typeof $.fn.unmark !== "function") { | ||
throw new Error("jquery.mark.js is necessary for datatables.mark.js"); | ||
} | ||
this.instance = dtInstance; | ||
this.options = (typeof options === "undefined" ? "undefined" : _typeof(options)) === "object" ? options : {}; | ||
this.intervalThreshold = 49; | ||
this.intervalMs = 300; | ||
this.initMarkListener(); | ||
} | ||
|
||
_createClass(Mark_DataTables, [{ | ||
key: "initMarkListener", | ||
value: function initMarkListener() { | ||
var _this = this; | ||
|
||
var ev = "draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth"; | ||
var intvl = null; | ||
this.instance.on(ev, function () { | ||
var rows = _this.instance.rows({ | ||
filter: "applied", | ||
page: "current" | ||
}).nodes().length; | ||
if (rows > _this.intervalThreshold) { | ||
clearTimeout(intvl); | ||
intvl = setTimeout(function () { | ||
_this.mark(); | ||
}, _this.intervalMs); | ||
} else { | ||
_this.mark(); | ||
} | ||
}); | ||
this.instance.on("destroy", function () { | ||
_this.instance.off(ev); | ||
}); | ||
this.mark(); | ||
} | ||
}, { | ||
key: "mark", | ||
value: function mark() { | ||
var _this2 = this; | ||
|
||
var globalSearch = this.instance.search(); | ||
$(this.instance.table().body()).unmark(this.options); | ||
this.instance.columns({ | ||
search: "applied", | ||
page: "current" | ||
}).nodes().each(function (nodes, colIndex) { | ||
var columnSearch = _this2.instance.column(colIndex).search(), | ||
searchVal = columnSearch || globalSearch; | ||
if (searchVal) { | ||
nodes.forEach(function (node) { | ||
$(node).mark(searchVal, _this2.options); | ||
}); | ||
} | ||
}); | ||
} | ||
}]); | ||
|
||
return Mark_DataTables; | ||
}(); | ||
|
||
$(document).on("init.dt.dth", function (event, settings) { | ||
if (event.namespace !== "dt") { | ||
return; | ||
} | ||
|
||
var dtInstance = $.fn.dataTable.Api(settings); | ||
|
||
var 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 Mark_DataTables(dtInstance, options); | ||
}); | ||
}, window, document); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
about_resource: jquery.mark.js | ||
download_url: https://github.com/julmot/datatables.mark.js/releases/tag/v7.0.0 | ||
|
||
version: 7.0.0 | ||
name: mark.js | ||
home_url: https://github.com/julmot/mark.js/tree/7.0.0 | ||
owner: Julian Motz | ||
copyright: Copyright (c) 2014–2016 Julian Motz | ||
|
||
license_url: https://raw.githubusercontent.com/julmot/mark.js/7.0.0/LICENSE | ||
dje_license: mit | ||
license_text_file: jquery.mark.LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014–2016 Julian Motz | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.