diff options
author | Andreas Gohr <andi@splitbrain.org> | 2020-10-15 12:13:32 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2020-10-15 12:19:55 +0200 |
commit | 6071f0eef30466192d0db9320b73a17c5ef7df39 (patch) | |
tree | a64bdb3c0583c63c409e48b196bb08addb13acfa /lib/plugins/logviewer/script.js | |
parent | cad4fbf6e21bd4a053f1f42b9e40c74f1cfaeab6 (diff) | |
download | dokuwiki-logging.tar.gz dokuwiki-logging.zip |
added JavaScript based filter mechanismlogging
Diffstat (limited to 'lib/plugins/logviewer/script.js')
-rw-r--r-- | lib/plugins/logviewer/script.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/plugins/logviewer/script.js b/lib/plugins/logviewer/script.js index 5a5303c84..ebb9478b5 100644 --- a/lib/plugins/logviewer/script.js +++ b/lib/plugins/logviewer/script.js @@ -3,6 +3,23 @@ */ jQuery(function () { var $dl = jQuery('#plugin__logviewer').find('dl'); - if(!$dl.length) return; - $dl.animate({ scrollTop: $dl.prop("scrollHeight")}, 500); + if (!$dl.length) return; + $dl.animate({scrollTop: $dl.prop("scrollHeight")}, 500); + + + var $filter = jQuery('<input>'); + $filter.on('keyup', function (e) { + var re = new RegExp($filter.val(), 'i'); + + $dl.find('dt').each(function (idx, elem) { + if (elem.innerText.match(re)) { + jQuery(elem).removeClass('hidden'); + } else { + jQuery(elem).addClass('hidden'); + } + }); + }); + $dl.before($filter); + $filter.wrap('<label></label>'); + $filter.before(LANG.plugins.logviewer.filter + ' '); }); |