2022-07-16 21:00:02 +00:00
|
|
|
function post(url) {
|
|
|
|
const xhr = new XMLHttpRequest();
|
|
|
|
xhr.open("POST", url);
|
|
|
|
xhr.setRequestHeader('xhr', 'xhr');
|
2022-07-23 08:57:53 +00:00
|
|
|
const form = new FormData()
|
2022-07-16 21:00:02 +00:00
|
|
|
form.append("formkey", formkey());
|
|
|
|
xhr.onload = function() {location.reload();};
|
|
|
|
xhr.send(form);
|
|
|
|
};
|
|
|
|
|
|
|
|
function updatebgselection(){
|
2022-12-04 15:40:32 +00:00
|
|
|
const bgselector = document.getElementById("backgroundSelector");
|
2022-07-16 21:00:02 +00:00
|
|
|
const backgrounds = [
|
2022-11-27 16:15:15 +00:00
|
|
|
{
|
|
|
|
folder: "glitter",
|
|
|
|
backgrounds:
|
|
|
|
[
|
|
|
|
"1.webp",
|
|
|
|
"2.webp",
|
|
|
|
"3.webp",
|
|
|
|
"4.webp",
|
|
|
|
"5.webp",
|
|
|
|
]
|
|
|
|
},
|
2022-07-16 21:00:02 +00:00
|
|
|
{
|
|
|
|
folder: "anime",
|
|
|
|
backgrounds:
|
|
|
|
[
|
|
|
|
"1.webp",
|
|
|
|
"2.webp",
|
|
|
|
"3.webp",
|
|
|
|
"4.webp",
|
|
|
|
"5.webp",
|
2022-11-27 18:50:34 +00:00
|
|
|
"6.webp",
|
2022-07-16 21:00:02 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
folder: "fantasy",
|
2022-09-04 23:15:37 +00:00
|
|
|
backgrounds:
|
2022-07-16 21:00:02 +00:00
|
|
|
[
|
|
|
|
"1.webp",
|
|
|
|
"2.webp",
|
|
|
|
"3.webp",
|
|
|
|
"4.webp",
|
|
|
|
"5.webp",
|
|
|
|
"6.webp",
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
folder: "solarpunk",
|
2022-09-04 23:15:37 +00:00
|
|
|
backgrounds:
|
2022-07-16 21:00:02 +00:00
|
|
|
[
|
|
|
|
"1.webp",
|
|
|
|
"2.webp",
|
|
|
|
"3.webp",
|
|
|
|
"4.webp",
|
|
|
|
"5.webp",
|
|
|
|
"6.webp",
|
|
|
|
"7.webp",
|
|
|
|
"8.webp",
|
|
|
|
"9.webp",
|
|
|
|
"10.webp",
|
|
|
|
"11.webp",
|
|
|
|
"12.webp",
|
|
|
|
"13.webp",
|
|
|
|
"14.webp",
|
|
|
|
"15.webp",
|
|
|
|
"16.webp",
|
|
|
|
"17.webp",
|
|
|
|
"18.webp",
|
|
|
|
"19.webp",
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
folder: "pixelart",
|
|
|
|
backgrounds:
|
|
|
|
[
|
|
|
|
"1.webp",
|
|
|
|
"2.webp",
|
|
|
|
"3.webp",
|
|
|
|
"4.webp",
|
|
|
|
"5.webp",
|
|
|
|
]
|
|
|
|
},
|
|
|
|
]
|
|
|
|
let bgContainer = document.getElementById(`bgcontainer`);
|
|
|
|
let str = '';
|
|
|
|
let bgsToDisplay = backgrounds[bgselector.selectedIndex].backgrounds;
|
|
|
|
let bgsDir = backgrounds[bgselector.selectedIndex].folder;
|
|
|
|
for (i=0; i < bgsToDisplay.length; i++) {
|
|
|
|
let onclickPost = bgsDir + "/" + bgsToDisplay[i];
|
2022-11-07 01:46:53 +00:00
|
|
|
str += `<button class="btn btn-secondary bg-button"><img class='bg-image' src="/i/backgrounds/${bgsDir}/${bgsToDisplay[i]}?v=2000" alt="${bgsToDisplay[i]}-background" onclick="post('/settings/personal?background=${onclickPost}')"></button>`;
|
2022-07-16 21:00:02 +00:00
|
|
|
}
|
|
|
|
bgContainer.innerHTML = str;
|
|
|
|
}
|
|
|
|
updatebgselection();
|
|
|
|
|
|
|
|
document.onpaste = function(event) {
|
2022-12-04 15:40:32 +00:00
|
|
|
const focused = document.activeElement;
|
2022-07-16 21:00:02 +00:00
|
|
|
if (focused.id == 'bio-text') {
|
2022-11-13 14:16:42 +00:00
|
|
|
const files = structuredClone(event.clipboardData.files);
|
2022-10-11 17:13:50 +00:00
|
|
|
|
|
|
|
if (files.length > 4)
|
|
|
|
{
|
|
|
|
alert("You can't upload more than 4 files at one time!")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-07-16 21:00:02 +00:00
|
|
|
if (files.length)
|
|
|
|
{
|
|
|
|
f=document.getElementById('file-upload');
|
|
|
|
let filename = ''
|
|
|
|
for (const file of files)
|
|
|
|
filename += file.name + ', '
|
2022-11-07 22:21:03 +00:00
|
|
|
filename = filename.toLowerCase().slice(0, -2)
|
2022-07-16 21:00:02 +00:00
|
|
|
f.files = files;
|
|
|
|
document.getElementById('filename-show').textContent = filename;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-29 14:20:27 +00:00
|
|
|
|
|
|
|
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_link.hidden = !sr_toggle.checked;
|
|
|
|
});
|
|
|
|
pr_toggle.addEventListener('change', function () {
|
|
|
|
pr_link.hidden = !pr_toggle.checked;
|
|
|
|
});
|