2012-03-29 07:16:59 -04:00
|
|
|
/*
|
|
|
|
* smartphone-spoiler.js
|
2012-03-30 20:13:11 -04:00
|
|
|
* https://github.com/savetheinternet/Tinyboard/blob/master/js/smartphone-spoiler.js
|
2012-03-29 07:16:59 -04:00
|
|
|
*
|
|
|
|
* Released under the MIT license
|
|
|
|
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org>
|
2014-01-19 08:27:24 -05:00
|
|
|
* Copyright (c) 2013-2014 Marcin Łabanowski <marcin@6irc.net>
|
2012-03-29 07:16:59 -04:00
|
|
|
*
|
|
|
|
* Usage:
|
2013-01-02 00:05:44 -05:00
|
|
|
* $config['additional_javascript'][] = 'js/mobile-style.js';
|
2012-03-29 07:16:59 -04:00
|
|
|
* $config['additional_javascript'][] = 'js/smartphone-spoiler.js';
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-03-31 04:51:25 -04:00
|
|
|
onready(function(){
|
2013-01-02 00:05:44 -05:00
|
|
|
if(device_type == 'mobile') {
|
2013-07-03 01:18:44 -04:00
|
|
|
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.
|
2014-01-21 13:25:11 -05:00
|
|
|
$(document).on('new_post', function(e, post) {
|
2013-07-03 01:18:44 -04:00
|
|
|
fix_spoilers(post);
|
|
|
|
});
|
|
|
|
|
2012-03-29 07:16:59 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|