Created
December 12, 2013 01:44
-
-
Save lennartkoopmann/7921919 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function colorizeRuleResults(rules, list) { | |
/*var ruleslist = $("li", list); | |
for (var i=0; i < ruleslist.size(); i++) { | |
var rule = ruleslist[i]; | |
var streamruleId = rule.getAttribute("data-streamrule-id"); | |
if (streamruleId == undefined) continue; | |
var match = rules[streamruleId]; | |
if (match != undefined) { | |
if (match) { | |
rule.classList.add("alert-success"); | |
rule.classList.remove("alert-danger"); | |
} else { | |
rule.classList.add("alert-danger"); | |
rule.classList.remove("alert-success"); | |
} | |
} | |
}*/ | |
$("li", list).each(function() { | |
var rule = $(this); | |
var streamruleId = rule.attr("data-streamrule-id"); | |
if (streamruleId != undefined) { | |
var match = rules[streamruleId]; | |
if (match != undefined) { | |
if (match) { | |
rule.addClass("alert-success"); | |
rule.removeClass("alert-danger"); | |
} else { | |
rule.addClass("alert-danger"); | |
rule.removeClass("alert-success"); | |
} | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment