From 8d3bfedc72116ba5e44ccfc588240129e9325c3d Mon Sep 17 00:00:00 2001 From: Zankaria Date: Mon, 15 Apr 2024 23:33:12 +0200 Subject: [PATCH 01/29] main.js: trim --- templates/main.js | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/templates/main.js b/templates/main.js index 3b32f916..e8dae8d1 100644 --- a/templates/main.js +++ b/templates/main.js @@ -45,7 +45,7 @@ function ago($timestamp) { switch(true){ case ($difference < 60) : return "" + $difference + ' ' + _('second(s)'); - case ($difference < 3600): //60*60 = 3600 + case ($difference < 3600): //60*60 = 3600 return "" + ($num = Math.round($difference/(60))) + ' ' + _('minute(s)'); case ($difference < 86400): //60*60*24 = 86400 return "" + ($num = Math.round($difference/(3600))) + ' ' + _('hour(s)'); @@ -131,7 +131,7 @@ function changeStyle(styleName, link) { localStorage.stylesheet = styleName; {% endif %} {% verbatim %} - + if (!document.getElementById('stylesheet')) { var s = document.createElement('link'); s.rel = 'stylesheet'; @@ -140,21 +140,21 @@ function changeStyle(styleName, link) { var x = document.getElementsByTagName('head')[0]; x.appendChild(s); } - + document.getElementById('stylesheet').href = styles[styleName]; selectedstyle = styleName; - + if (document.getElementsByClassName('styles').length != 0) { var styleLinks = document.getElementsByClassName('styles')[0].childNodes; for (var i = 0; i < styleLinks.length; i++) { styleLinks[i].className = ''; } } - + if (link) { link.className = 'selected'; } - + if (typeof $ != 'undefined') $(window).trigger('stylesheet', styleName); } @@ -163,11 +163,11 @@ function changeStyle(styleName, link) { {% endverbatim %} {% if config.stylesheets_board %} {% verbatim %} - + if (!localStorage.board_stylesheets) { localStorage.board_stylesheets = '{}'; } - + var stylesheet_choices = JSON.parse(localStorage.board_stylesheets); if (board_name && stylesheet_choices[board_name]) { for (var styleName in styles) { @@ -195,7 +195,7 @@ function changeStyle(styleName, link) { function init_stylechooser() { var newElement = document.createElement('div'); newElement.className = 'styles'; - + for (styleName in styles) { var style = document.createElement('a'); style.innerHTML = '[' + styleName + ']'; @@ -207,8 +207,8 @@ function init_stylechooser() { } style.href = 'javascript:void(0);'; newElement.appendChild(style); - } - + } + document.getElementsByTagName('body')[0].insertBefore(newElement, document.getElementsByTagName('body')[0].lastChild.nextSibling); } @@ -225,7 +225,7 @@ function highlightReply(id) { // don't highlight on middle click return true; } - + var divs = document.getElementsByTagName('div'); for (var i = 0; i < divs.length; i++) { @@ -261,10 +261,10 @@ function dopost(form) { if (form.elements['email'] && form.elements['email'].value != 'sage') { localStorage.email = form.elements['email'].value; } - + saved[document.location] = form.elements['body'].value; sessionStorage.body = JSON.stringify(saved); - + return form.elements['body'].value != "" || (form.elements['file'] && form.elements['file'].value != "") || (form.elements.file_url && form.elements['file_url'].value != ""); } @@ -272,7 +272,7 @@ function citeReply(id, with_link) { var textarea = document.getElementById('body'); if (!textarea) return false; - + if (document.selection) { // IE textarea.focus(); @@ -282,7 +282,7 @@ function citeReply(id, with_link) { var start = textarea.selectionStart; var end = textarea.selectionEnd; textarea.value = textarea.value.substring(0, start) + '>>' + id + '\n' + textarea.value.substring(end, textarea.value.length); - + textarea.selectionStart += ('>>' + id).length + 1; textarea.selectionEnd = textarea.selectionStart; } else { @@ -312,15 +312,15 @@ function rememberStuff() { localStorage.password = generatePassword(); document.forms.post.password.value = localStorage.password; } - + if (localStorage.name && document.forms.post.elements['name']) document.forms.post.elements['name'].value = localStorage.name; if (localStorage.email && document.forms.post.elements['email']) document.forms.post.elements['email'].value = localStorage.email; - + if (window.location.hash.indexOf('q') == 1) citeReply(window.location.hash.substring(2), true); - + if (sessionStorage.body) { var saved = JSON.parse(sessionStorage.body); if (get_cookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')) { @@ -330,14 +330,14 @@ function rememberStuff() { saved[url] = null; } sessionStorage.body = JSON.stringify(saved); - + document.cookie = '{% endverbatim %}{{ config.cookies.js }}{% verbatim %}={};expires=0;path=/;'; } if (saved[document.location]) { document.forms.post.body.value = saved[document.location]; } } - + if (localStorage.body) { document.forms.post.body.value = localStorage.body; localStorage.body = ''; @@ -359,14 +359,14 @@ var script_settings = function(script_name) { function init() { init_stylechooser(); - {% endverbatim %} + {% endverbatim %} {% if config.allow_delete %} if (document.forms.postcontrols) { document.forms.postcontrols.password.value = localStorage.password; } {% endif %} {% verbatim %} - + if (window.location.hash.indexOf('q') != 1 && window.location.hash.substring(1)) highlightReply(window.location.hash.substring(1)); } @@ -404,4 +404,3 @@ sc.innerHTML = 'var sc_project={{ config.statcounter_project }};var sc_invisible var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sc, s); {% endif %} - From 990f27e80bf9819cfb4e09092974322c5c4dca34 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Sun, 4 Aug 2024 15:07:56 +0200 Subject: [PATCH 02/29] main.js: format getCookie --- templates/main.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/templates/main.js b/templates/main.js index e8dae8d1..cbc68d04 100644 --- a/templates/main.js +++ b/templates/main.js @@ -212,12 +212,13 @@ function init_stylechooser() { document.getElementsByTagName('body')[0].insertBefore(newElement, document.getElementsByTagName('body')[0].lastChild.nextSibling); } -function get_cookie(cookie_name) { - var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); - if (results) - return (unescape(results[2])); - else +function getCookie(cookie_name) { + let results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); + if (results) { + return unescape(results[2]); + } else { return null; + } } function highlightReply(id) { @@ -323,9 +324,9 @@ function rememberStuff() { if (sessionStorage.body) { var saved = JSON.parse(sessionStorage.body); - if (get_cookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')) { + if (getCookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')) { // Remove successful posts - var successful = JSON.parse(get_cookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')); + var successful = JSON.parse(getCookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')); for (var url in successful) { saved[url] = null; } From eb67076e608f07b653128fc1dd0fb06261705b07 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Sun, 4 Aug 2024 15:13:05 +0200 Subject: [PATCH 03/29] main.js: rename dopost to camelCase --- templates/main.js | 2 +- templates/post_form.html | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/main.js b/templates/main.js index cbc68d04..3c7b87c1 100644 --- a/templates/main.js +++ b/templates/main.js @@ -252,7 +252,7 @@ function generatePassword() { return pass; } -function dopost(form) { +function doPost(form) { if (form.elements['name']) { localStorage.name = form.elements['name'].value.replace(/( |^)## .+$/, ''); } diff --git a/templates/post_form.html b/templates/post_form.html index b70f2f54..5a6854cf 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -1,4 +1,4 @@ -
+ {{ antibot.html() }} {% if id %}{% endif %} {{ antibot.html() }} @@ -112,7 +112,7 @@ {% elseif config.new_thread_capt %} - {% if not id %} + {% if not id %} {% trans %}Verification{% endtrans %} @@ -165,7 +165,7 @@ {% if config.allow_upload_by_url %}
- : + :
{% endif %} @@ -210,7 +210,7 @@ {{ antibot.html() }} - + {% trans %}(For file deletion.){% endtrans %} {{ antibot.html() }} @@ -221,7 +221,7 @@ {{ antibot.html() }} - + {{ antibot.html() }} {% endif %} From 4b5e40f575276a4986a6906d1de8ca031bbeae49 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Sun, 4 Aug 2024 15:32:12 +0200 Subject: [PATCH 04/29] main.js: format --- templates/main.js | 199 ++++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 95 deletions(-) diff --git a/templates/main.js b/templates/main.js index 3c7b87c1..9858dfe7 100644 --- a/templates/main.js +++ b/templates/main.js @@ -18,92 +18,92 @@ function _(s) { * > alert(fmt(_("{0} users"), [3])); * 3 uzytkownikow */ -function fmt(s,a) { +function fmt(s, a) { return s.replace(/\{([0-9]+)\}/g, function(x) { return a[x[1]]; }); } -function until($timestamp) { - var $difference = $timestamp - Date.now()/1000|0, $num; - switch(true){ - case ($difference < 60): - return "" + $difference + ' ' + _('second(s)'); - case ($difference < 3600): //60*60 = 3600 - return "" + ($num = Math.round($difference/(60))) + ' ' + _('minute(s)'); - case ($difference < 86400): //60*60*24 = 86400 - return "" + ($num = Math.round($difference/(3600))) + ' ' + _('hour(s)'); - case ($difference < 604800): //60*60*24*7 = 604800 - return "" + ($num = Math.round($difference/(86400))) + ' ' + _('day(s)'); - case ($difference < 31536000): //60*60*24*365 = 31536000 - return "" + ($num = Math.round($difference/(604800))) + ' ' + _('week(s)'); - default: - return "" + ($num = Math.round($difference/(31536000))) + ' ' + _('year(s)'); - } +function until(timestamp) { + let difference = timestamp - Date.now() / 1000 | 0; + switch (true) { + case (difference < 60): + return "" + difference + ' ' + _('second(s)'); + case (difference < 3600): // 60 * 60 = 3600 + return "" + Math.round(difference / 60) + ' ' + _('minute(s)'); + case (difference < 86400): // 60 * 60 * 24 = 86400 + return "" + Math.round(difference / 3600) + ' ' + _('hour(s)'); + case (difference < 604800): // 60 * 60 * 24 * 7 = 604800 + return "" + Math.round(difference / 86400) + ' ' + _('day(s)'); + case (difference < 31536000): // 60 * 60 * 24 * 365 = 31536000 + return "" + Math.round(difference / 604800) + ' ' + _('week(s)'); + default: + return "" + Math.round(difference / 31536000) + ' ' + _('year(s)'); + } } -function ago($timestamp) { - var $difference = (Date.now()/1000|0) - $timestamp, $num; - switch(true){ - case ($difference < 60) : - return "" + $difference + ' ' + _('second(s)'); - case ($difference < 3600): //60*60 = 3600 - return "" + ($num = Math.round($difference/(60))) + ' ' + _('minute(s)'); - case ($difference < 86400): //60*60*24 = 86400 - return "" + ($num = Math.round($difference/(3600))) + ' ' + _('hour(s)'); - case ($difference < 604800): //60*60*24*7 = 604800 - return "" + ($num = Math.round($difference/(86400))) + ' ' + _('day(s)'); - case ($difference < 31536000): //60*60*24*365 = 31536000 - return "" + ($num = Math.round($difference/(604800))) + ' ' + _('week(s)'); - default: - return "" + ($num = Math.round($difference/(31536000))) + ' ' + _('year(s)'); - } +function ago(timestamp) { + let difference = (Date.now() / 1000 | 0) - timestamp; + switch (true) { + case (difference < 60): + return "" + difference + ' ' + _('second(s)'); + case (difference < 3600): /// 60 * 60 = 3600 + return "" + Math.round(difference/(60)) + ' ' + _('minute(s)'); + case (difference < 86400): // 60 * 60 * 24 = 86400 + return "" + Math.round(difference/(3600)) + ' ' + _('hour(s)'); + case (difference < 604800): // 60 * 60 * 24 * 7 = 604800 + return "" + Math.round(difference/(86400)) + ' ' + _('day(s)'); + case (difference < 31536000): // 60 * 60 * 24 * 365 = 31536000 + return "" + Math.round(difference/(604800)) + ' ' + _('week(s)'); + default: + return "" + Math.round(difference/(31536000)) + ' ' + _('year(s)'); + } } var datelocale = - { days: [_('Sunday'), _('Monday'), _('Tuesday'), _('Wednesday'), _('Thursday'), _('Friday'), _('Saturday')] - , shortDays: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")] - , months: [_('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July'), _('August'), _('September'), _('October'), _('November'), _('December')] - , shortMonths: [_('Jan'), _('Feb'), _('Mar'), _('Apr'), _('May'), _('Jun'), _('Jul'), _('Aug'), _('Sep'), _('Oct'), _('Nov'), _('Dec')] - , AM: _('AM') - , PM: _('PM') - , am: _('am') - , pm: _('pm') - }; + { days: [_('Sunday'), _('Monday'), _('Tuesday'), _('Wednesday'), _('Thursday'), _('Friday'), _('Saturday')] + , shortDays: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")] + , months: [_('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July'), _('August'), _('September'), _('October'), _('November'), _('December')] + , shortMonths: [_('Jan'), _('Feb'), _('Mar'), _('Apr'), _('May'), _('Jun'), _('Jul'), _('Aug'), _('Sep'), _('Oct'), _('Nov'), _('Dec')] + , AM: _('AM') + , PM: _('PM') + , am: _('am') + , pm: _('pm') + }; function alert(a, do_confirm, confirm_ok_action, confirm_cancel_action) { - var handler, div, bg, closebtn, okbtn; - var close = function() { - handler.fadeOut(400, function() { handler.remove(); }); - return false; - }; + var handler, div, bg, closebtn, okbtn; + let close = function() { + handler.fadeOut(400, function() { handler.remove(); }); + return false; + }; - handler = $("
").hide().appendTo('body'); + handler = $("
").hide().appendTo('body'); - bg = $("
").appendTo(handler); + bg = $("
").appendTo(handler); - div = $("
").appendTo(handler); - closebtn = $("") - .appendTo(div); + div = $("
").appendTo(handler); + closebtn = $("
") + .appendTo(div); - $("
").html(a).appendTo(div); + $("
").html(a).appendTo(div); - okbtn = $("").appendTo(div); + okbtn = $("").appendTo(div); - if (do_confirm) { - confirm_ok_action = (typeof confirm_ok_action !== "function") ? function(){} : confirm_ok_action; - confirm_cancel_action = (typeof confirm_cancel_action !== "function") ? function(){} : confirm_cancel_action; - okbtn.click(confirm_ok_action); - $("").click(confirm_cancel_action).click(close).appendTo(div); - bg.click(confirm_cancel_action); - okbtn.click(confirm_cancel_action); - closebtn.click(confirm_cancel_action); - } + if (do_confirm) { + confirm_ok_action = (typeof confirm_ok_action !== "function") ? function(){} : confirm_ok_action; + confirm_cancel_action = (typeof confirm_cancel_action !== "function") ? function(){} : confirm_cancel_action; + okbtn.click(confirm_ok_action); + $("").click(confirm_cancel_action).click(close).appendTo(div); + bg.click(confirm_cancel_action); + okbtn.click(confirm_cancel_action); + closebtn.click(confirm_cancel_action); + } - bg.click(close); - okbtn.click(close); - closebtn.click(close); + bg.click(close); + okbtn.click(close); + closebtn.click(close); - handler.fadeIn(400); + handler.fadeIn(400); } var saved = {}; @@ -155,8 +155,9 @@ function changeStyle(styleName, link) { link.className = 'selected'; } - if (typeof $ != 'undefined') + if (typeof $ != 'undefined') { $(window).trigger('stylesheet', styleName); + } } @@ -227,26 +228,28 @@ function highlightReply(id) { return true; } - var divs = document.getElementsByTagName('div'); + let divs = document.getElementsByTagName('div'); for (var i = 0; i < divs.length; i++) { - if (divs[i].className.indexOf('post') != -1) + if (divs[i].className.indexOf('post') != -1) { divs[i].className = divs[i].className.replace(/highlighted/, ''); + } } if (id) { - var post = document.getElementById('reply_'+id); - if (post) + let post = document.getElementById('reply_' + id); + if (post) { post.className += ' highlighted'; - window.location.hash = id; + } + window.location.hash = id; } return true; } function generatePassword() { - var pass = ''; - var chars = '{% endverbatim %}{{ config.genpassword_chars }}{% verbatim %}'; - for (var i = 0; i < 8; i++) { - var rnd = Math.floor(Math.random() * chars.length); + let pass = ''; + let chars = '{% endverbatim %}{{ config.genpassword_chars }}{% verbatim %}'; + for (let i = 0; i < 8; i++) { + let rnd = Math.floor(Math.random() * chars.length); pass += chars.substring(rnd, rnd + 1); } return pass; @@ -270,18 +273,19 @@ function doPost(form) { } function citeReply(id, with_link) { - var textarea = document.getElementById('body'); - - if (!textarea) return false; + let textarea = document.getElementById('body'); + if (!textarea) { + return false; + } if (document.selection) { // IE textarea.focus(); - var sel = document.selection.createRange(); + let sel = document.selection.createRange(); sel.text = '>>' + id + '\n'; } else if (textarea.selectionStart || textarea.selectionStart == '0') { - var start = textarea.selectionStart; - var end = textarea.selectionEnd; + let start = textarea.selectionStart; + let end = textarea.selectionEnd; textarea.value = textarea.value.substring(0, start) + '>>' + id + '\n' + textarea.value.substring(end, textarea.value.length); textarea.selectionStart += ('>>' + id).length + 1; @@ -291,10 +295,10 @@ function citeReply(id, with_link) { textarea.value += '>>' + id + '\n'; } if (typeof $ != 'undefined') { - var select = document.getSelection().toString(); + let select = document.getSelection().toString(); if (select) { - var body = $('#reply_' + id + ', #op_' + id).find('div.body'); // TODO: support for OPs - var index = body.text().indexOf(select.replace('\n', '')); // for some reason this only works like this + let body = $('#reply_' + id + ', #op_' + id).find('div.body'); // TODO: support for OPs + let index = body.text().indexOf(select.replace('\n', '')); // for some reason this only works like this if (index > -1) { textarea.value += '>' + select + '\n'; } @@ -309,25 +313,29 @@ function citeReply(id, with_link) { function rememberStuff() { if (document.forms.post) { if (document.forms.post.password) { - if (!localStorage.password) + if (!localStorage.password) { localStorage.password = generatePassword(); + } document.forms.post.password.value = localStorage.password; } - if (localStorage.name && document.forms.post.elements['name']) + if (localStorage.name && document.forms.post.elements['name']) { document.forms.post.elements['name'].value = localStorage.name; - if (localStorage.email && document.forms.post.elements['email']) + } + if (localStorage.email && document.forms.post.elements['email']) { document.forms.post.elements['email'].value = localStorage.email; + } - if (window.location.hash.indexOf('q') == 1) + if (window.location.hash.indexOf('q') == 1) { citeReply(window.location.hash.substring(2), true); + } if (sessionStorage.body) { - var saved = JSON.parse(sessionStorage.body); + let saved = JSON.parse(sessionStorage.body); if (getCookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')) { // Remove successful posts - var successful = JSON.parse(getCookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')); - for (var url in successful) { + let successful = JSON.parse(getCookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')); + for (let url in successful) { saved[url] = null; } sessionStorage.body = JSON.stringify(saved); @@ -351,8 +359,9 @@ var script_settings = function(script_name) { this.get = function(var_name, default_val) { if (typeof tb_settings == 'undefined' || typeof tb_settings[this.script_name] == 'undefined' || - typeof tb_settings[this.script_name][var_name] == 'undefined') + typeof tb_settings[this.script_name][var_name] == 'undefined') { return default_val; + } return tb_settings[this.script_name][var_name]; } }; @@ -382,7 +391,7 @@ function onready(fnc) { } function ready() { - for (var i = 0; i < onready_callbacks.length; i++) { + for (let i = 0; i < onready_callbacks.length; i++) { onready_callbacks[i](); } } From c327a0439ee3d812a2ce2aefbec99883395b2a0f Mon Sep 17 00:00:00 2001 From: Zankaria Date: Sun, 4 Aug 2024 15:37:36 +0200 Subject: [PATCH 05/29] main.js: rename init_stylechooser to camelCase --- templates/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/main.js b/templates/main.js index 9858dfe7..cccf98ea 100644 --- a/templates/main.js +++ b/templates/main.js @@ -193,7 +193,7 @@ function changeStyle(styleName, link) { {% endif %} {% verbatim %} -function init_stylechooser() { +function initStyleChooser() { var newElement = document.createElement('div'); newElement.className = 'styles'; @@ -367,7 +367,7 @@ var script_settings = function(script_name) { }; function init() { - init_stylechooser(); + initStyleChooser(); {% endverbatim %} {% if config.allow_delete %} From 8b773b124e1d499690cc71f995596adc827046e1 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Mon, 5 Aug 2024 18:32:11 +0200 Subject: [PATCH 06/29] main.js: rename onready to camelCase --- templates/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/main.js b/templates/main.js index cccf98ea..a850787f 100644 --- a/templates/main.js +++ b/templates/main.js @@ -386,7 +386,7 @@ var RecaptchaOptions = { }; onready_callbacks = []; -function onready(fnc) { +function onReady(fnc) { onready_callbacks.push(fnc); } @@ -401,7 +401,7 @@ function ready() { var post_date = "{{ config.post_date }}"; var max_images = {{ config.max_images }}; -onready(init); +onReady(init); {% if config.google_analytics %}{% verbatim %} From da0f26485ae449ca036fade98c2062428707ecc5 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Mon, 5 Aug 2024 18:34:55 +0200 Subject: [PATCH 07/29] show-backlinks.js: trim --- js/show-backlinks.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/js/show-backlinks.js b/js/show-backlinks.js index fc3125db..13c0d354 100644 --- a/js/show-backlinks.js +++ b/js/show-backlinks.js @@ -4,7 +4,7 @@ * * Released under the MIT license * Copyright (c) 2012 Michael Save - * Copyright (c) 2013-2014 Marcin Łabanowski + * Copyright (c) 2013-2014 Marcin Łabanowski * * Usage: * $config['additional_javascript'][] = 'js/jquery.min.js'; @@ -16,39 +16,39 @@ onready(function(){ var showBackLinks = function() { var reply_id = $(this).attr('id').replace(/(^reply_)|(^op_)/, ''); - + $(this).find('div.body a:not([rel="nofollow"])').each(function() { var id, post, $mentioned; - + if(id = $(this).text().match(/^>>(\d+)$/)) id = id[1]; else return; - + $post = $('#reply_' + id); if($post.length == 0){ $post = $('#op_' + id); if($post.length == 0) return; } - + $mentioned = $post.find('p.intro span.mentioned'); if($mentioned.length == 0) $mentioned = $('').appendTo($post.find('p.intro')); - + if ($mentioned.find('a.mentioned-' + reply_id).length != 0) return; - + var $link = $('
>>' + reply_id + ''); $link.appendTo($mentioned) - + if (window.init_hover) { $link.each(init_hover); } }); }; - + $('div.post.reply').each(showBackLinks); $('div.post.op').each(showBackLinks); From 6daae3ec92106699b3aa02908bb59ce6dd0cd34f Mon Sep 17 00:00:00 2001 From: Zankaria Date: Mon, 5 Aug 2024 18:35:21 +0200 Subject: [PATCH 08/29] show-backlinks.js: onReady --- js/show-backlinks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/show-backlinks.js b/js/show-backlinks.js index 13c0d354..e6de23c3 100644 --- a/js/show-backlinks.js +++ b/js/show-backlinks.js @@ -13,7 +13,7 @@ * */ -onready(function(){ +onReady(function(){ var showBackLinks = function() { var reply_id = $(this).attr('id').replace(/(^reply_)|(^op_)/, ''); From fa341b29d0d5befcb6ecefa8af838cbb30709077 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Mon, 5 Aug 2024 18:36:34 +0200 Subject: [PATCH 09/29] smartphone-spoiler.js: format --- js/smartphone-spoiler.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/js/smartphone-spoiler.js b/js/smartphone-spoiler.js index 05273c19..3e2b9bb6 100644 --- a/js/smartphone-spoiler.js +++ b/js/smartphone-spoiler.js @@ -4,7 +4,7 @@ * * Released under the MIT license * Copyright (c) 2012 Michael Save - * Copyright (c) 2013-2014 Marcin Łabanowski + * Copyright (c) 2013-2014 Marcin Łabanowski * * Usage: * $config['additional_javascript'][] = 'js/mobile-style.js'; @@ -12,11 +12,11 @@ * */ -onready(function(){ - if(device_type == 'mobile') { - var fix_spoilers = function(where) { - var spoilers = where.getElementsByClassName('spoiler'); - for(var i = 0; i < spoilers.length; i++) { +onready(function() { + if (device_type == 'mobile') { + let fix_spoilers = function(where) { + let spoilers = where.getElementsByClassName('spoiler'); + for (let i = 0; i < spoilers.length; i++) { spoilers[i].onmousedown = function() { this.style.color = 'white'; }; @@ -24,11 +24,10 @@ onready(function(){ }; fix_spoilers(document); - // allow to work with auto-reload.js, etc. - $(document).on('new_post', function(e, post) { - fix_spoilers(post); - }); - + // allow to work with auto-reload.js, etc. + $(document).on('new_post', function(e, post) { + fix_spoilers(post); + }); + } }); - From a0187722678d2a5369b44036d8a1ed312cc17d76 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Mon, 5 Aug 2024 18:36:51 +0200 Subject: [PATCH 10/29] show-backlinks.js: onReady --- js/smartphone-spoiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/smartphone-spoiler.js b/js/smartphone-spoiler.js index 3e2b9bb6..21ba2284 100644 --- a/js/smartphone-spoiler.js +++ b/js/smartphone-spoiler.js @@ -12,7 +12,7 @@ * */ -onready(function() { +onReady(function() { if (device_type == 'mobile') { let fix_spoilers = function(where) { let spoilers = where.getElementsByClassName('spoiler'); From 902c55823757d697cd5f726b48fa920c2ddd276e Mon Sep 17 00:00:00 2001 From: Zankaria Date: Mon, 5 Aug 2024 18:47:53 +0200 Subject: [PATCH 11/29] style-select.js: format --- js/style-select.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/js/style-select.js b/js/style-select.js index f0fe3c16..b87e1b56 100644 --- a/js/style-select.js +++ b/js/style-select.js @@ -6,7 +6,7 @@ * * Released under the MIT license * Copyright (c) 2013 Michael Save - * Copyright (c) 2013-2014 Marcin Łabanowski + * Copyright (c) 2013-2014 Marcin Łabanowski * * Usage: * $config['additional_javascript'][] = 'js/jquery.min.js'; @@ -14,32 +14,32 @@ * */ -onready(function(){ - var stylesDiv = $('div.styles'); - var stylesSelect = $(''); - - var i = 1; +onready(function() { + let stylesDiv = $('div.styles'); + let stylesSelect = $(''); + + let i = 1; stylesDiv.children().each(function() { - var opt = $('') + let opt = $('') .html(this.innerHTML.replace(/(^\[|\]$)/g, '')) .val(i); - if ($(this).hasClass('selected')) + if ($(this).hasClass('selected')) { opt.attr('selected', true); + } stylesSelect.append(opt); $(this).attr('id', 'style-select-' + i); i++; }); - + stylesSelect.change(function() { $('#style-select-' + $(this).val()).click(); }); - + stylesDiv.hide(); - + stylesDiv.after( $('
') .text(_('Style: ')) .append(stylesSelect) ); }); - From b822a76b232b0178e3a763987e4452ef4172d602 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Mon, 5 Aug 2024 18:48:04 +0200 Subject: [PATCH 12/29] style-select.js: onReply --- js/style-select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/style-select.js b/js/style-select.js index b87e1b56..0b6821b8 100644 --- a/js/style-select.js +++ b/js/style-select.js @@ -14,7 +14,7 @@ * */ -onready(function() { +onReady(function() { let stylesDiv = $('div.styles'); let stylesSelect = $(''); From 023e59d88fd66a0d20f22485b18bfd32357bd20c Mon Sep 17 00:00:00 2001 From: Zankaria Date: Mon, 5 Aug 2024 18:50:08 +0200 Subject: [PATCH 13/29] youtube.js: format --- js/youtube.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/js/youtube.js b/js/youtube.js index 9fe81b60..1bbe8fce 100644 --- a/js/youtube.js +++ b/js/youtube.js @@ -10,7 +10,7 @@ * * Released under the MIT license * Copyright (c) 2013 Michael Save -* Copyright (c) 2013-2014 Marcin Łabanowski +* Copyright (c) 2013-2014 Marcin Łabanowski * * Usage: * $config['embedding'] = array(); @@ -22,13 +22,12 @@ * */ - -onready(function(){ - var do_embed_yt = function(tag) { +onready(function() { + let do_embed_yt = function(tag) { $('div.video-container a', tag).click(function() { - var videoID = $(this.parentNode).data('video'); - - $(this.parentNode).html('