forked from GithubBackups/vichan
commit
b219b20deb
@ -121,6 +121,7 @@
|
|||||||
$config['additional_javascript'][] = 'js/toggle-locked-threads.js';
|
$config['additional_javascript'][] = 'js/toggle-locked-threads.js';
|
||||||
$config['additional_javascript'][] = 'js/toggle-images.js';
|
$config['additional_javascript'][] = 'js/toggle-images.js';
|
||||||
$config['additional_javascript'][] = 'js/mobile-style.js';
|
$config['additional_javascript'][] = 'js/mobile-style.js';
|
||||||
|
$config['additional_javascript'][] = 'js/id_highlighter.js'
|
||||||
|
|
||||||
$config['font_awesome_css'] = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';
|
$config['font_awesome_css'] = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';
|
||||||
|
|
||||||
|
34
js/id_colors.js
Normal file
34
js/id_colors.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
$.hash = function(str) {
|
||||||
|
var i, j, msg = 0;
|
||||||
|
|
||||||
|
for (i = 0, j = str.length; i < j; ++i) {
|
||||||
|
msg = ((msg << 5) - msg) + str.charCodeAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
};
|
||||||
|
|
||||||
|
function stringToRGB(str){
|
||||||
|
var rgb, hash;
|
||||||
|
|
||||||
|
rgb = [];
|
||||||
|
hash = $.hash(str);
|
||||||
|
|
||||||
|
rgb[0] = (hash >> 24) & 0xFF;
|
||||||
|
rgb[1] = (hash >> 16) & 0xFF;
|
||||||
|
rgb[2] = (hash >> 8) & 0xFF;
|
||||||
|
|
||||||
|
return rgb;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".poster_id").each(function(){
|
||||||
|
var rgb = stringToRGB($(this).text());
|
||||||
|
|
||||||
|
$(this).css({
|
||||||
|
"background-color": "rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")",
|
||||||
|
"padding": "3px 5px",
|
||||||
|
"border-radius": "8px",
|
||||||
|
"color": "white"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
40
js/id_highlighter.js
Normal file
40
js/id_highlighter.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
Array.prototype.remove = function(v) { this.splice(this.indexOf(v) == -1 ? this.length : this.indexOf(v), 1); }
|
||||||
|
|
||||||
|
var idshighlighted = [];
|
||||||
|
|
||||||
|
function getPostsById(id){
|
||||||
|
return $(".poster_id").filter(function(i){
|
||||||
|
return $(this).text() == id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMasterPosts(parents){
|
||||||
|
if(!parents.hasClass("post")) return;
|
||||||
|
|
||||||
|
var toRet = [];
|
||||||
|
|
||||||
|
$(parents).each(function(){
|
||||||
|
if($(this).hasClass("post"))
|
||||||
|
toRet.push($(this));
|
||||||
|
});
|
||||||
|
|
||||||
|
return toRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".poster_id").click(function(){
|
||||||
|
var id = $(this).text();
|
||||||
|
|
||||||
|
if($.inArray(id, idshighlighted) !== -1){
|
||||||
|
idshighlighted.remove(id);
|
||||||
|
|
||||||
|
$(getMasterPosts(getPostsById(id).parents())).each(function(i){
|
||||||
|
$(this).removeClass("highlighted");
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
idshighlighted.push(id);
|
||||||
|
|
||||||
|
$(getMasterPosts(getPostsById(id).parents())).each(function(i){
|
||||||
|
$(this).addClass("highlighted");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
@ -905,6 +905,10 @@ div.thread:hover {
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.poster_id{
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
code > pre {
|
code > pre {
|
||||||
/* Better code tags */
|
/* Better code tags */
|
||||||
background:black;
|
background:black;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user