Call on ready, dont pollute window namespace with vars

This commit is contained in:
8chan 2014-09-27 20:04:57 +00:00 committed by czaks
parent c3ba4cc7ef
commit 035f8437ab

View File

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