forked from MarseyWorld/MarseyWorld
parent
2ed9571176
commit
573d6a6fc6
|
@ -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]);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)
|
||||
});
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
|
|
@ -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}`,
|
||||
{
|
||||
},
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
let purchaseQuantity = 1;
|
||||
const lotteryOnReady = () => {
|
||||
const lotteryOnReady = function () {
|
||||
checkLotteryStats();
|
||||
|
||||
// Show ticket being pulled.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
let prevScrollpos = window.pageYOffset;
|
||||
window.onscroll = () => {
|
||||
window.onscroll = function () {
|
||||
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=() =>{
|
||||
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}"`);
|
||||
|
|
|
@ -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 {
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
})
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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}"`);
|
||||
|
|
Loading…
Reference in New Issue