Skip to content

Commit

Permalink
Made device search rainbow
Browse files Browse the repository at this point in the history
  • Loading branch information
arc12012 committed Apr 21, 2017
1 parent 186a6b1 commit c1fe6d4
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ function fuzzyFilter(deviceArray)
////// First pass: filter by device name
var options = {
pre: "<span style='color: darkmagenta; font-size: 115%'><b>",
pre: "<span style='color: red; font-size: 115%'><b>",
post: '</b></span>',
extract: function(arg) {return arg.name;}
}
Expand All @@ -370,34 +370,39 @@ function fuzzyFilter(deviceArray)
}
////// Second pass: filter by MAC address
options.extract = function(arg) {return arg.mac;};
options.pre = "span style='color: orange; font-size: 115%'><b>"
var macFilterResults = fuzzy.filter(searchText, deviceArray, options);
// replace releveant field with bolded string
for (var i = macFilterResults.length - 1; i >= 0; i--) {
macFilterResults[i].original.mac=macFilterResults[i].string;
}
////// Third pass: filter by Manufacture
options.extract = function(arg) {return arg.manufacturer;};
options.pre = "span style='color: gold; font-size: 115%'><b>"
var manufacturerFilterResults = fuzzy.filter(searchText, deviceArray, options);
// replace releveant field with bolded string
for (var i = manufacturerFilterResults.length - 1; i >= 0; i--) {
manufacturerFilterResults[i].original.manufacturer=manufacturerFilterResults[i].string;
}
////// Fourth pass: filter by Hardware
options.extract = function(arg) {return arg.hardware;};
options.pre = "span style='color: green; font-size: 115%'><b>"
var hardwareFilterResults = fuzzy.filter(searchText, deviceArray, options);
// replace releveant field with bolded string
for (var i = hardwareFilterResults.length - 1; i >= 0; i--) {
hardwareFilterResults[i].original.hardware=hardwareFilterResults[i].string;
}
////// Fifth pass: filter by Model
options.extract = function(arg) {return arg.model;};
options.pre = "span style='color: blue; font-size: 115%'><b>"
var modelFilterResults = fuzzy.filter(searchText, deviceArray, options);
// replace releveant field with bolded string
for (var i = modelFilterResults.length - 1; i >= 0; i--) {
modelFilterResults[i].original.model=modelFilterResults[i].string;
}
////// Sixth pass: filter by Serial
options.extract = function(arg) {return arg.serial;};
options.pre = "span style='color: violet; font-size: 115%'><b>"
var serialFilterResults = fuzzy.filter(searchText, deviceArray, options);
// replace releveant field with bolded string
for (var i = serialFilterResults.length - 1; i >= 0; i--) {
Expand Down

0 comments on commit c1fe6d4

Please sign in to comment.