smartphone-spoiler.js: make it work with thread expanding etc.

This commit is contained in:
czaks 2013-07-03 01:18:44 -04:00
parent 37c1b134de
commit 7180a77705

View File

@ -13,12 +13,21 @@
onready(function(){ onready(function(){
if(device_type == 'mobile') { if(device_type == 'mobile') {
var spoilers = document.getElementsByClassName('spoiler'); var fix_spoilers = function(where) {
var spoilers = where.getElementsByClassName('spoiler');
for(var i = 0; i < spoilers.length; i++) { for(var i = 0; i < spoilers.length; i++) {
spoilers[i].onmousedown = function() { spoilers[i].onmousedown = function() {
this.style.color = 'white'; this.style.color = 'white';
}; };
} }
};
fix_spoilers(document);
// allow to work with auto-reload.js, etc.
$(document).bind('new_post', function(e, post) {
fix_spoilers(post);
});
} }
}); });