added JavaScript based filter mechanism
This commit is contained in:
parent
cad4fbf6e2
commit
6071f0eef3
|
@ -59,7 +59,7 @@ class admin_plugin_logviewer extends DokuWiki_Admin_Plugin
|
|||
$form->setHiddenField('do', 'admin');
|
||||
$form->setHiddenField('page', 'logviewer');
|
||||
$form->setHiddenField('facility', $this->facility);
|
||||
$form->addTextInput('date','Date*')->attr('type','date')->val($this->date)->addClass('quickselect');
|
||||
$form->addTextInput('date',$this->getLang('date'))->attr('type','date')->val($this->date)->addClass('quickselect');
|
||||
$form->addButton('submit','>')->attr('type','submit');
|
||||
echo $form->toHTML();
|
||||
|
||||
|
|
|
@ -6,4 +6,5 @@
|
|||
*/
|
||||
|
||||
$lang['menu'] = 'View Logs';
|
||||
|
||||
$lang['date'] = 'Date';
|
||||
$lang['js']['filter'] = 'Filter Loglines:';
|
||||
|
|
|
@ -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 + ' ');
|
||||
});
|
||||
|
|
|
@ -7,6 +7,12 @@
|
|||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-top: -1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
dl {
|
||||
max-height: 80vh;
|
||||
overflow: auto;
|
||||
|
@ -14,6 +20,10 @@
|
|||
dt {
|
||||
display: flex;
|
||||
|
||||
&.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.datetime {
|
||||
flex: 0 0 auto;
|
||||
margin-right: 1em;
|
||||
|
|
Loading…
Reference in New Issue