smartphone-spoiler.js: format

This commit is contained in:
Zankaria 2024-08-05 18:36:34 +02:00
parent 6daae3ec92
commit fa341b29d0

View File

@ -4,7 +4,7 @@
* *
* Released under the MIT license * Released under the MIT license
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> * Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org>
* Copyright (c) 2013-2014 Marcin Łabanowski <marcin@6irc.net> * Copyright (c) 2013-2014 Marcin Łabanowski <marcin@6irc.net>
* *
* Usage: * Usage:
* $config['additional_javascript'][] = 'js/mobile-style.js'; * $config['additional_javascript'][] = 'js/mobile-style.js';
@ -12,11 +12,11 @@
* *
*/ */
onready(function(){ onready(function() {
if(device_type == 'mobile') { if (device_type == 'mobile') {
var fix_spoilers = function(where) { let fix_spoilers = function(where) {
var spoilers = where.getElementsByClassName('spoiler'); let spoilers = where.getElementsByClassName('spoiler');
for(var i = 0; i < spoilers.length; i++) { for (let i = 0; i < spoilers.length; i++) {
spoilers[i].onmousedown = function() { spoilers[i].onmousedown = function() {
this.style.color = 'white'; this.style.color = 'white';
}; };
@ -24,11 +24,10 @@ onready(function(){
}; };
fix_spoilers(document); fix_spoilers(document);
// allow to work with auto-reload.js, etc. // allow to work with auto-reload.js, etc.
$(document).on('new_post', function(e, post) { $(document).on('new_post', function(e, post) {
fix_spoilers(post); fix_spoilers(post);
}); });
} }
}); });