use () => instead of function() for consistency
parent
52372b156d
commit
b9aad1503c
|
@ -1,6 +1,6 @@
|
||||||
function postToastRoastEventDarkmode(t, url) {
|
function postToastRoastEventDarkmode(t, url) {
|
||||||
const xhr = createXhrWithFormKey(url);
|
const xhr = createXhrWithFormKey(url);
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = () => {
|
||||||
postToastLoadEventDarkmode(xhr[0])
|
postToastLoadEventDarkmode(xhr[0])
|
||||||
};
|
};
|
||||||
xhr[0].send(xhr[1]);
|
xhr[0].send(xhr[1]);
|
||||||
|
|
|
@ -4,7 +4,7 @@ function submitAddAlt(element, username) {
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
form.append('other_username', document.getElementById('link-input-other').value);
|
form.append('other_username', document.getElementById('link-input-other').value);
|
||||||
const xhr = createXhrWithFormKey(`/@${username}/alts/`, 'POST', form);
|
const xhr = createXhrWithFormKey(`/@${username}/alts/`, 'POST', form);
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = () => {
|
||||||
let data;
|
let data;
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(xhr[0].response);
|
data = JSON.parse(xhr[0].response);
|
||||||
|
|
|
@ -136,7 +136,7 @@ function buy(mb) {
|
||||||
url = `/buy/${kind}`
|
url = `/buy/${kind}`
|
||||||
if (mb) url += "?mb=true"
|
if (mb) url += "?mb=true"
|
||||||
const xhr = createXhrWithFormKey(url);
|
const xhr = createXhrWithFormKey(url);
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = () => {
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr[0].response)}
|
try {data = JSON.parse(xhr[0].response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.log(e)}
|
||||||
|
|
|
@ -3,10 +3,10 @@ function banModal(link, name, fullname, cls) {
|
||||||
document.getElementById("ban-modal-link").value = link;
|
document.getElementById("ban-modal-link").value = link;
|
||||||
document.getElementById("banUserButton").innerHTML = `Ban @${name}`;
|
document.getElementById("banUserButton").innerHTML = `Ban @${name}`;
|
||||||
|
|
||||||
document.getElementById("banUserButton").addEventListener('click', function() {
|
document.getElementById("banUserButton").addEventListener('click', () => {
|
||||||
let form = new FormData(document.getElementById("banModalForm"));
|
let form = new FormData(document.getElementById("banModalForm"));
|
||||||
const xhr = createXhrWithFormKey(`/ban_user/${fullname}?form`, "POST", form);
|
const xhr = createXhrWithFormKey(`/ban_user/${fullname}?form`, "POST", form);
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = () => {
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr[0].response)}
|
try {data = JSON.parse(xhr[0].response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.log(e)}
|
||||||
|
@ -25,10 +25,10 @@ function chudModal(link, name, fullname, cls) {
|
||||||
document.getElementById("chud-modal-link").value = link;
|
document.getElementById("chud-modal-link").value = link;
|
||||||
document.getElementById("chudUserButton").innerHTML = `Chud @${name}`;
|
document.getElementById("chudUserButton").innerHTML = `Chud @${name}`;
|
||||||
|
|
||||||
document.getElementById("chudUserButton").addEventListener('click', function() {
|
document.getElementById("chudUserButton").addEventListener('click', () => {
|
||||||
let form = new FormData(document.getElementById("chudModalForm"));
|
let form = new FormData(document.getElementById("chudModalForm"));
|
||||||
const xhr = createXhrWithFormKey(`/agendaposter/${fullname}?form`, "POST", form);
|
const xhr = createXhrWithFormKey(`/agendaposter/${fullname}?form`, "POST", form);
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = () => {
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr[0].response)}
|
try {data = JSON.parse(xhr[0].response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.log(e)}
|
||||||
|
|
|
@ -172,7 +172,7 @@ function send() {
|
||||||
input.parentElement.nextElementSibling.classList.add('d-none');
|
input.parentElement.nextElementSibling.classList.add('d-none');
|
||||||
|
|
||||||
box.scrollTo(0, box.scrollHeight);
|
box.scrollTo(0, box.scrollHeight);
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
box.scrollTo(0, box.scrollHeight)
|
box.scrollTo(0, box.scrollHeight)
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
@ -223,15 +223,15 @@ socket.on('online', function(data){
|
||||||
bs_trigger(document.getElementById('online3'))
|
bs_trigger(document.getElementById('online3'))
|
||||||
})
|
})
|
||||||
|
|
||||||
window.addEventListener('blur', function(){
|
window.addEventListener('blur', () =>{
|
||||||
focused=false
|
focused=false
|
||||||
})
|
})
|
||||||
window.addEventListener('focus', function(){
|
window.addEventListener('focus', () =>{
|
||||||
focused=true
|
focused=true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
ta.addEventListener("input", function() {
|
ta.addEventListener("input", () => {
|
||||||
text = ta.value
|
text = ta.value
|
||||||
if (!text && is_typing==true){
|
if (!text && is_typing==true){
|
||||||
is_typing=false;
|
is_typing=false;
|
||||||
|
@ -313,18 +313,18 @@ document.onpaste = function(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
box.scrollTo(0, box.scrollHeight)
|
box.scrollTo(0, box.scrollHeight)
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
box.scrollTo(0, box.scrollHeight)
|
box.scrollTo(0, box.scrollHeight)
|
||||||
}, 200);
|
}, 200);
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
box.scrollTo(0, box.scrollHeight)
|
box.scrollTo(0, box.scrollHeight)
|
||||||
}, 500);
|
}, 500);
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
box.scrollTo(0, box.scrollHeight)
|
box.scrollTo(0, box.scrollHeight)
|
||||||
}, 1000);
|
}, 1000);
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
box.scrollTo(0, box.scrollHeight)
|
box.scrollTo(0, box.scrollHeight)
|
||||||
}, 1500);
|
}, 1500);
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
box.scrollTo(0, box.scrollHeight)
|
box.scrollTo(0, box.scrollHeight)
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,7 +25,7 @@ function report_commentModal(id, author) {
|
||||||
reason_comment.focus()
|
reason_comment.focus()
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
reportCommentButton.addEventListener('click', function() {
|
reportCommentButton.addEventListener('click', () => {
|
||||||
this.innerHTML='Reporting comment';
|
this.innerHTML='Reporting comment';
|
||||||
|
|
||||||
postToast(this, `/report/comment/${id}`,
|
postToast(this, `/report/comment/${id}`,
|
||||||
|
@ -86,7 +86,7 @@ function toggleEdit(id){
|
||||||
|
|
||||||
|
|
||||||
function delete_commentModal(t, id) {
|
function delete_commentModal(t, id) {
|
||||||
document.getElementById("deleteCommentButton").addEventListener('click', function() {
|
document.getElementById("deleteCommentButton").addEventListener('click', () => {
|
||||||
postToast(t, `/delete/comment/${id}`,
|
postToast(t, `/delete/comment/${id}`,
|
||||||
{
|
{
|
||||||
},
|
},
|
||||||
|
@ -130,7 +130,7 @@ function post_reply(id){
|
||||||
const upload_prog = document.getElementById(`upload-prog-c_${id}`);
|
const upload_prog = document.getElementById(`upload-prog-c_${id}`);
|
||||||
xhr[0].upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)};
|
xhr[0].upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)};
|
||||||
|
|
||||||
xhr[0].onload=function(){
|
xhr[0].onload=() =>{
|
||||||
upload_prog.classList.add("d-none")
|
upload_prog.classList.add("d-none")
|
||||||
|
|
||||||
let data
|
let data
|
||||||
|
@ -186,7 +186,7 @@ function comment_edit(id){
|
||||||
const upload_prog = document.getElementById(`upload-prog-edit-c_${id}`);
|
const upload_prog = document.getElementById(`upload-prog-edit-c_${id}`);
|
||||||
xhr[0].upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)};
|
xhr[0].upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)};
|
||||||
|
|
||||||
xhr[0].onload=function(){
|
xhr[0].onload=() =>{
|
||||||
upload_prog.classList.add("d-none")
|
upload_prog.classList.add("d-none")
|
||||||
|
|
||||||
let data
|
let data
|
||||||
|
@ -243,7 +243,7 @@ function post_comment(fullname, hide){
|
||||||
xhr.upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)};
|
xhr.upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)};
|
||||||
|
|
||||||
xhr.setRequestHeader('xhr', 'xhr');
|
xhr.setRequestHeader('xhr', 'xhr');
|
||||||
xhr.onload=function(){
|
xhr.onload=() =>{
|
||||||
upload_prog.classList.add("d-none")
|
upload_prog.classList.add("d-none")
|
||||||
|
|
||||||
let data
|
let data
|
||||||
|
@ -306,7 +306,7 @@ function handle_action(type, cid, thing) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
xhr.onload=function(){
|
xhr.onload=() =>{
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr.response)}
|
try {data = JSON.parse(xhr.response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.log(e)}
|
||||||
|
|
|
@ -48,7 +48,7 @@ function postToast(t, url, data, extraActionsOnSuccess, method="POST") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const xhr = createXhrWithFormKey(url, method, form);
|
const xhr = createXhrWithFormKey(url, method, form);
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = () => {
|
||||||
let result
|
let result
|
||||||
let message;
|
let message;
|
||||||
let success = xhr[0].status >= 200 && xhr[0].status < 300;
|
let success = xhr[0].status >= 200 && xhr[0].status < 300;
|
||||||
|
@ -313,7 +313,7 @@ function sendFormXHR(form, extraActionsOnSuccess) {
|
||||||
xhr.open("POST", actionPath);
|
xhr.open("POST", actionPath);
|
||||||
xhr.setRequestHeader('xhr', 'xhr');
|
xhr.setRequestHeader('xhr', 'xhr');
|
||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = () => {
|
||||||
if (xhr.status >= 200 && xhr.status < 300) {
|
if (xhr.status >= 200 && xhr.status < 300) {
|
||||||
let data = JSON.parse(xhr.response);
|
let data = JSON.parse(xhr.response);
|
||||||
showToast(true, getMessageFromJsonData(true, data));
|
showToast(true, getMessageFromJsonData(true, data));
|
||||||
|
@ -519,7 +519,7 @@ if (file_upload) {
|
||||||
{
|
{
|
||||||
const fileReader = new FileReader();
|
const fileReader = new FileReader();
|
||||||
fileReader.readAsDataURL(file_upload.files[0]);
|
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').setAttribute('src', this.result);
|
||||||
document.getElementById('image-preview').classList.remove('d-none');
|
document.getElementById('image-preview').classList.remove('d-none');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function delete_postModal(t, id) {
|
function delete_postModal(t, id) {
|
||||||
document.getElementById("deletePostButton").addEventListener('click', function() {
|
document.getElementById("deletePostButton").addEventListener('click', () => {
|
||||||
postToast(t, `/delete_post/${id}`,
|
postToast(t, `/delete_post/${id}`,
|
||||||
{
|
{
|
||||||
},
|
},
|
||||||
|
|
|
@ -295,7 +295,7 @@ function emojiAddToInput(event)
|
||||||
// Sir, come out and drink your Chromium complaint web
|
// Sir, come out and drink your Chromium complaint web
|
||||||
// I HATE CHROME. I HATE CHROME
|
// I HATE CHROME. I HATE CHROME
|
||||||
if(window.chrome !== undefined)
|
if(window.chrome !== undefined)
|
||||||
setTimeout(function(){
|
setTimeout(() =>{
|
||||||
console.warn("Chrome detected, r-slured mode enabled.");
|
console.warn("Chrome detected, r-slured mode enabled.");
|
||||||
|
|
||||||
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
@ -524,7 +524,7 @@ function loadEmojis(inputTargetIDName)
|
||||||
emojiInputTargetDOM = document.getElementById(inputTargetIDName);
|
emojiInputTargetDOM = document.getElementById(inputTargetIDName);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('emojiModal').addEventListener('shown.bs.modal', function () {
|
document.getElementById('emojiModal').addEventListener('shown.bs.modal', () => {
|
||||||
focusSearchBar(emojiSearchBarDOM);
|
focusSearchBar(emojiSearchBarDOM);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
focusSearchBar(emojiSearchBarDOM);
|
focusSearchBar(emojiSearchBarDOM);
|
||||||
|
|
|
@ -14,7 +14,7 @@ function insertGIF(url) {
|
||||||
if (typeof checkForRequired === "function") checkForRequired();
|
if (typeof checkForRequired === "function") checkForRequired();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('gifModal').addEventListener('shown.bs.modal', function () {
|
document.getElementById('gifModal').addEventListener('shown.bs.modal', () => {
|
||||||
focusSearchBar(gifSearchBar);
|
focusSearchBar(gifSearchBar);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
focusSearchBar(gifSearchBar);
|
focusSearchBar(gifSearchBar);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
let purchaseQuantity = 1;
|
let purchaseQuantity = 1;
|
||||||
const lotteryOnReady = function () {
|
const lotteryOnReady = () => {
|
||||||
checkLotteryStats();
|
checkLotteryStats();
|
||||||
|
|
||||||
// Show ticket being pulled.
|
// Show ticket being pulled.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
let prevScrollpos = window.pageYOffset;
|
let prevScrollpos = window.pageYOffset;
|
||||||
window.onscroll = function () {
|
window.onscroll = () => {
|
||||||
const currentScrollPos = window.pageYOffset;
|
const currentScrollPos = window.pageYOffset;
|
||||||
|
|
||||||
const topBar = document.getElementById("fixed-bar-mobile");
|
const topBar = document.getElementById("fixed-bar-mobile");
|
||||||
|
|
|
@ -8,7 +8,7 @@ function more_comments(cid, sort) {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open("get", `/more_comments/${cid}`);
|
xhr.open("get", `/more_comments/${cid}`);
|
||||||
xhr.setRequestHeader('xhr', 'xhr');
|
xhr.setRequestHeader('xhr', 'xhr');
|
||||||
xhr.onload=function(){
|
xhr.onload=() =>{
|
||||||
if (xhr.status==200) {
|
if (xhr.status==200) {
|
||||||
let e = document.getElementById(`replies-of-c_${cid}`)
|
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}"`);
|
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.');
|
throw new Error('Bad response from server.');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function() {
|
.catch(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ function registerServiceWorker(serviceWorkerUrl, applicationServerPublicKey, api
|
||||||
|
|
||||||
swRegistration = swReg;
|
swRegistration = swReg;
|
||||||
})
|
})
|
||||||
.catch(function() {
|
.catch(() => {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ function report_postModal(id) {
|
||||||
reason_post.focus()
|
reason_post.focus()
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
reportPostButton.addEventListener('click', function() {
|
reportPostButton.addEventListener('click', () => {
|
||||||
|
|
||||||
this.innerHTML='Reporting post';
|
this.innerHTML='Reporting post';
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
|
@ -35,7 +35,7 @@ function report_postModal(id) {
|
||||||
form.append("formkey", formkey());
|
form.append("formkey", formkey());
|
||||||
form.append("reason", reason_post.value);
|
form.append("reason", reason_post.value);
|
||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = () => {
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr.response)}
|
try {data = JSON.parse(xhr.response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.log(e)}
|
||||||
|
@ -43,7 +43,7 @@ function report_postModal(id) {
|
||||||
showToast(success, getMessageFromJsonData(success, data));
|
showToast(success, getMessageFromJsonData(success, data));
|
||||||
};
|
};
|
||||||
|
|
||||||
xhr.onerror=function(){alert(errortext)};
|
xhr.onerror=() =>{alert(errortext)};
|
||||||
xhr.send(form);
|
xhr.send(form);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@ function post(url) {
|
||||||
xhr.setRequestHeader('xhr', 'xhr');
|
xhr.setRequestHeader('xhr', 'xhr');
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
form.append("formkey", formkey());
|
form.append("formkey", formkey());
|
||||||
xhr.onload = function() {location.reload();};
|
xhr.onload = () => {location.reload();};
|
||||||
xhr.send(form);
|
xhr.send(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ const sr_toggle = document.getElementById("slurreplacer");
|
||||||
const sr_link = document.getElementById('slurreplacer-perma-link');
|
const sr_link = document.getElementById('slurreplacer-perma-link');
|
||||||
const pr_toggle = document.getElementById("profanityreplacer");
|
const pr_toggle = document.getElementById("profanityreplacer");
|
||||||
const pr_link = document.getElementById('profanityreplacer-perma-link');
|
const pr_link = document.getElementById('profanityreplacer-perma-link');
|
||||||
sr_toggle.addEventListener('change', function () {
|
sr_toggle.addEventListener('change', () => {
|
||||||
sr_link.hidden = !sr_toggle.checked;
|
sr_link.hidden = !sr_toggle.checked;
|
||||||
});
|
});
|
||||||
pr_toggle.addEventListener('change', function () {
|
pr_toggle.addEventListener('change', () => {
|
||||||
pr_link.hidden = !pr_toggle.checked;
|
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").classList.remove("d-none");
|
||||||
document.getElementById("email-password-label").classList.remove("d-none");
|
document.getElementById("email-password-label").classList.remove("d-none");
|
||||||
document.getElementById("emailpasswordRequired").classList.remove("d-none");
|
document.getElementById("emailpasswordRequired").classList.remove("d-none");
|
||||||
|
@ -20,7 +20,7 @@ function block_user() {
|
||||||
f=new FormData();
|
f=new FormData();
|
||||||
f.append("username", username);
|
f.append("username", username);
|
||||||
f.append("formkey", formkey());
|
f.append("formkey", formkey());
|
||||||
xhr.onload=function(){
|
xhr.onload=() =>{
|
||||||
if (xhr.status<300) {
|
if (xhr.status<300) {
|
||||||
location.reload();
|
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 charCount = document.getElementById("password-register").value;
|
||||||
const id = document.getElementById("passwordHelpRegister");
|
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 userName = document.getElementById("username-register").value;
|
||||||
const id = document.getElementById("usernameHelpRegister");
|
const id = document.getElementById("usernameHelpRegister");
|
||||||
|
|
|
@ -94,7 +94,7 @@ function autoSuggestTitle() {
|
||||||
|
|
||||||
const x = new XMLHttpRequest();
|
const x = new XMLHttpRequest();
|
||||||
x.withCredentials=true;
|
x.withCredentials=true;
|
||||||
x.onreadystatechange = function() {
|
x.onreadystatechange = () => {
|
||||||
if (x.readyState == 4 && x.status == 200 && !titleField.value) {
|
if (x.readyState == 4 && x.status == 200 && !titleField.value) {
|
||||||
|
|
||||||
title=JSON.parse(x.responseText)["title"];
|
title=JSON.parse(x.responseText)["title"];
|
||||||
|
@ -133,7 +133,7 @@ function checkRepost() {
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
form.append("url", url);
|
form.append("url", url);
|
||||||
|
|
||||||
xhr.onload=function(){
|
xhr.onload=() =>{
|
||||||
try {data = JSON.parse(xhr.response)}
|
try {data = JSON.parse(xhr.response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.log(e)}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ function submit(form) {
|
||||||
|
|
||||||
xhr.setRequestHeader('xhr', 'xhr');
|
xhr.setRequestHeader('xhr', 'xhr');
|
||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = () => {
|
||||||
upload_prog.classList.add("d-none")
|
upload_prog.classList.add("d-none")
|
||||||
|
|
||||||
if (xhr.status >= 200 && xhr.status < 300) {
|
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, '')
|
ids = t.dataset.ids.toString().replace(/[\[\] ]/g, '')
|
||||||
xhr.open("get", `/view_more/${pid}/${sort}/${offset}?ids=${ids}`);
|
xhr.open("get", `/view_more/${pid}/${sort}/${offset}?ids=${ids}`);
|
||||||
xhr.setRequestHeader('xhr', 'xhr');
|
xhr.setRequestHeader('xhr', 'xhr');
|
||||||
xhr.onload=function(){
|
xhr.onload=() =>{
|
||||||
if (xhr.status==200) {
|
if (xhr.status==200) {
|
||||||
let e = document.getElementById(`view_more-${offset}`);
|
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}"`);
|
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