parent
8e47a31c97
commit
ab9172ed06
|
@ -52,7 +52,7 @@ function Circle(x, y, v, range) {
|
|||
bones_container.appendChild(this.element);
|
||||
|
||||
this.update = function() {
|
||||
if (_this.y > innerHeight) {
|
||||
if (_this.y > window.innerHeight) {
|
||||
_this.y = 80 + Math.random() * 4;
|
||||
_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
|
||||
document.head.appendChild(stylesheet_haunted)
|
||||
|
||||
onload = function(){
|
||||
window.onload = function(){
|
||||
thunder2.volume = 0.5
|
||||
lightningStrike("normal")
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
let st = init("canvas"), // stranger things var
|
||||
w = (canvas.width = innerWidth),
|
||||
h = (canvas.height = innerHeight);
|
||||
h = (canvas.height = window.innerHeight);
|
||||
|
||||
class firefly {
|
||||
constructor() {
|
||||
|
@ -45,34 +45,34 @@ function init(elemid) {
|
|||
let canvas = document.getElementById(elemid),
|
||||
st = canvas.getContext("2d"),
|
||||
w = (canvas.width = innerWidth),
|
||||
h = (canvas.height = innerHeight);
|
||||
h = (canvas.height = window.innerHeight);
|
||||
st.fillStyle = "rgba(30,30,30,1)";
|
||||
st.fillRect(0, 0, w, h);
|
||||
return st;
|
||||
}
|
||||
|
||||
requestAnimFrame = function () {
|
||||
window.requestAnimFrame = function () {
|
||||
return (
|
||||
requestAnimationFrame ||
|
||||
webkitRequestAnimationFrame ||
|
||||
mozRequestAnimationFrame ||
|
||||
oRequestAnimationFrame ||
|
||||
msRequestAnimationFrame ||
|
||||
window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.oRequestAnimationFrame ||
|
||||
window.msRequestAnimationFrame ||
|
||||
function (callback) {
|
||||
setTimeout(callback);
|
||||
window.setTimeout(callback);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
function loop() {
|
||||
requestAnimFrame(loop);
|
||||
window.requestAnimFrame(loop);
|
||||
st.clearRect(0, 0, w, h);
|
||||
draw();
|
||||
}
|
||||
|
||||
addEventListener("resize", function () {
|
||||
window.addEventListener("resize", function () {
|
||||
(w = canvas.width = innerWidth),
|
||||
(h = canvas.height = innerHeight);
|
||||
(h = canvas.height = window.innerHeight);
|
||||
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}.`,
|
||||
}
|
||||
const text = texts[bet] || "";
|
||||
const confirmed = confirm(text);
|
||||
const confirmed = window.confirm(text);
|
||||
|
||||
if (confirmed) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
|
|
@ -6,7 +6,7 @@ for (const e of timestamps) {
|
|||
e.innerHTML = formatDate(new Date(e.dataset.time*1000));
|
||||
};
|
||||
|
||||
const ua = navigator.userAgent
|
||||
const ua = window.navigator.userAgent
|
||||
|
||||
const socket = io()
|
||||
|
||||
|
@ -50,7 +50,7 @@ socket.on('speak', function(json) {
|
|||
|
||||
const users = document.getElementsByClassName('user_id');
|
||||
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) {
|
||||
document.getElementsByClassName('avatar-pic')[0].src = '/pp/' + json.user_id
|
||||
|
|
|
@ -24,7 +24,7 @@ function collapse_comment(id) {
|
|||
|
||||
if (closed && top < 0) {
|
||||
element.scrollIntoView()
|
||||
scrollBy(0, - 100)
|
||||
window.scrollBy(0, - 100)
|
||||
}
|
||||
|
||||
const reports = document.getElementById(`reports-${id}`)
|
||||
|
|
|
@ -139,12 +139,12 @@ if (!location.pathname.endsWith('/submit'))
|
|||
|
||||
|
||||
function autoExpand(field) {
|
||||
xpos = scrollX;
|
||||
ypos = scrollY;
|
||||
xpos = window.scrollX;
|
||||
ypos = window.scrollY;
|
||||
|
||||
field.style.height = 'inherit';
|
||||
|
||||
let computed = getComputedStyle(field);
|
||||
let computed = window.getComputedStyle(field);
|
||||
|
||||
let height = parseInt(computed.getPropertyValue('border-top-width'), 10)
|
||||
+ parseInt(computed.getPropertyValue('padding-top'), 10)
|
||||
|
@ -153,13 +153,13 @@ function autoExpand(field) {
|
|||
+ parseInt(computed.getPropertyValue('border-bottom-width'), 10);
|
||||
|
||||
field.style.height = height + 'px';
|
||||
if (Math.abs(scrollX - xpos) < 1 && Math.abs(scrollY - ypos) < 1) return;
|
||||
scrollTo(xpos,ypos);
|
||||
if (Math.abs(window.scrollX - xpos) < 1 && Math.abs(window.scrollY - ypos) < 1) return;
|
||||
window.scrollTo(xpos,ypos);
|
||||
};
|
||||
|
||||
function smoothScrollTop()
|
||||
{
|
||||
scrollTo({ top: 0, behavior: 'smooth' });
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
}
|
||||
|
||||
// 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) {
|
||||
const links = document.querySelectorAll('a[data-target="t"]');
|
||||
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)
|
||||
{
|
||||
if (screen_width >= 768) {
|
||||
|
@ -427,7 +427,7 @@ function insertText(input, text) {
|
|||
const newPos = input.selectionStart + text.length;
|
||||
input.setRangeText(text);
|
||||
|
||||
if (chrome !== undefined)
|
||||
if (window.chrome !== undefined)
|
||||
setTimeout(function(){
|
||||
input.focus();
|
||||
for(let i = 0; i < 2; i++)
|
||||
|
@ -518,7 +518,7 @@ function handle_files(input, newfiles) {
|
|||
|
||||
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
|
||||
oldfiles[ta.id] = new DataTransfer();
|
||||
return
|
||||
|
@ -678,7 +678,7 @@ function urlB64ToUint8Array(base64String) {
|
|||
.replace(/\-/g, '+')
|
||||
.replace(/_/g, '/');
|
||||
|
||||
const rawData = atob(base64);
|
||||
const rawData = window.atob(base64);
|
||||
const outputArray = new Uint8Array(rawData.length);
|
||||
|
||||
for (let i = 0; i < rawData.length; ++i) {
|
||||
|
@ -712,9 +712,9 @@ function enablePushNotifications() {
|
|||
})
|
||||
}).then((subscription) => {
|
||||
updateSubscriptionOnServer(subscription, "/push_subscribe")
|
||||
alert("Push notifications are enabled!")
|
||||
window.alert("Push notifications are enabled!")
|
||||
}).catch((e) => {
|
||||
alert("Please give the site access to notifications!")
|
||||
window.alert("Please give the site access to notifications!")
|
||||
console.error(e)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -104,10 +104,10 @@ function idle() {
|
|||
if (cursormarseyPosY < 32) {
|
||||
avalibleIdleAnimations.push("scratchWallN");
|
||||
}
|
||||
if (cursormarseyPosX > innerWidth - 32) {
|
||||
if (cursormarseyPosX > window.innerWidth - 32) {
|
||||
avalibleIdleAnimations.push("scratchWallE");
|
||||
}
|
||||
if (cursormarseyPosY > innerHeight - 32) {
|
||||
if (cursormarseyPosY > window.innerHeight - 32) {
|
||||
avalibleIdleAnimations.push("scratchWallS");
|
||||
}
|
||||
idleAnimation =
|
||||
|
@ -175,8 +175,8 @@ function frame() {
|
|||
cursormarseyPosX -= (diffX / distance) * cursormarseySpeed;
|
||||
cursormarseyPosY -= (diffY / distance) * cursormarseySpeed;
|
||||
|
||||
cursormarseyPosX = Math.min(Math.max(16, cursormarseyPosX), innerWidth - 16);
|
||||
cursormarseyPosY = Math.min(Math.max(16, cursormarseyPosY), innerHeight - 16);
|
||||
cursormarseyPosX = Math.min(Math.max(16, cursormarseyPosX), window.innerWidth - 16);
|
||||
cursormarseyPosY = Math.min(Math.max(16, cursormarseyPosY), window.innerHeight - 16);
|
||||
|
||||
cursormarseyEl.style.left = `${cursormarseyPosX}px`;
|
||||
cursormarseyEl.style.top = `${cursormarseyPosY}px`;
|
||||
|
@ -188,7 +188,7 @@ document.onmousemove = (event) => {
|
|||
mousePosX = event.clientX;
|
||||
mousePosY = event.clientY;
|
||||
};
|
||||
marseykoInterval = setInterval(frame, 100);
|
||||
window.marseykoInterval = setInterval(frame, 100);
|
||||
|
||||
document.addEventListener('click', (event) => {
|
||||
cursormarseyEl.style.removeProperty("pointer-events");
|
||||
|
|
|
@ -469,8 +469,8 @@ function update_speed_emoji_modal(event)
|
|||
{
|
||||
loadEmojis().then( () => {
|
||||
let modal_pos = event.target.getBoundingClientRect();
|
||||
modal_pos.x += scrollX;
|
||||
modal_pos.y += scrollY;
|
||||
modal_pos.x += window.scrollX;
|
||||
modal_pos.y += window.scrollY;
|
||||
|
||||
speed_carot_modal.style.display = "initial";
|
||||
speed_carot_modal.style.left = box_coords.x - 30 + "px";
|
||||
|
|
|
@ -45,7 +45,7 @@ function checkLotteryStats() {
|
|||
|
||||
// Admin
|
||||
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
|
||||
|
|
|
@ -133,10 +133,10 @@ function markdown(t) {
|
|||
|
||||
if (!reDisableBeforeUnload.test(location.pathname))
|
||||
{
|
||||
if (!onbeforeunload)
|
||||
if (!window.onbeforeunload)
|
||||
{
|
||||
onbeforeunload = function (e) {
|
||||
e = e || event;
|
||||
window.onbeforeunload = function (e) {
|
||||
e = e || window.event;
|
||||
if (e) {
|
||||
e.returnValue = 'Any string';
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ function markdown(t) {
|
|||
};
|
||||
}
|
||||
else if (!input) {
|
||||
onbeforeunload = null
|
||||
window.onbeforeunload = null
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,5 +273,5 @@ function charLimit(form, text) {
|
|||
}
|
||||
|
||||
function remove_dialog() {
|
||||
onbeforeunload = null;
|
||||
window.onbeforeunload = null;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
let prevScrollpos = pageYOffset;
|
||||
onscroll = function () {
|
||||
const currentScrollPos = pageYOffset;
|
||||
let prevScrollpos = window.pageYOffset;
|
||||
window.onscroll = function () {
|
||||
const currentScrollPos = window.pageYOffset;
|
||||
|
||||
const topBar = document.getElementById("fixed-bar-mobile");
|
||||
|
||||
|
@ -13,13 +13,13 @@ onscroll = function () {
|
|||
const bottomSafeAreaInset = parseInt(getComputedStyle(bottomBar).getPropertyValue("--safe-area-inset-bottom")) || 0;
|
||||
|
||||
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";
|
||||
}
|
||||
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";
|
||||
}
|
||||
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`;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
if (!is_pwa) {
|
||||
if (innerWidth <= 737) {
|
||||
if (window.innerWidth <= 737) {
|
||||
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
|
||||
tt.show()
|
||||
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) {
|
||||
const img = document.getElementById("pulltorefresh-img");
|
||||
const defaultImg = "/e/marseythinkorino.webp";
|
||||
|
@ -6,13 +6,13 @@ if (standalone) {
|
|||
const threshold = -100;
|
||||
|
||||
addEventListener("touchend", () => {
|
||||
if (scrollY < threshold) {
|
||||
if (window.scrollY < threshold) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
addEventListener("scroll", () => {
|
||||
img.setAttribute("src", scrollY < threshold ? thresholdImg : defaultImg);
|
||||
img.setAttribute("src", window.scrollY < threshold ? thresholdImg : defaultImg);
|
||||
});
|
||||
} else {
|
||||
const pulltorefresh = document.getElementById("pulltorefresh")
|
||||
|
|
|
@ -223,7 +223,7 @@ function submit(form) {
|
|||
|
||||
//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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue