diff --git a/files/assets/fistmas/js/darkmode.js b/files/assets/fistmas/js/darkmode.js index 76f93995e..ea00206df 100644 --- a/files/assets/fistmas/js/darkmode.js +++ b/files/assets/fistmas/js/darkmode.js @@ -1,6 +1,6 @@ function postToastRoastEventDarkmode(t, url) { const xhr = createXhrWithFormKey(url); - xhr[0].onload = () => { + xhr[0].onload = function() { postToastLoadEventDarkmode(xhr[0]) }; xhr[0].send(xhr[1]); diff --git a/files/assets/js/admin/alts.js b/files/assets/js/admin/alts.js index 594f0d517..d3c403306 100644 --- a/files/assets/js/admin/alts.js +++ b/files/assets/js/admin/alts.js @@ -4,7 +4,7 @@ function submitAddAlt(element, username) { const form = new FormData(); form.append('other_username', document.getElementById('link-input-other').value); const xhr = createXhrWithFormKey(`/@${username}/alts/`, 'POST', form); - xhr[0].onload = () => { + xhr[0].onload = function() { let data; try { data = JSON.parse(xhr[0].response); diff --git a/files/assets/js/award_modal.js b/files/assets/js/award_modal.js index ce207ecc0..405876f7e 100644 --- a/files/assets/js/award_modal.js +++ b/files/assets/js/award_modal.js @@ -136,7 +136,7 @@ function buy(mb) { url = `/buy/${kind}` if (mb) url += "?mb=true" const xhr = createXhrWithFormKey(url); - xhr[0].onload = () => { + xhr[0].onload = function() { let data try {data = JSON.parse(xhr[0].response)} catch(e) {console.log(e)} diff --git a/files/assets/js/ban_modal.js b/files/assets/js/ban_modal.js index 817504dde..47b698e4d 100644 --- a/files/assets/js/ban_modal.js +++ b/files/assets/js/ban_modal.js @@ -3,10 +3,10 @@ function banModal(link, name, fullname, cls) { document.getElementById("ban-modal-link").value = link; document.getElementById("banUserButton").innerHTML = `Ban @${name}`; - document.getElementById("banUserButton").addEventListener('click', () => { + document.getElementById("banUserButton").addEventListener('click', function() { let form = new FormData(document.getElementById("banModalForm")); const xhr = createXhrWithFormKey(`/ban_user/${fullname}?form`, "POST", form); - xhr[0].onload = () => { + xhr[0].onload = function() { let data try {data = JSON.parse(xhr[0].response)} catch(e) {console.log(e)} @@ -25,10 +25,10 @@ function chudModal(link, name, fullname, cls) { document.getElementById("chud-modal-link").value = link; document.getElementById("chudUserButton").innerHTML = `Chud @${name}`; - document.getElementById("chudUserButton").addEventListener('click', () => { + document.getElementById("chudUserButton").addEventListener('click', function() { let form = new FormData(document.getElementById("chudModalForm")); const xhr = createXhrWithFormKey(`/agendaposter/${fullname}?form`, "POST", form); - xhr[0].onload = () => { + xhr[0].onload = function() { let data try {data = JSON.parse(xhr[0].response)} catch(e) {console.log(e)} diff --git a/files/assets/js/chat.js b/files/assets/js/chat.js index 00bfe7bd7..07322bc4e 100644 --- a/files/assets/js/chat.js +++ b/files/assets/js/chat.js @@ -172,7 +172,7 @@ function send() { input.parentElement.nextElementSibling.classList.add('d-none'); box.scrollTo(0, box.scrollHeight); - setTimeout(() => { + setTimeout(function () { box.scrollTo(0, box.scrollHeight) }, 200); } @@ -223,15 +223,15 @@ socket.on('online', function(data){ bs_trigger(document.getElementById('online3')) }) -window.addEventListener('blur', () =>{ +window.addEventListener('blur', function(){ focused=false }) -window.addEventListener('focus', () =>{ +window.addEventListener('focus', function(){ focused=true }) -ta.addEventListener("input", () => { +ta.addEventListener("input", function() { text = ta.value if (!text && is_typing==true){ is_typing=false; @@ -313,18 +313,18 @@ document.onpaste = function(event) { } box.scrollTo(0, box.scrollHeight) -setTimeout(() => { +setTimeout(function () { box.scrollTo(0, box.scrollHeight) }, 200); -setTimeout(() => { +setTimeout(function () { box.scrollTo(0, box.scrollHeight) }, 500); -setTimeout(() => { +setTimeout(function () { box.scrollTo(0, box.scrollHeight) }, 1000); -setTimeout(() => { +setTimeout(function () { box.scrollTo(0, box.scrollHeight) }, 1500); -document.addEventListener('DOMContentLoaded', () => { +document.addEventListener('DOMContentLoaded', function () { box.scrollTo(0, box.scrollHeight) }); diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index fcb7ee210..f1605d2c1 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -25,7 +25,7 @@ function report_commentModal(id, author) { reason_comment.focus() }, 500); - reportCommentButton.addEventListener('click', () => { + reportCommentButton.addEventListener('click', function() { this.innerHTML='Reporting comment'; postToast(this, `/report/comment/${id}`, @@ -86,7 +86,7 @@ function toggleEdit(id){ function delete_commentModal(t, id) { - document.getElementById("deleteCommentButton").addEventListener('click', () => { + document.getElementById("deleteCommentButton").addEventListener('click', function() { postToast(t, `/delete/comment/${id}`, { }, @@ -130,7 +130,7 @@ function post_reply(id){ const upload_prog = document.getElementById(`upload-prog-c_${id}`); xhr[0].upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)}; - xhr[0].onload=() =>{ + xhr[0].onload=function(){ upload_prog.classList.add("d-none") let data @@ -186,7 +186,7 @@ function comment_edit(id){ const upload_prog = document.getElementById(`upload-prog-edit-c_${id}`); xhr[0].upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)}; - xhr[0].onload=() =>{ + xhr[0].onload=function(){ upload_prog.classList.add("d-none") let data @@ -243,7 +243,7 @@ function post_comment(fullname, hide){ xhr.upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)}; xhr.setRequestHeader('xhr', 'xhr'); - xhr.onload=() =>{ + xhr.onload=function(){ upload_prog.classList.add("d-none") let data @@ -306,7 +306,7 @@ function handle_action(type, cid, thing) { - xhr.onload=() =>{ + xhr.onload=function(){ let data try {data = JSON.parse(xhr.response)} catch(e) {console.log(e)} diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 198cff735..b35183b8d 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -48,7 +48,7 @@ function postToast(t, url, data, extraActionsOnSuccess, method="POST") { } } const xhr = createXhrWithFormKey(url, method, form); - xhr[0].onload = () => { + xhr[0].onload = function() { let result let message; let success = xhr[0].status >= 200 && xhr[0].status < 300; @@ -313,7 +313,7 @@ function sendFormXHR(form, extraActionsOnSuccess) { xhr.open("POST", actionPath); xhr.setRequestHeader('xhr', 'xhr'); - xhr.onload = () => { + xhr.onload = function() { if (xhr.status >= 200 && xhr.status < 300) { let data = JSON.parse(xhr.response); showToast(true, getMessageFromJsonData(true, data)); @@ -519,7 +519,7 @@ if (file_upload) { { const fileReader = new FileReader(); fileReader.readAsDataURL(file_upload.files[0]); - fileReader.addEventListener("load", () => { + fileReader.addEventListener("load", function () { document.getElementById('image-preview').setAttribute('src', this.result); document.getElementById('image-preview').classList.remove('d-none'); }); diff --git a/files/assets/js/delete_post_modal.js b/files/assets/js/delete_post_modal.js index 7528d8101..20176437e 100644 --- a/files/assets/js/delete_post_modal.js +++ b/files/assets/js/delete_post_modal.js @@ -1,5 +1,5 @@ function delete_postModal(t, id) { - document.getElementById("deletePostButton").addEventListener('click', () => { + document.getElementById("deletePostButton").addEventListener('click', function() { postToast(t, `/delete_post/${id}`, { }, diff --git a/files/assets/js/emoji_modal.js b/files/assets/js/emoji_modal.js index ba8832a76..cf94c61ec 100644 --- a/files/assets/js/emoji_modal.js +++ b/files/assets/js/emoji_modal.js @@ -295,7 +295,7 @@ function emojiAddToInput(event) // Sir, come out and drink your Chromium complaint web // I HATE CHROME. I HATE CHROME if(window.chrome !== undefined) - setTimeout(() =>{ + setTimeout(function(){ console.warn("Chrome detected, r-slured mode enabled."); // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA @@ -524,7 +524,7 @@ function loadEmojis(inputTargetIDName) emojiInputTargetDOM = document.getElementById(inputTargetIDName); } -document.getElementById('emojiModal').addEventListener('shown.bs.modal', () => { +document.getElementById('emojiModal').addEventListener('shown.bs.modal', function () { focusSearchBar(emojiSearchBarDOM); setTimeout(() => { focusSearchBar(emojiSearchBarDOM); diff --git a/files/assets/js/gif_modal.js b/files/assets/js/gif_modal.js index 7e142da34..0a10b45b1 100644 --- a/files/assets/js/gif_modal.js +++ b/files/assets/js/gif_modal.js @@ -14,7 +14,7 @@ function insertGIF(url) { if (typeof checkForRequired === "function") checkForRequired(); } -document.getElementById('gifModal').addEventListener('shown.bs.modal', () => { +document.getElementById('gifModal').addEventListener('shown.bs.modal', function () { focusSearchBar(gifSearchBar); setTimeout(() => { focusSearchBar(gifSearchBar); diff --git a/files/assets/js/lottery.js b/files/assets/js/lottery.js index ab5bb2f77..7ffc7a1c8 100644 --- a/files/assets/js/lottery.js +++ b/files/assets/js/lottery.js @@ -1,5 +1,5 @@ let purchaseQuantity = 1; -const lotteryOnReady = () => { +const lotteryOnReady = function () { checkLotteryStats(); // Show ticket being pulled. diff --git a/files/assets/js/mobile_navigation_bar.js b/files/assets/js/mobile_navigation_bar.js index 4c21b9d93..992f0b537 100644 --- a/files/assets/js/mobile_navigation_bar.js +++ b/files/assets/js/mobile_navigation_bar.js @@ -1,5 +1,5 @@ let prevScrollpos = window.pageYOffset; -window.onscroll = () => { +window.onscroll = function () { const currentScrollPos = window.pageYOffset; const topBar = document.getElementById("fixed-bar-mobile"); diff --git a/files/assets/js/more_comments.js b/files/assets/js/more_comments.js index 0cf92bb42..e0f008b43 100644 --- a/files/assets/js/more_comments.js +++ b/files/assets/js/more_comments.js @@ -8,7 +8,7 @@ function more_comments(cid, sort) { const xhr = new XMLHttpRequest(); xhr.open("get", `/more_comments/${cid}`); xhr.setRequestHeader('xhr', 'xhr'); - xhr.onload=() =>{ + xhr.onload=function(){ if (xhr.status==200) { let e = document.getElementById(`replies-of-c_${cid}`) e.innerHTML = xhr.response.replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '').replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`); diff --git a/files/assets/js/register_service_worker.js b/files/assets/js/register_service_worker.js index 8113c90b3..95db4c377 100644 --- a/files/assets/js/register_service_worker.js +++ b/files/assets/js/register_service_worker.js @@ -49,7 +49,7 @@ function subscribeUser(swRegistration, applicationServerPublicKey, apiEndpoint) throw new Error('Bad response from server.'); } }) - .catch(() => { + .catch(function() { }); } @@ -62,7 +62,7 @@ function registerServiceWorker(serviceWorkerUrl, applicationServerPublicKey, api swRegistration = swReg; }) - .catch(() => { + .catch(function() { }); } else { } diff --git a/files/assets/js/report_post_modal.js b/files/assets/js/report_post_modal.js index 7ea97af90..c60ecd71f 100644 --- a/files/assets/js/report_post_modal.js +++ b/files/assets/js/report_post_modal.js @@ -22,7 +22,7 @@ function report_postModal(id) { reason_post.focus() }, 500); - reportPostButton.addEventListener('click', () => { + reportPostButton.addEventListener('click', function() { this.innerHTML='Reporting post'; this.disabled = true; @@ -35,7 +35,7 @@ function report_postModal(id) { form.append("formkey", formkey()); form.append("reason", reason_post.value); - xhr.onload = () => { + xhr.onload = function() { let data try {data = JSON.parse(xhr.response)} catch(e) {console.log(e)} @@ -43,7 +43,7 @@ function report_postModal(id) { showToast(success, getMessageFromJsonData(success, data)); }; - xhr.onerror=() =>{alert(errortext)}; + xhr.onerror=function(){alert(errortext)}; xhr.send(form); }) }; diff --git a/files/assets/js/settings_profile.js b/files/assets/js/settings_profile.js index da66f22fd..8017f1a79 100644 --- a/files/assets/js/settings_profile.js +++ b/files/assets/js/settings_profile.js @@ -4,7 +4,7 @@ function post(url) { xhr.setRequestHeader('xhr', 'xhr'); const form = new FormData() form.append("formkey", formkey()); - xhr.onload = () => {location.reload();}; + xhr.onload = function() {location.reload();}; xhr.send(form); }; @@ -103,9 +103,9 @@ const sr_toggle = document.getElementById("slurreplacer"); const sr_link = document.getElementById('slurreplacer-perma-link'); const pr_toggle = document.getElementById("profanityreplacer"); const pr_link = document.getElementById('profanityreplacer-perma-link'); -sr_toggle.addEventListener('change', () => { +sr_toggle.addEventListener('change', function () { sr_link.hidden = !sr_toggle.checked; }); -pr_toggle.addEventListener('change', () => { +pr_toggle.addEventListener('change', function () { pr_link.hidden = !pr_toggle.checked; }); diff --git a/files/assets/js/settings_security.js b/files/assets/js/settings_security.js index ef136524b..7a32a3e6a 100644 --- a/files/assets/js/settings_security.js +++ b/files/assets/js/settings_security.js @@ -1,4 +1,4 @@ -document.getElementById('new_email').addEventListener('input', () => { +document.getElementById('new_email').addEventListener('input', function () { document.getElementById("email-password").classList.remove("d-none"); document.getElementById("email-password-label").classList.remove("d-none"); document.getElementById("emailpasswordRequired").classList.remove("d-none"); @@ -20,7 +20,7 @@ function block_user() { f=new FormData(); f.append("username", username); f.append("formkey", formkey()); - xhr.onload=() =>{ + xhr.onload=function(){ if (xhr.status<300) { location.reload(); } diff --git a/files/assets/js/signup.js b/files/assets/js/signup.js index 9e8b34e49..bb10053af 100644 --- a/files/assets/js/signup.js +++ b/files/assets/js/signup.js @@ -1,4 +1,4 @@ -document.getElementById('password-register').addEventListener('input', () => { +document.getElementById('password-register').addEventListener('input', function () { const charCount = document.getElementById("password-register").value; const id = document.getElementById("passwordHelpRegister"); @@ -13,7 +13,7 @@ document.getElementById('password-register').addEventListener('input', () => { } }); -document.getElementById('username-register').addEventListener('input', () => { +document.getElementById('username-register').addEventListener('input', function () { const userName = document.getElementById("username-register").value; const id = document.getElementById("usernameHelpRegister"); diff --git a/files/assets/js/submit.js b/files/assets/js/submit.js index e6e6b8d27..64365a895 100644 --- a/files/assets/js/submit.js +++ b/files/assets/js/submit.js @@ -94,7 +94,7 @@ function autoSuggestTitle() { const x = new XMLHttpRequest(); x.withCredentials=true; - x.onreadystatechange = () => { + x.onreadystatechange = function() { if (x.readyState == 4 && x.status == 200 && !titleField.value) { title=JSON.parse(x.responseText)["title"]; @@ -133,7 +133,7 @@ function checkRepost() { const form = new FormData() form.append("url", url); - xhr.onload=() =>{ + xhr.onload=function(){ try {data = JSON.parse(xhr.response)} catch(e) {console.log(e)} @@ -176,7 +176,7 @@ function submit(form) { xhr.setRequestHeader('xhr', 'xhr'); - xhr.onload = () => { + xhr.onload = function() { upload_prog.classList.add("d-none") if (xhr.status >= 200 && xhr.status < 300) { diff --git a/files/assets/js/view_more.js b/files/assets/js/view_more.js index 27ef9d28f..e7fca62c2 100644 --- a/files/assets/js/view_more.js +++ b/files/assets/js/view_more.js @@ -7,7 +7,7 @@ function view_more(t, pid, sort, offset) { ids = t.dataset.ids.toString().replace(/[\[\] ]/g, '') xhr.open("get", `/view_more/${pid}/${sort}/${offset}?ids=${ids}`); xhr.setRequestHeader('xhr', 'xhr'); - xhr.onload=() =>{ + xhr.onload=function(){ if (xhr.status==200) { let e = document.getElementById(`view_more-${offset}`); e.innerHTML = xhr.response.replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '').replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`);