forked from MarseyWorld/MarseyWorld
use () => instead of function() for consistency
parent
52372b156d
commit
b9aad1503c
|
@ -1,6 +1,6 @@
|
|||
function postToastRoastEventDarkmode(t, url) {
|
||||
const xhr = createXhrWithFormKey(url);
|
||||
xhr[0].onload = function() {
|
||||
xhr[0].onload = () => {
|
||||
postToastLoadEventDarkmode(xhr[0])
|
||||
};
|
||||
xhr[0].send(xhr[1]);
|
||||
|
|
|
@ -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 = function() {
|
||||
xhr[0].onload = () => {
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(xhr[0].response);
|
||||
|
|
|
@ -136,7 +136,7 @@ function buy(mb) {
|
|||
url = `/buy/${kind}`
|
||||
if (mb) url += "?mb=true"
|
||||
const xhr = createXhrWithFormKey(url);
|
||||
xhr[0].onload = function() {
|
||||
xhr[0].onload = () => {
|
||||
let data
|
||||
try {data = JSON.parse(xhr[0].response)}
|
||||
catch(e) {console.log(e)}
|
||||
|
|
|
@ -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', function() {
|
||||
document.getElementById("banUserButton").addEventListener('click', () => {
|
||||
let form = new FormData(document.getElementById("banModalForm"));
|
||||
const xhr = createXhrWithFormKey(`/ban_user/${fullname}?form`, "POST", form);
|
||||
xhr[0].onload = function() {
|
||||
xhr[0].onload = () => {
|
||||
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', function() {
|
||||
document.getElementById("chudUserButton").addEventListener('click', () => {
|
||||
let form = new FormData(document.getElementById("chudModalForm"));
|
||||
const xhr = createXhrWithFormKey(`/agendaposter/${fullname}?form`, "POST", form);
|
||||
xhr[0].onload = function() {
|
||||
xhr[0].onload = () => {
|
||||
let data
|
||||
try {data = JSON.parse(xhr[0].response)}
|
||||
catch(e) {console.log(e)}
|
||||
|
|
|
@ -172,7 +172,7 @@ function send() {
|
|||
input.parentElement.nextElementSibling.classList.add('d-none');
|
||||
|
||||
box.scrollTo(0, box.scrollHeight);
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
box.scrollTo(0, box.scrollHeight)
|
||||
}, 200);
|
||||
}
|
||||
|
@ -223,15 +223,15 @@ socket.on('online', function(data){
|
|||
bs_trigger(document.getElementById('online3'))
|
||||
})
|
||||
|
||||
window.addEventListener('blur', function(){
|
||||
window.addEventListener('blur', () =>{
|
||||
focused=false
|
||||
})
|
||||
window.addEventListener('focus', function(){
|
||||
window.addEventListener('focus', () =>{
|
||||
focused=true
|
||||
})
|
||||
|
||||
|
||||
ta.addEventListener("input", function() {
|
||||
ta.addEventListener("input", () => {
|
||||
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(function () {
|
||||
setTimeout(() => {
|
||||
box.scrollTo(0, box.scrollHeight)
|
||||
}, 200);
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
box.scrollTo(0, box.scrollHeight)
|
||||
}, 500);
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
box.scrollTo(0, box.scrollHeight)
|
||||
}, 1000);
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
box.scrollTo(0, box.scrollHeight)
|
||||
}, 1500);
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
box.scrollTo(0, box.scrollHeight)
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ function report_commentModal(id, author) {
|
|||
reason_comment.focus()
|
||||
}, 500);
|
||||
|
||||
reportCommentButton.addEventListener('click', function() {
|
||||
reportCommentButton.addEventListener('click', () => {
|
||||
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', function() {
|
||||
document.getElementById("deleteCommentButton").addEventListener('click', () => {
|
||||
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=function(){
|
||||
xhr[0].onload=() =>{
|
||||
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=function(){
|
||||
xhr[0].onload=() =>{
|
||||
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=function(){
|
||||
xhr.onload=() =>{
|
||||
upload_prog.classList.add("d-none")
|
||||
|
||||
let data
|
||||
|
@ -306,7 +306,7 @@ function handle_action(type, cid, thing) {
|
|||
|
||||
|
||||
|
||||
xhr.onload=function(){
|
||||
xhr.onload=() =>{
|
||||
let data
|
||||
try {data = JSON.parse(xhr.response)}
|
||||
catch(e) {console.log(e)}
|
||||
|
|
|
@ -48,7 +48,7 @@ function postToast(t, url, data, extraActionsOnSuccess, method="POST") {
|
|||
}
|
||||
}
|
||||
const xhr = createXhrWithFormKey(url, method, form);
|
||||
xhr[0].onload = function() {
|
||||
xhr[0].onload = () => {
|
||||
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 = function() {
|
||||
xhr.onload = () => {
|
||||
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", function () {
|
||||
fileReader.addEventListener("load", () => {
|
||||
document.getElementById('image-preview').setAttribute('src', this.result);
|
||||
document.getElementById('image-preview').classList.remove('d-none');
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function delete_postModal(t, id) {
|
||||
document.getElementById("deletePostButton").addEventListener('click', function() {
|
||||
document.getElementById("deletePostButton").addEventListener('click', () => {
|
||||
postToast(t, `/delete_post/${id}`,
|
||||
{
|
||||
},
|
||||
|
|
|
@ -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(function(){
|
||||
setTimeout(() =>{
|
||||
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', function () {
|
||||
document.getElementById('emojiModal').addEventListener('shown.bs.modal', () => {
|
||||
focusSearchBar(emojiSearchBarDOM);
|
||||
setTimeout(() => {
|
||||
focusSearchBar(emojiSearchBarDOM);
|
||||
|
|
|
@ -14,7 +14,7 @@ function insertGIF(url) {
|
|||
if (typeof checkForRequired === "function") checkForRequired();
|
||||
}
|
||||
|
||||
document.getElementById('gifModal').addEventListener('shown.bs.modal', function () {
|
||||
document.getElementById('gifModal').addEventListener('shown.bs.modal', () => {
|
||||
focusSearchBar(gifSearchBar);
|
||||
setTimeout(() => {
|
||||
focusSearchBar(gifSearchBar);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
let purchaseQuantity = 1;
|
||||
const lotteryOnReady = function () {
|
||||
const lotteryOnReady = () => {
|
||||
checkLotteryStats();
|
||||
|
||||
// Show ticket being pulled.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
let prevScrollpos = window.pageYOffset;
|
||||
window.onscroll = function () {
|
||||
window.onscroll = () => {
|
||||
const currentScrollPos = window.pageYOffset;
|
||||
|
||||
const topBar = document.getElementById("fixed-bar-mobile");
|
||||
|
|
|
@ -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=function(){
|
||||
xhr.onload=() =>{
|
||||
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}"`);
|
||||
|
|
|
@ -49,7 +49,7 @@ function subscribeUser(swRegistration, applicationServerPublicKey, apiEndpoint)
|
|||
throw new Error('Bad response from server.');
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
.catch(() => {
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ function registerServiceWorker(serviceWorkerUrl, applicationServerPublicKey, api
|
|||
|
||||
swRegistration = swReg;
|
||||
})
|
||||
.catch(function() {
|
||||
.catch(() => {
|
||||
});
|
||||
} else {
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ function report_postModal(id) {
|
|||
reason_post.focus()
|
||||
}, 500);
|
||||
|
||||
reportPostButton.addEventListener('click', function() {
|
||||
reportPostButton.addEventListener('click', () => {
|
||||
|
||||
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 = function() {
|
||||
xhr.onload = () => {
|
||||
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=function(){alert(errortext)};
|
||||
xhr.onerror=() =>{alert(errortext)};
|
||||
xhr.send(form);
|
||||
})
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@ function post(url) {
|
|||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
const form = new FormData()
|
||||
form.append("formkey", formkey());
|
||||
xhr.onload = function() {location.reload();};
|
||||
xhr.onload = () => {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', function () {
|
||||
sr_toggle.addEventListener('change', () => {
|
||||
sr_link.hidden = !sr_toggle.checked;
|
||||
});
|
||||
pr_toggle.addEventListener('change', function () {
|
||||
pr_toggle.addEventListener('change', () => {
|
||||
pr_link.hidden = !pr_toggle.checked;
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
document.getElementById('new_email').addEventListener('input', function () {
|
||||
document.getElementById('new_email').addEventListener('input', () => {
|
||||
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=function(){
|
||||
xhr.onload=() =>{
|
||||
if (xhr.status<300) {
|
||||
location.reload();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
document.getElementById('password-register').addEventListener('input', function () {
|
||||
document.getElementById('password-register').addEventListener('input', () => {
|
||||
|
||||
const charCount = document.getElementById("password-register").value;
|
||||
const id = document.getElementById("passwordHelpRegister");
|
||||
|
@ -13,7 +13,7 @@ document.getElementById('password-register').addEventListener('input', function
|
|||
}
|
||||
});
|
||||
|
||||
document.getElementById('username-register').addEventListener('input', function () {
|
||||
document.getElementById('username-register').addEventListener('input', () => {
|
||||
|
||||
const userName = document.getElementById("username-register").value;
|
||||
const id = document.getElementById("usernameHelpRegister");
|
||||
|
|
|
@ -94,7 +94,7 @@ function autoSuggestTitle() {
|
|||
|
||||
const x = new XMLHttpRequest();
|
||||
x.withCredentials=true;
|
||||
x.onreadystatechange = function() {
|
||||
x.onreadystatechange = () => {
|
||||
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=function(){
|
||||
xhr.onload=() =>{
|
||||
try {data = JSON.parse(xhr.response)}
|
||||
catch(e) {console.log(e)}
|
||||
|
||||
|
@ -176,7 +176,7 @@ function submit(form) {
|
|||
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
|
||||
xhr.onload = function() {
|
||||
xhr.onload = () => {
|
||||
upload_prog.classList.add("d-none")
|
||||
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
|
|
|
@ -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=function(){
|
||||
xhr.onload=() =>{
|
||||
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}"`);
|
||||
|
|
Loading…
Reference in New Issue