diff bin/js/filter.js @ 40:4bc00caa60b4 draft

Uploaded
author pierre.pouchin
date Thu, 12 Jul 2018 08:27:08 -0400
parents
children 263819fdda14
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/js/filter.js	Thu Jul 12 08:27:08 2018 -0400
@@ -0,0 +1,20 @@
+function search(input) {
+  // Declare variables
+  var elt, filter, uls, li, a, i;
+  elt = input.parentElement;
+  filter = input.value.toUpperCase();
+  uls = elt.getElementsByClassName('thumbs');
+
+  // Loop through all list items, and hide those who don't match the search query
+  for (j = 0; j < uls.length; j++) {
+    li = uls[j].getElementsByTagName('li');
+    for (i = 0; i < li.length; i++) {
+      a = li[i].getElementsByTagName("a")[0];
+      if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
+        li[i].style.display = "";
+      } else {
+        li[i].style.display = "none";
+      }
+    }
+  }
+}