From 738118f6928cf918d6e14cc81f1fb1b4442aa4d1 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sat, 21 Jan 2017 08:36:35 +0000 Subject: [PATCH] 01_FHEMWEB.pm: filteer for icons from Christian (Forum #65334) git-svn-id: https://svn.fhem.de/fhem/trunk@13162 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 1 + fhem/www/pgm2/fhemweb.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index 111bf9a01..bf46049a0 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -2220,6 +2220,7 @@ FW_iconTable($$$$) FW_addContent(); FW_pO "
"; + FW_pO "Filter: ".FW_textfieldv("icon-filter",20,"iconTable","")."
"; if($textfield) { FW_pO "$textfield: ".FW_textfieldv("data",20,"iconTable",".*")."
"; } diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js index f877e6961..0ee041392 100644 --- a/fhem/www/pgm2/fhemweb.js +++ b/fhem/www/pgm2/fhemweb.js @@ -223,12 +223,32 @@ FW_jqueryReadyFn() }); }); + $("[name=icon-filter]").on("change keyup paste", function() { + clearTimeout($.data(this, 'delayTimer')); + var wait = setTimeout(FW_filterIcons, 300); + $(this).data('delayTimer', wait); + }); FW_smallScreenCommands(); FW_inlineModify(); FW_rawDef(); } +function +FW_filterIcons() +{ + var icons = $('.dist[title]'); + icons.show(); + + var filterText = $('[name=icon-filter]').val(); + if (filterText != '') { + var re = RegExp(filterText,"i"); + icons.filter(function() { + return !re.test(this.title); + }).hide(); + } +} + function FW_confirmDelete() {