forked from rDrama/rDrama
parent
8e47a31c97
commit
ab9172ed06
|
@ -52,7 +52,7 @@ function Circle(x, y, v, range) {
|
||||||
bones_container.appendChild(this.element);
|
bones_container.appendChild(this.element);
|
||||||
|
|
||||||
this.update = function() {
|
this.update = function() {
|
||||||
if (_this.y > innerHeight) {
|
if (_this.y > window.innerHeight) {
|
||||||
_this.y = 80 + Math.random() * 4;
|
_this.y = 80 + Math.random() * 4;
|
||||||
_this.x = _this.range[0] + Math.random() * _this.range[1];
|
_this.x = _this.range[0] + Math.random() * _this.range[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ stylesheet_haunted.setAttribute("href", "/assets/events/homoween/css/haunted2.cs
|
||||||
stylesheet_haunted.disabled = true
|
stylesheet_haunted.disabled = true
|
||||||
document.head.appendChild(stylesheet_haunted)
|
document.head.appendChild(stylesheet_haunted)
|
||||||
|
|
||||||
onload = function(){
|
window.onload = function(){
|
||||||
thunder2.volume = 0.5
|
thunder2.volume = 0.5
|
||||||
lightningStrike("normal")
|
lightningStrike("normal")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
let st = init("canvas"), // stranger things var
|
let st = init("canvas"), // stranger things var
|
||||||
w = (canvas.width = innerWidth),
|
w = (canvas.width = innerWidth),
|
||||||
h = (canvas.height = innerHeight);
|
h = (canvas.height = window.innerHeight);
|
||||||
|
|
||||||
class firefly {
|
class firefly {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -45,34 +45,34 @@ function init(elemid) {
|
||||||
let canvas = document.getElementById(elemid),
|
let canvas = document.getElementById(elemid),
|
||||||
st = canvas.getContext("2d"),
|
st = canvas.getContext("2d"),
|
||||||
w = (canvas.width = innerWidth),
|
w = (canvas.width = innerWidth),
|
||||||
h = (canvas.height = innerHeight);
|
h = (canvas.height = window.innerHeight);
|
||||||
st.fillStyle = "rgba(30,30,30,1)";
|
st.fillStyle = "rgba(30,30,30,1)";
|
||||||
st.fillRect(0, 0, w, h);
|
st.fillRect(0, 0, w, h);
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
requestAnimFrame = function () {
|
window.requestAnimFrame = function () {
|
||||||
return (
|
return (
|
||||||
requestAnimationFrame ||
|
window.requestAnimationFrame ||
|
||||||
webkitRequestAnimationFrame ||
|
window.webkitRequestAnimationFrame ||
|
||||||
mozRequestAnimationFrame ||
|
window.mozRequestAnimationFrame ||
|
||||||
oRequestAnimationFrame ||
|
window.oRequestAnimationFrame ||
|
||||||
msRequestAnimationFrame ||
|
window.msRequestAnimationFrame ||
|
||||||
function (callback) {
|
function (callback) {
|
||||||
setTimeout(callback);
|
window.setTimeout(callback);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function loop() {
|
function loop() {
|
||||||
requestAnimFrame(loop);
|
window.requestAnimFrame(loop);
|
||||||
st.clearRect(0, 0, w, h);
|
st.clearRect(0, 0, w, h);
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
addEventListener("resize", function () {
|
window.addEventListener("resize", function () {
|
||||||
(w = canvas.width = innerWidth),
|
(w = canvas.width = innerWidth),
|
||||||
(h = canvas.height = innerHeight);
|
(h = canvas.height = window.innerHeight);
|
||||||
loop();
|
loop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,7 @@ function placeChip(bet, which) {
|
||||||
HIGH_LOW_BET: `Bet ${amount} ${currency} that the number will be ${which === "HIGH" ? "higher than 18" : "lower than 19"}?\nYou could win ${amount} ${currency}.`,
|
HIGH_LOW_BET: `Bet ${amount} ${currency} that the number will be ${which === "HIGH" ? "higher than 18" : "lower than 19"}?\nYou could win ${amount} ${currency}.`,
|
||||||
}
|
}
|
||||||
const text = texts[bet] || "";
|
const text = texts[bet] || "";
|
||||||
const confirmed = confirm(text);
|
const confirmed = window.confirm(text);
|
||||||
|
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
|
|
|
@ -6,7 +6,7 @@ for (const e of timestamps) {
|
||||||
e.innerHTML = formatDate(new Date(e.dataset.time*1000));
|
e.innerHTML = formatDate(new Date(e.dataset.time*1000));
|
||||||
};
|
};
|
||||||
|
|
||||||
const ua = navigator.userAgent
|
const ua = window.navigator.userAgent
|
||||||
|
|
||||||
const socket = io()
|
const socket = io()
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ socket.on('speak', function(json) {
|
||||||
|
|
||||||
const users = document.getElementsByClassName('user_id');
|
const users = document.getElementsByClassName('user_id');
|
||||||
const last_user = users[users.length-1].value;
|
const last_user = users[users.length-1].value;
|
||||||
const scrolled_down = (box.scrollHeight - box.scrollTop <= innerHeight)
|
const scrolled_down = (box.scrollHeight - box.scrollTop <= window.innerHeight)
|
||||||
|
|
||||||
if (last_user != json.user_id) {
|
if (last_user != json.user_id) {
|
||||||
document.getElementsByClassName('avatar-pic')[0].src = '/pp/' + json.user_id
|
document.getElementsByClassName('avatar-pic')[0].src = '/pp/' + json.user_id
|
||||||
|
|
|
@ -24,7 +24,7 @@ function collapse_comment(id) {
|
||||||
|
|
||||||
if (closed && top < 0) {
|
if (closed && top < 0) {
|
||||||
element.scrollIntoView()
|
element.scrollIntoView()
|
||||||
scrollBy(0, - 100)
|
window.scrollBy(0, - 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
const reports = document.getElementById(`reports-${id}`)
|
const reports = document.getElementById(`reports-${id}`)
|
||||||
|
|
|
@ -139,12 +139,12 @@ if (!location.pathname.endsWith('/submit'))
|
||||||
|
|
||||||
|
|
||||||
function autoExpand(field) {
|
function autoExpand(field) {
|
||||||
xpos = scrollX;
|
xpos = window.scrollX;
|
||||||
ypos = scrollY;
|
ypos = window.scrollY;
|
||||||
|
|
||||||
field.style.height = 'inherit';
|
field.style.height = 'inherit';
|
||||||
|
|
||||||
let computed = getComputedStyle(field);
|
let computed = window.getComputedStyle(field);
|
||||||
|
|
||||||
let height = parseInt(computed.getPropertyValue('border-top-width'), 10)
|
let height = parseInt(computed.getPropertyValue('border-top-width'), 10)
|
||||||
+ parseInt(computed.getPropertyValue('padding-top'), 10)
|
+ parseInt(computed.getPropertyValue('padding-top'), 10)
|
||||||
|
@ -153,13 +153,13 @@ function autoExpand(field) {
|
||||||
+ parseInt(computed.getPropertyValue('border-bottom-width'), 10);
|
+ parseInt(computed.getPropertyValue('border-bottom-width'), 10);
|
||||||
|
|
||||||
field.style.height = height + 'px';
|
field.style.height = height + 'px';
|
||||||
if (Math.abs(scrollX - xpos) < 1 && Math.abs(scrollY - ypos) < 1) return;
|
if (Math.abs(window.scrollX - xpos) < 1 && Math.abs(window.scrollY - ypos) < 1) return;
|
||||||
scrollTo(xpos,ypos);
|
window.scrollTo(xpos,ypos);
|
||||||
};
|
};
|
||||||
|
|
||||||
function smoothScrollTop()
|
function smoothScrollTop()
|
||||||
{
|
{
|
||||||
scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click navbar to scroll back to top
|
// Click navbar to scroll back to top
|
||||||
|
@ -373,7 +373,7 @@ function sort_table(t) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const is_pwa = matchMedia('(display-mode: standalone)')['matches'] || matchMedia('(display-mode: minimal-ui)')['matches']
|
const is_pwa = window.matchMedia('(display-mode: standalone)')['matches'] || window.matchMedia('(display-mode: minimal-ui)')['matches']
|
||||||
if (is_pwa) {
|
if (is_pwa) {
|
||||||
const links = document.querySelectorAll('a[data-target="t"]');
|
const links = document.querySelectorAll('a[data-target="t"]');
|
||||||
for (const link of links) {
|
for (const link of links) {
|
||||||
|
@ -400,7 +400,7 @@ if (location.pathname != '/chat' && (gbrowser == 'iphone' || gbrowser == 'mac'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const screen_width = (innerWidth > 0) ? innerWidth : screen.width;
|
const screen_width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
|
||||||
function focusSearchBar(element)
|
function focusSearchBar(element)
|
||||||
{
|
{
|
||||||
if (screen_width >= 768) {
|
if (screen_width >= 768) {
|
||||||
|
@ -427,7 +427,7 @@ function insertText(input, text) {
|
||||||
const newPos = input.selectionStart + text.length;
|
const newPos = input.selectionStart + text.length;
|
||||||
input.setRangeText(text);
|
input.setRangeText(text);
|
||||||
|
|
||||||
if (chrome !== undefined)
|
if (window.chrome !== undefined)
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
input.focus();
|
input.focus();
|
||||||
for(let i = 0; i < 2; i++)
|
for(let i = 0; i < 2; i++)
|
||||||
|
@ -518,7 +518,7 @@ function handle_files(input, newfiles) {
|
||||||
|
|
||||||
if (input.files.length > 20)
|
if (input.files.length > 20)
|
||||||
{
|
{
|
||||||
alert("You can't upload more than 20 files at one time!")
|
window.alert("You can't upload more than 20 files at one time!")
|
||||||
input.value = null
|
input.value = null
|
||||||
oldfiles[ta.id] = new DataTransfer();
|
oldfiles[ta.id] = new DataTransfer();
|
||||||
return
|
return
|
||||||
|
@ -678,7 +678,7 @@ function urlB64ToUint8Array(base64String) {
|
||||||
.replace(/\-/g, '+')
|
.replace(/\-/g, '+')
|
||||||
.replace(/_/g, '/');
|
.replace(/_/g, '/');
|
||||||
|
|
||||||
const rawData = atob(base64);
|
const rawData = window.atob(base64);
|
||||||
const outputArray = new Uint8Array(rawData.length);
|
const outputArray = new Uint8Array(rawData.length);
|
||||||
|
|
||||||
for (let i = 0; i < rawData.length; ++i) {
|
for (let i = 0; i < rawData.length; ++i) {
|
||||||
|
@ -712,9 +712,9 @@ function enablePushNotifications() {
|
||||||
})
|
})
|
||||||
}).then((subscription) => {
|
}).then((subscription) => {
|
||||||
updateSubscriptionOnServer(subscription, "/push_subscribe")
|
updateSubscriptionOnServer(subscription, "/push_subscribe")
|
||||||
alert("Push notifications are enabled!")
|
window.alert("Push notifications are enabled!")
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
alert("Please give the site access to notifications!")
|
window.alert("Please give the site access to notifications!")
|
||||||
console.error(e)
|
console.error(e)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,10 +104,10 @@ function idle() {
|
||||||
if (cursormarseyPosY < 32) {
|
if (cursormarseyPosY < 32) {
|
||||||
avalibleIdleAnimations.push("scratchWallN");
|
avalibleIdleAnimations.push("scratchWallN");
|
||||||
}
|
}
|
||||||
if (cursormarseyPosX > innerWidth - 32) {
|
if (cursormarseyPosX > window.innerWidth - 32) {
|
||||||
avalibleIdleAnimations.push("scratchWallE");
|
avalibleIdleAnimations.push("scratchWallE");
|
||||||
}
|
}
|
||||||
if (cursormarseyPosY > innerHeight - 32) {
|
if (cursormarseyPosY > window.innerHeight - 32) {
|
||||||
avalibleIdleAnimations.push("scratchWallS");
|
avalibleIdleAnimations.push("scratchWallS");
|
||||||
}
|
}
|
||||||
idleAnimation =
|
idleAnimation =
|
||||||
|
@ -175,8 +175,8 @@ function frame() {
|
||||||
cursormarseyPosX -= (diffX / distance) * cursormarseySpeed;
|
cursormarseyPosX -= (diffX / distance) * cursormarseySpeed;
|
||||||
cursormarseyPosY -= (diffY / distance) * cursormarseySpeed;
|
cursormarseyPosY -= (diffY / distance) * cursormarseySpeed;
|
||||||
|
|
||||||
cursormarseyPosX = Math.min(Math.max(16, cursormarseyPosX), innerWidth - 16);
|
cursormarseyPosX = Math.min(Math.max(16, cursormarseyPosX), window.innerWidth - 16);
|
||||||
cursormarseyPosY = Math.min(Math.max(16, cursormarseyPosY), innerHeight - 16);
|
cursormarseyPosY = Math.min(Math.max(16, cursormarseyPosY), window.innerHeight - 16);
|
||||||
|
|
||||||
cursormarseyEl.style.left = `${cursormarseyPosX}px`;
|
cursormarseyEl.style.left = `${cursormarseyPosX}px`;
|
||||||
cursormarseyEl.style.top = `${cursormarseyPosY}px`;
|
cursormarseyEl.style.top = `${cursormarseyPosY}px`;
|
||||||
|
@ -188,7 +188,7 @@ document.onmousemove = (event) => {
|
||||||
mousePosX = event.clientX;
|
mousePosX = event.clientX;
|
||||||
mousePosY = event.clientY;
|
mousePosY = event.clientY;
|
||||||
};
|
};
|
||||||
marseykoInterval = setInterval(frame, 100);
|
window.marseykoInterval = setInterval(frame, 100);
|
||||||
|
|
||||||
document.addEventListener('click', (event) => {
|
document.addEventListener('click', (event) => {
|
||||||
cursormarseyEl.style.removeProperty("pointer-events");
|
cursormarseyEl.style.removeProperty("pointer-events");
|
||||||
|
|
|
@ -469,8 +469,8 @@ function update_speed_emoji_modal(event)
|
||||||
{
|
{
|
||||||
loadEmojis().then( () => {
|
loadEmojis().then( () => {
|
||||||
let modal_pos = event.target.getBoundingClientRect();
|
let modal_pos = event.target.getBoundingClientRect();
|
||||||
modal_pos.x += scrollX;
|
modal_pos.x += window.scrollX;
|
||||||
modal_pos.y += scrollY;
|
modal_pos.y += window.scrollY;
|
||||||
|
|
||||||
speed_carot_modal.style.display = "initial";
|
speed_carot_modal.style.display = "initial";
|
||||||
speed_carot_modal.style.left = box_coords.x - 30 + "px";
|
speed_carot_modal.style.left = box_coords.x - 30 + "px";
|
||||||
|
|
|
@ -45,7 +45,7 @@ function checkLotteryStats() {
|
||||||
|
|
||||||
// Admin
|
// Admin
|
||||||
function ensureIntent() {
|
function ensureIntent() {
|
||||||
return confirm("Are you sure you want to end the current lottery?");
|
return window.confirm("Are you sure you want to end the current lottery?");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Composed
|
// Composed
|
||||||
|
|
|
@ -133,10 +133,10 @@ function markdown(t) {
|
||||||
|
|
||||||
if (!reDisableBeforeUnload.test(location.pathname))
|
if (!reDisableBeforeUnload.test(location.pathname))
|
||||||
{
|
{
|
||||||
if (!onbeforeunload)
|
if (!window.onbeforeunload)
|
||||||
{
|
{
|
||||||
onbeforeunload = function (e) {
|
window.onbeforeunload = function (e) {
|
||||||
e = e || event;
|
e = e || window.event;
|
||||||
if (e) {
|
if (e) {
|
||||||
e.returnValue = 'Any string';
|
e.returnValue = 'Any string';
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ function markdown(t) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (!input) {
|
else if (!input) {
|
||||||
onbeforeunload = null
|
window.onbeforeunload = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,5 +273,5 @@ function charLimit(form, text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_dialog() {
|
function remove_dialog() {
|
||||||
onbeforeunload = null;
|
window.onbeforeunload = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
let prevScrollpos = pageYOffset;
|
let prevScrollpos = window.pageYOffset;
|
||||||
onscroll = function () {
|
window.onscroll = function () {
|
||||||
const currentScrollPos = pageYOffset;
|
const currentScrollPos = window.pageYOffset;
|
||||||
|
|
||||||
const topBar = document.getElementById("fixed-bar-mobile");
|
const topBar = document.getElementById("fixed-bar-mobile");
|
||||||
|
|
||||||
|
@ -13,13 +13,13 @@ onscroll = function () {
|
||||||
const bottomSafeAreaInset = parseInt(getComputedStyle(bottomBar).getPropertyValue("--safe-area-inset-bottom")) || 0;
|
const bottomSafeAreaInset = parseInt(getComputedStyle(bottomBar).getPropertyValue("--safe-area-inset-bottom")) || 0;
|
||||||
|
|
||||||
if (bottomBar != null) {
|
if (bottomBar != null) {
|
||||||
if (prevScrollpos > currentScrollPos && (innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
|
if (prevScrollpos > currentScrollPos && (window.innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
|
||||||
bottomBar.style.bottom = "0px";
|
bottomBar.style.bottom = "0px";
|
||||||
}
|
}
|
||||||
else if (currentScrollPos <= 125 && (innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
|
else if (currentScrollPos <= 125 && (window.innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
|
||||||
bottomBar.style.bottom = "0px";
|
bottomBar.style.bottom = "0px";
|
||||||
}
|
}
|
||||||
else if (prevScrollpos > currentScrollPos && (innerHeight + currentScrollPos) >= (document.body.offsetHeight - 65)) {
|
else if (prevScrollpos > currentScrollPos && (window.innerHeight + currentScrollPos) >= (document.body.offsetHeight - 65)) {
|
||||||
bottomBar.style.bottom = `-${50 + bottomSafeAreaInset}px`;
|
bottomBar.style.bottom = `-${50 + bottomSafeAreaInset}px`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
if (!is_pwa) {
|
if (!is_pwa) {
|
||||||
if (innerWidth <= 737) {
|
if (window.innerWidth <= 737) {
|
||||||
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
|
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
|
||||||
tt.show()
|
tt.show()
|
||||||
document.getElementsByClassName('tooltip')[0].addEventListener('click', function(e) {
|
document.getElementsByClassName('tooltip')[0].addEventListener('click', function(e) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const standalone = navigator.standalone || matchMedia("(display-mode: standalone)").matches;
|
const standalone = navigator.standalone || window.matchMedia("(display-mode: standalone)").matches;
|
||||||
if (standalone) {
|
if (standalone) {
|
||||||
const img = document.getElementById("pulltorefresh-img");
|
const img = document.getElementById("pulltorefresh-img");
|
||||||
const defaultImg = "/e/marseythinkorino.webp";
|
const defaultImg = "/e/marseythinkorino.webp";
|
||||||
|
@ -6,13 +6,13 @@ if (standalone) {
|
||||||
const threshold = -100;
|
const threshold = -100;
|
||||||
|
|
||||||
addEventListener("touchend", () => {
|
addEventListener("touchend", () => {
|
||||||
if (scrollY < threshold) {
|
if (window.scrollY < threshold) {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addEventListener("scroll", () => {
|
addEventListener("scroll", () => {
|
||||||
img.setAttribute("src", scrollY < threshold ? thresholdImg : defaultImg);
|
img.setAttribute("src", window.scrollY < threshold ? thresholdImg : defaultImg);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const pulltorefresh = document.getElementById("pulltorefresh")
|
const pulltorefresh = document.getElementById("pulltorefresh")
|
||||||
|
|
|
@ -223,7 +223,7 @@ function submit(form) {
|
||||||
|
|
||||||
//SAVE FILES
|
//SAVE FILES
|
||||||
|
|
||||||
const indexedDB = indexedDB || mozIndexedDB || webkitIndexedDB || msIndexedDB || shimIndexedDB;
|
const indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
|
||||||
|
|
||||||
const open = indexedDB.open("files", 1);
|
const open = indexedDB.open("files", 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue