Browse Source

Call on ready, dont pollute window namespace with vars

pull/40/head
8chan 10 years ago
committed by czaks
parent
commit
035f8437ab
  1. 17
      js/id_colors.js

17
js/id_colors.js

@ -1,4 +1,6 @@
$.hash = function(str) { if (active_page == 'thread' || active_page == 'index') {
$(document).ready(function(){
$.hash = function(str) {
var i, j, msg = 0; var i, j, msg = 0;
for (i = 0, j = str.length; i < j; ++i) { for (i = 0, j = str.length; i < j; ++i) {
@ -6,9 +8,9 @@ $.hash = function(str) {
} }
return msg; return msg;
}; };
function stringToRGB(str){ function stringToRGB(str){
var rgb, hash; var rgb, hash;
rgb = []; rgb = [];
@ -19,9 +21,9 @@ function stringToRGB(str){
rgb[2] = (hash >> 8) & 0xFF; rgb[2] = (hash >> 8) & 0xFF;
return rgb; return rgb;
} }
$(".poster_id").each(function(){ $(".poster_id").each(function(){
var rgb = stringToRGB($(this).text()); var rgb = stringToRGB($(this).text());
$(this).css({ $(this).css({
@ -30,5 +32,6 @@ $(".poster_id").each(function(){
"border-radius": "8px", "border-radius": "8px",
"color": "white" "color": "white"
}); });
}); });
});
}

Loading…
Cancel
Save