We have a Lore FAQ page. If you have Story/Lore related questions - make sure to check it out!
Difference between revisions of "MediaWiki:Common.js"
From The Ark: NieR Automata Lore
Line 5: | Line 5: | ||
$('td[data-sort-value]').each(function() { | $('td[data-sort-value]').each(function() { | ||
if (value == $(this).attr('data-sort-value')) { | if (value == $(this).attr('data-sort-value')) { | ||
− | $(this).css("background-color", | + | $(this).css("background-color", getRandomColor()); |
} | } | ||
}); | }); | ||
}); | }); | ||
}); | }); | ||
+ | |||
+ | function getRandomColor() { | ||
+ | var letters = '0123456789ABCDEF'; | ||
+ | var color = '#'; | ||
+ | for (var i = 0; i < 6; i++) { | ||
+ | color += letters[Math.floor(Math.random() * 16)]; | ||
+ | } | ||
+ | return color; | ||
+ | } |
Revision as of 16:58, 3 October 2017
jQuery(document).ready( function( $ ) { $('td[data-sort-value]').each(function() { var value = $(this).attr('data-sort-value'); $('td[data-sort-value]').each(function() { if (value == $(this).attr('data-sort-value')) { $(this).css("background-color", getRandomColor()); } }); }); }); function getRandomColor() { var letters = '0123456789ABCDEF'; var color = '#'; for (var i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } return color; }