forked from leftypol/leftypol
Call on ready, dont pollute window namespace with vars
This commit is contained in:
parent
c3ba4cc7ef
commit
035f8437ab
1 changed files with 34 additions and 31 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue