add/remove spaces

pull/225/head
Aevann 2024-03-10 20:46:22 +02:00
parent 04dcaf8182
commit 8011e1ae41
26 changed files with 90 additions and 91 deletions

View File

@ -33,7 +33,7 @@ if (innerWidth >= 992)
y = point1["y"] - point2["y"],
angle = Math.atan(y/x)
if(point1["x"] < point2["x"]) {
if (point1["x"] < point2["x"]) {
angle += Math.PI
}

View File

@ -9,14 +9,14 @@ stylesheet_haunted.setAttribute("href", "/assets/events/homoween/css/haunt2.css?
stylesheet_haunted.disabled = true
document.head.appendChild(stylesheet_haunted)
window.onload = function(){
window.onload = function() {
if (thunder1)
thunder2.volume = 0.5
lightningStrike("normal")
}
setInterval(function(){
if(Math.floor(Math.random()*3) > 1){
setInterval(function() {
if (Math.floor(Math.random()*3) > 1) {
lightningStrike("haunted")
} else {
lightningStrike("normal")
@ -26,18 +26,18 @@ setInterval(function(){
function lightningStrike(strike) {
div.style.animation = "haunted 20s"
if(strike == "haunted"){
if (strike == "haunted") {
stylesheet_haunted.disabled = false
if (thunder1)
thunder2.play()
setTimeout(function(){
setTimeout(function() {
stylesheet_haunted.disabled = true
}, 700)
}
if (thunder1)
thunder1.play()
setTimeout(function(){
setTimeout(function() {
div.style.animation = "none"
}, 1000)
}

View File

@ -7,7 +7,7 @@ function scare() {
jumpscare_audio.play();
// Hide image and reset sound
setTimeout(function () {
setTimeout(function() {
image.style.display = "none";
jumpscare_audio.pause()
jumpscare_audio.currentTime = 0;
@ -15,7 +15,7 @@ function scare() {
}
if (Math.random() <= 0.1) {
setTimeout(function () {
setTimeout(function() {
const xhr = new XMLHttpRequest();
xhr.open("POST", "/jumpscare");
xhr.setRequestHeader('xhr', 'xhr');

View File

@ -1,6 +1,6 @@
/* Copyright (C) 2013 Justin Windle, http://soulwire.co.uk */
(function ( root, factory ) {
(function( root, factory ) {
if ( typeof exports === 'object' ) {
@ -18,7 +18,7 @@
root.Sketch = factory( root, root.document );
}
}( typeof window !== "undefined" ? window : this, function ( window, document ) {
}( typeof window !== "undefined" ? window : this, function( window, document ) {
"use strict";
/*
@ -378,7 +378,7 @@
context.dragging;
while( min )
while (min)
isString( eventMap[ min ] ) ?
@ -648,16 +648,16 @@ let blood = Sketch.create({autoclear: false, autopause: false}),
blood.update = function() {
let d = drops.length;
while(d < dropCount && i < maxDrops) {
while (d < dropCount && i < maxDrops) {
let drop = new Drop();
drops.push(drop);
d++;
i++;
}
while(d-- && i < maxDrops) {
while (d-- && i < maxDrops) {
let drop = drops[d];
drop.y += drop.vy;
if(drop.y - drop.radius > blood.height) {
if (drop.y - drop.radius > blood.height) {
drops.splice(d,1);
}
}
@ -665,7 +665,7 @@ blood.update = function() {
blood.draw = function() {
let d = drops.length;
while(d-- && i < maxDrops) {
while (d-- && i < maxDrops) {
let drop = drops[d];
blood.beginPath();
blood.fillStyle = 'rgba('+drop.r+','+drop.g+','+drop.b+',.8)';

View File

@ -80,7 +80,7 @@ function makeCircle() {
}
}
addEventListener("mousemove", function (e) {
addEventListener("mousemove", function(e) {
mouse.x = e.pageX;
mouse.y = e.pageY;
});

View File

@ -17,8 +17,7 @@ function postToastLoadTrickOrTreat(xhr) {
success = xhr.status >= 200 && xhr.status < 300;
showToast(success, getMessageFromJsonData(success, data));
if (data["result"] == 0){
if (data["result"] == 0) {
scare()
}
}

View File

@ -172,7 +172,7 @@ bs_trigger(document);
const negative_awards = document.querySelectorAll("[data-positive=False]")
document.addEventListener("click", function (e) {
document.addEventListener("click", function(e) {
let element = e.target
if (element.tagName == "I")
element = element.parentElement

View File

@ -184,7 +184,7 @@ function updateCardsetBackgrounds(state, complete = false) {
for (const cardset of cardsets) {
['PLAYING', 'LOST', 'PUSHED', 'WON', 'BLACKJACK'].forEach(status => cardset.classList.remove(`blackjack-cardset__${status}`));
}
if (complete){
if (complete) {
const wager = state.has_player_split ? state?.wager?.amount * 2 : state?.wager?.amount;
let dealerShows = state.payout < wager ? 'WON': 'LOST';
if (state.payout === wager || (state.player_doubled_down && state.status === 'PUSHED')) dealerShows = 'PUSHED'

View File

@ -39,7 +39,7 @@ socket.on('speak', function(json) {
}
chatline.classList.remove('chat-mention');
if (text_html.includes(`<a href="/id/${vid}"`)){
if (text_html.includes(`<a href="/id/${vid}"`)) {
chatline.classList.add('chat-mention');
}
@ -95,7 +95,7 @@ socket.on('speak', function(json) {
const quoted = document.getElementById(json.quotes)
if (quoted) {
const quoted_user = quoted.parentElement.querySelector('.user_id').value
if (quoted_user == vid){
if (quoted_user == vid) {
chatline.classList.add('chat-mention');
}
document.getElementsByClassName('quotes')[0].classList.remove("d-none")
@ -123,13 +123,13 @@ socket.on('speak', function(json) {
if (scrolled_down || json.user_id == vid) {
box.scrollTo(0, box.scrollHeight)
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 200);
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 500);
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 1000);
}
@ -168,13 +168,13 @@ function send() {
input.previousElementSibling.textContent = "";
box.scrollTo(0, box.scrollHeight);
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 200);
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 500);
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 1000);
}
@ -204,7 +204,7 @@ ta.addEventListener("keydown", function(e) {
}
})
socket.on('online', function(data){
socket.on('online', function(data) {
const online_li = data[0]
if (location.pathname.startsWith('/chat/')) {
for (const marker of document.getElementsByClassName('online-marker')) {
@ -260,7 +260,7 @@ function remove_typing() {
ta.addEventListener("input", function() {
text = ta.value
if (!text && is_typing){
if (!text && is_typing) {
is_typing = false;
socket.emit('typing', false);
}
@ -273,14 +273,14 @@ ta.addEventListener("input", function() {
})
socket.on('typing', function (users){
if (users.length==0){
socket.on('typing', function(users) {
if (users.length==0) {
document.getElementById('typing-indicator').innerHTML = '';
}
else if (users.length==1){
else if (users.length==1) {
document.getElementById('typing-indicator').innerHTML = '<b>'+users[0]+"</b> is typing...";
}
else if (users.length==2){
else if (users.length==2) {
document.getElementById('typing-indicator').innerHTML = '<b>'+users[0]+"</b> and <b>"+users[1]+"</b> are typing...";
}
else {
@ -309,7 +309,7 @@ socket.on('refresh_chat', () => {
location.reload()
})
document.addEventListener('click', function (e) {
document.addEventListener('click', function(e) {
if (e.target.classList.contains('delconfirm')) {
e.target.nextElementSibling.classList.remove('d-none');
e.target.classList.add('d-none');
@ -350,18 +350,18 @@ send_hearbeat()
setInterval(send_hearbeat, 20000);
box.scrollTo(0, box.scrollHeight)
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 200);
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 500);
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 1000);
setTimeout(function () {
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)
}, 1500);
document.addEventListener('DOMContentLoaded', function () {
document.addEventListener('DOMContentLoaded', function() {
box.scrollTo(0, box.scrollHeight)
});

View File

@ -84,7 +84,7 @@ function toggleReplyBox(t, id) {
t.innerHTML = newHTML
}
function toggleEdit(id){
function toggleEdit(id) {
const comment = document.getElementById("comment-text-"+id);
const form = document.getElementById("comment-edit-"+id);
const box = document.getElementById('comment-edit-body-'+id);
@ -159,7 +159,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=function() {
upload_prog.classList.add("d-none")
let data
@ -197,7 +197,7 @@ function post_reply(id) {
xhr[0].send(xhr[1]);
}
function comment_edit(id){
function comment_edit(id) {
const btn = document.getElementById(`edit-btn-${id}`)
btn.disabled = true
btn.classList.add('disabled');
@ -217,7 +217,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=function() {
upload_prog.classList.add("d-none")
let data
@ -262,7 +262,7 @@ function comment_edit(id){
xhr[0].send(xhr[1]);
}
function post_comment(fullname, hide){
function post_comment(fullname, hide) {
close_inline_emoji_modal();
const btn = document.getElementById('save-reply-to-'+fullname)
@ -294,7 +294,7 @@ function post_comment(fullname, hide){
xhr.upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)};
xhr.setRequestHeader('xhr', 'xhr');
xhr.onload=function(){
xhr.onload=function() {
upload_prog.classList.add("d-none")
let data

View File

@ -197,7 +197,7 @@ function formkey() {
function bs_trigger(e) {
let tooltipTriggerList = [].slice.call(e.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTriggerList.map(function(element){
tooltipTriggerList.map(function(element) {
return bootstrap.Tooltip.getOrCreateInstance(element);
});
@ -446,7 +446,7 @@ function insertText(input, text) {
input.setRangeText(text);
if (window.chrome !== undefined)
setTimeout(function(){
setTimeout(function() {
input.focus();
for (let i = 0; i < 2; i++)
input.setSelectionRange(newPos, newPos);
@ -580,7 +580,7 @@ if (file_upload) {
if (file.type.startsWith('image/')) {
const fileReader = new FileReader();
fileReader.readAsDataURL(file_upload.files[0]);
fileReader.onload = function () {
fileReader.onload = function() {
document.getElementById('image-preview').setAttribute('src', this.result);
document.getElementById('image-preview').classList.remove('d-none');
document.getElementById('image-preview').classList.add('mr-2');
@ -674,18 +674,18 @@ if (screen_width < 768) {
object = document
if (object) {
object.addEventListener('shown.bs.modal', function (e) {
object.addEventListener('shown.bs.modal', function(e) {
const new_href = `${location.href.split('#')[0]}#m-${e.target.id}`
history.pushState({}, '', new_href)
});
object.addEventListener('hide.bs.modal', function (e) {
object.addEventListener('hide.bs.modal', function(e) {
if (location.hash == `#m-${e.target.id}`) {
history.back();
}
});
addEventListener('hashchange', function () {
addEventListener('hashchange', function() {
if (!location.hash.startsWith("#m-")) {
const curr_modal = bootstrap.Modal.getInstance(document.getElementsByClassName('show')[0])
if (curr_modal) curr_modal.hide()

View File

@ -47,7 +47,7 @@ let emojiSearcher = {
work: async function work() {
this.working = true;
while(this.queries.length > 0)
while (this.queries.length > 0)
{
const startTime = Date.now();
@ -289,7 +289,7 @@ function openEmojiModal(t, inputTargetIDName)
}
}
document.getElementById('emojiModal').addEventListener('shown.bs.modal', function () {
document.getElementById('emojiModal').addEventListener('shown.bs.modal', function() {
focusSearchBar(emojiSearchBarDOM);
setTimeout(() => {
focusSearchBar(emojiSearchBarDOM);

View File

@ -30,7 +30,7 @@ function execute_fireworks(firework) {
let counter = 0
for (let firework of document.getElementsByClassName("firework")){
for (let firework of document.getElementsByClassName("firework")) {
const timeout = 2000 * counter
counter++
setTimeout(() => {

View File

@ -6,16 +6,16 @@ let notifs = 0
let focused = true
let alert = true;
addEventListener('blur', function(){
addEventListener('blur', function() {
focused = false
})
addEventListener('focus', function(){
addEventListener('focus', function() {
focused = true
})
function flash(){
function flash() {
let title = document.getElementsByTagName('title')[0]
if (notifs >= 1 && !focused){
if (notifs >= 1 && !focused) {
title.innerHTML = `[+${notifs}] ${page_title}`
if (alert) {
icon.href = `${SITE_FULL_IMAGES}/i/${SITE_NAME}/alert.ico?x=3009`

View File

@ -4,14 +4,14 @@ const container = document.getElementById('GIFs');
let commentFormID;
function insertGIF(url) {
function insertGif (url) {
const commentBox = document.getElementById(commentFormID);
insertText(commentBox, url)
}
const gifModal = document.getElementById('gifModal')
gifModal.addEventListener('shown.bs.modal', function () {
gifModal.addEventListener('shown.bs.modal', function() {
focusSearchBar(gifSearchBar);
setTimeout(() => {
focusSearchBar(gifSearchBar);
@ -137,7 +137,7 @@ async function searchGifs(searchTerm) {
const giphy = document.getElementsByClassName('giphy')
for (const element of giphy) {
element.addEventListener('click', () => {insertGIF(element.src)});
element.addEventListener('click', () => {insertGif (element.src)});
}
}
else {

View File

@ -1,5 +1,5 @@
let purchaseQuantity = 1;
const lotteryOnReady = function () {
const lotteryOnReady = function() {
checkLotteryStats();
// Show ticket being pulled.

View File

@ -3,14 +3,14 @@ marked.use({
{
name: 'mention',
level: 'inline',
start: function(src){
start: function(src) {
const match = src.match(/@[\w-]{1,30}/);
return match != null ? match.index : -1;
},
tokenizer: function(src) {
const rule = /^@[\w-]{1,30}/;
const match = rule.exec(src);
if (match){
if (match) {
return {
type: 'mention',
raw: match[0],
@ -27,14 +27,14 @@ marked.use({
{
name: 'group_mention',
level: 'inline',
start: function(src){
start: function(src) {
const match = src.match(/![\w-]{3,25}/);
return match != null ? match.index : -1;
},
tokenizer: function(src) {
const rule = /^![\w-]{3,25}/;
const match = rule.exec(src);
if (match){
if (match) {
return {
type: 'group_mention',
raw: match[0],
@ -51,14 +51,14 @@ marked.use({
{
name: 'underscore',
level: 'inline',
start: function(src){
start: function(src) {
const match = src.match(/_/);
return match != null ? match.index : -1;
},
tokenizer: function(src) {
const rule = /^_/;
const match = rule.exec(src);
if (match){
if (match) {
return {
type: 'underscore',
raw: match[0],
@ -104,7 +104,7 @@ const findAllEmojiEndings = (word) => {
let hasReachedNonModifer = false;
let currWord = word;
const currEndings = [];
while(!hasReachedNonModifer) {
while (!hasReachedNonModifer) {
if (currWord.endsWith('pat')) {
if (currEndings.indexOf(MODIFIERS.PAT) !== -1) {
hasReachedNonModifer = true;
@ -178,7 +178,7 @@ function markdown(t) {
{
if (!window.onbeforeunload)
{
window.onbeforeunload = function (e) {
window.onbeforeunload = function(e) {
e = e || window.event;
if (e) {
e.returnValue = 'Any string';
@ -198,7 +198,7 @@ function markdown(t) {
input = input.replace(/((\s|^)[0-9]+)\. /g, '$1\\. ')
const emojis = Array.from(input.matchAll(/:([a-z0-9_\-!#@]{1,72}):(?![^`]*`)/gi))
for (i = 0; i < emojis.length; i++){
for (i = 0; i < emojis.length; i++) {
const old = emojis[i][0];
if (old.includes('marseyrandom')) continue;
@ -259,8 +259,8 @@ function markdown(t) {
}
let options = Array.from(input.matchAll(/\$\$([^\$\n]+)\$\$(?![^`]*`)/gi))
if (options != null){
for (i = 0; i < options.length; i++){
if (options != null) {
for (i = 0; i < options.length; i++) {
const option = options[i][0];
const option2 = option.replace(/\$\$/g, '').replace(/\n/g, '')
input = input.replace(option, `<div class="custom-control mb-3"><input type="checkbox" class="custom-control-input" id="option-${i}"><label class="custom-control-label" for="option-${i}">${option2} - <a>0 votes</a></label></div>`);
@ -268,8 +268,8 @@ function markdown(t) {
}
options = Array.from(input.matchAll(/&&([^&\n]+)&&(?![^`]*`)/gi))
if (options != null){
for (i = 0; i < options.length; i++){
if (options != null) {
for (i = 0; i < options.length; i++) {
const option = options[i][0];
const option2 = option.replace(/&&/g, '').replace(/\n/g, '')
input = input.replace(option, `<div class="custom-control mb-3"><input type="radio" name="choice" class="custom-control-input" id="option-${i}"><label class="custom-control-label" for="option-${i}">${option2} - <a>0 votes</a></label></div>`);
@ -291,7 +291,7 @@ function markdown(t) {
}
const fileReader = new FileReader();
fileReader.readAsDataURL(file);
fileReader.onload = function () {
fileReader.onload = function() {
input = input.replace(`[${file.name}]`, `<img class="img" loading="lazy" src="${this.result}">`)
counter += 1
if (counter == files.length)
@ -317,7 +317,7 @@ function charLimit(form, text) {
if (length >= maxLength) {
text.style.color = "#E53E3E";
}
else if (length >= maxLength * .72){
else if (length >= maxLength * .72) {
text.style.color = "#FFC107";
}
else {

View File

@ -1,5 +1,5 @@
let prevScrollpos = window.pageYOffset;
window.onscroll = function () {
window.onscroll = function() {
const currentScrollPos = window.pageYOffset;
const topBar = document.getElementById("fixed-bar-mobile");

View File

@ -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=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}"`);

View File

@ -28,14 +28,14 @@ orgy_file.addEventListener('pause', () => {
add_playing_listener()
})
orgy_file.addEventListener("timeupdate", function(){
orgy_file.addEventListener("timeupdate", function() {
if (break_file.dataset.run == "False" && parseInt(orgy_file.currentTime) == 3000) {
break_file.dataset.run = "True"
orgy_file.pause();
orgy_file.classList.add('d-none');
break_file.classList.remove('d-none');
break_file.play()
setTimeout(function () {
setTimeout(function() {
break_file.pause()
break_file.classList.add('d-none');
orgy_file.classList.remove('d-none');
@ -45,7 +45,7 @@ orgy_file.addEventListener("timeupdate", function(){
}
});
orgy_file.addEventListener("ended", function(){
orgy_file.addEventListener("ended", function() {
location.reload()
});

View File

@ -25,7 +25,7 @@ function subscribeUser(swRegistration, applicationServerPublicKey, apiEndpoint)
});
}
function registerServiceWorker(serviceWorkerUrl, applicationServerPublicKey, apiEndpoint){
function registerServiceWorker(serviceWorkerUrl, applicationServerPublicKey, apiEndpoint) {
let swRegistration = null;
if ('serviceWorker' in navigator && 'PushManager' in window) {
navigator.serviceWorker.register(serviceWorkerUrl)

View File

@ -8,7 +8,7 @@ function post(url) {
xhr.send(form);
};
function updatebgselection(){
function updatebgselection() {
const bgselector = document.getElementById("backgroundSelector");
const backgrounds = [
{

View File

@ -1,4 +1,4 @@
document.getElementById('new_email').addEventListener('input', function () {
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");

View File

@ -1,4 +1,4 @@
document.getElementById('password-register').addEventListener('input', function () {
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', function
}
});
document.getElementById('username-register').addEventListener('input', function () {
document.getElementById('username-register').addEventListener('input', function() {
const userName = document.getElementById("username-register").value;
const id = document.getElementById("usernameHelpRegister");

View File

@ -132,7 +132,7 @@ function checkRepost() {
form.append("url", url);
form.append("formkey", formkey());
xhr.onload=function(){
xhr.onload=function() {
try {data = JSON.parse(xhr.response)}
catch(e) {console.error(e)}

View File

@ -7,7 +7,7 @@ function view_more(t, pid, sort, offset) {
ids = t.dataset.ids.replace(/[\[\] ]/g, '')
xhr.open("get", `/view_more/${pid}/${sort}/${offset}?ids=${ids}`);
xhr.setRequestHeader('xhr', 'xhr');
xhr.onload=function(){
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}"`);