script.js 716 B

12345678910111213141516171819202122232425
  1. /**
  2. * Scroll to the end of the log on load
  3. */
  4. jQuery(function () {
  5. var $dl = jQuery('#plugin__logviewer').find('dl');
  6. if (!$dl.length) return;
  7. $dl.animate({scrollTop: $dl.prop("scrollHeight")}, 500);
  8. var $filter = jQuery('<input>');
  9. $filter.on('keyup', function (e) {
  10. var re = new RegExp($filter.val(), 'i');
  11. $dl.find('dt').each(function (idx, elem) {
  12. if (elem.innerText.match(re)) {
  13. jQuery(elem).removeClass('hidden');
  14. } else {
  15. jQuery(elem).addClass('hidden');
  16. }
  17. });
  18. });
  19. $dl.before($filter);
  20. $filter.wrap('<label></label>');
  21. $filter.before(LANG.plugins.logviewer.filter + ' ');
  22. });