diff options
| author | czaks <marcin@6irc.net> | 2013-07-03 01:18:44 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-07-03 01:18:44 -0400 |
| commit | 7180a7770540f0a3934604b69ad780421efe57b0 (patch) | |
| tree | 7fe68c686b505b7e193fec63a4b93f698b9bc164 /js | |
| parent | 37c1b134dea3dc54cee8f9fe07b713ee98ca993b (diff) | |
smartphone-spoiler.js: make it work with thread expanding etc.
Diffstat (limited to 'js')
| -rw-r--r-- | js/smartphone-spoiler.js | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/js/smartphone-spoiler.js b/js/smartphone-spoiler.js index 67b9c789..ee904b54 100644 --- a/js/smartphone-spoiler.js +++ b/js/smartphone-spoiler.js @@ -13,12 +13,21 @@ onready(function(){ if(device_type == 'mobile') { - var spoilers = document.getElementsByClassName('spoiler'); - for(var i = 0; i < spoilers.length; i++) { - spoilers[i].onmousedown = function() { - this.style.color = 'white'; - }; - } + var fix_spoilers = function(where) { + var spoilers = where.getElementsByClassName('spoiler'); + for(var i = 0; i < spoilers.length; i++) { + spoilers[i].onmousedown = function() { + 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); + }); + } }); |
