Created
July 6, 2013 23:57
-
-
Save remixz/5941710 to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
"picroma": true, | |
"accounts": false, | |
"shop": false | |
} |
This file contains 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
// assume res is the response above from the server | |
for (var key in res) { | |
var $text - $('.status-' + key); // in your HTML, wrap each of the status texts with an element with the class status-[name]. example: your picroma status text would be .status-picroma | |
var status = res[key]; | |
$text.removeClass(); // removes all classes | |
switch (status) { | |
case true: | |
$text.addClass('up'); // green text styling | |
$text.text('up.'); | |
break; | |
case false: | |
$text.addClass('down'); // red text styling | |
$text.text('down.'); | |
break; | |
}; | |
}; | |
// after the stuff you need to do individually, continue doing group check things, like notifications, titles, etc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment