"window." -> ""

pull/211/head
Aevann 2023-09-29 03:37:03 +03:00
parent 59ddfacd6e
commit 854693124a
15 changed files with 55 additions and 55 deletions

View File

@ -52,7 +52,7 @@ function Circle(x, y, v, range) {
bones_container.appendChild(this.element);
this.update = function() {
if (_this.y > window.innerHeight) {
if (_this.y > innerHeight) {
_this.y = 80 + Math.random() * 4;
_this.x = _this.range[0] + Math.random() * _this.range[1];
}

View File

@ -9,7 +9,7 @@ stylesheet_haunted.setAttribute("href", "/assets/events/homoween/css/haunted2.cs
stylesheet_haunted.disabled = true
document.head.appendChild(stylesheet_haunted)
window.onload = function(){
onload = function(){
thunder2.volume = 0.5
lightningStrike("normal")
}

View File

@ -1,6 +1,6 @@
let st = init("canvas"), // stranger things var
w = (canvas.width = innerWidth),
h = (canvas.height = window.innerHeight);
h = (canvas.height = 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 = window.innerHeight);
h = (canvas.height = innerHeight);
st.fillStyle = "rgba(30,30,30,1)";
st.fillRect(0, 0, w, h);
return st;
}
window.requestAnimFrame = function () {
requestAnimFrame = function () {
return (
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
requestAnimationFrame ||
webkitRequestAnimationFrame ||
mozRequestAnimationFrame ||
oRequestAnimationFrame ||
msRequestAnimationFrame ||
function (callback) {
window.setTimeout(callback);
setTimeout(callback);
}
);
};
function loop() {
window.requestAnimFrame(loop);
requestAnimFrame(loop);
st.clearRect(0, 0, w, h);
draw();
}
window.addEventListener("resize", function () {
addEventListener("resize", function () {
(w = canvas.width = innerWidth),
(h = canvas.height = window.innerHeight);
(h = canvas.height = innerHeight);
loop();
});

View File

@ -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 = window.confirm(text);
const confirmed = confirm(text);
if (confirmed) {
const xhr = new XMLHttpRequest();

View File

@ -6,7 +6,7 @@ for (const e of timestamps) {
e.innerHTML = formatDate(new Date(e.dataset.time*1000));
};
const ua = window.navigator.userAgent
const ua = 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 <= window.innerHeight)
const scrolled_down = (box.scrollHeight - box.scrollTop <= innerHeight)
if (last_user != json.user_id) {
document.getElementsByClassName('avatar-pic')[0].src = '/pp/' + json.user_id

View File

@ -24,7 +24,7 @@ function collapse_comment(id) {
if (closed && top < 0) {
element.scrollIntoView()
window.scrollBy(0, - 100)
scrollBy(0, - 100)
}
const reports = document.getElementById(`reports-${id}`)

View File

@ -139,12 +139,12 @@ if (!location.pathname.endsWith('/submit'))
function autoExpand(field) {
xpos = window.scrollX;
ypos = window.scrollY;
xpos = scrollX;
ypos = scrollY;
field.style.height = 'inherit';
let computed = window.getComputedStyle(field);
let computed = 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(window.scrollX - xpos) < 1 && Math.abs(window.scrollY - ypos) < 1) return;
window.scrollTo(xpos,ypos);
if (Math.abs(scrollX - xpos) < 1 && Math.abs(scrollY - ypos) < 1) return;
scrollTo(xpos,ypos);
};
function smoothScrollTop()
{
window.scrollTo({ top: 0, behavior: 'smooth' });
scrollTo({ top: 0, behavior: 'smooth' });
}
// Click navbar to scroll back to top
@ -373,7 +373,7 @@ function sort_table(t) {
}
}
const is_pwa = window.matchMedia('(display-mode: standalone)')['matches'] || window.matchMedia('(display-mode: minimal-ui)')['matches']
const is_pwa = matchMedia('(display-mode: standalone)')['matches'] || 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 = (window.innerWidth > 0) ? window.innerWidth : screen.width;
const screen_width = (innerWidth > 0) ? 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 (window.chrome !== undefined)
if (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)
{
window.alert("You can't upload more than 20 files at one time!")
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 = window.atob(base64);
const rawData = 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")
window.alert("Push notifications are enabled!")
alert("Push notifications are enabled!")
}).catch((e) => {
window.alert("Please give the site access to notifications!")
alert("Please give the site access to notifications!")
console.error(e)
})
}

View File

@ -104,10 +104,10 @@ function idle() {
if (cursormarseyPosY < 32) {
avalibleIdleAnimations.push("scratchWallN");
}
if (cursormarseyPosX > window.innerWidth - 32) {
if (cursormarseyPosX > innerWidth - 32) {
avalibleIdleAnimations.push("scratchWallE");
}
if (cursormarseyPosY > window.innerHeight - 32) {
if (cursormarseyPosY > 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), window.innerWidth - 16);
cursormarseyPosY = Math.min(Math.max(16, cursormarseyPosY), window.innerHeight - 16);
cursormarseyPosX = Math.min(Math.max(16, cursormarseyPosX), innerWidth - 16);
cursormarseyPosY = Math.min(Math.max(16, cursormarseyPosY), 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;
};
window.marseykoInterval = setInterval(frame, 100);
marseykoInterval = setInterval(frame, 100);
document.addEventListener('click', (event) => {
cursormarseyEl.style.removeProperty("pointer-events");

View File

@ -469,8 +469,8 @@ function update_speed_emoji_modal(event)
{
loadEmojis().then( () => {
let modal_pos = event.target.getBoundingClientRect();
modal_pos.x += window.scrollX;
modal_pos.y += window.scrollY;
modal_pos.x += scrollX;
modal_pos.y += scrollY;
speed_carot_modal.style.display = "initial";
speed_carot_modal.style.left = box_coords.x - 30 + "px";

View File

@ -45,7 +45,7 @@ function checkLotteryStats() {
// Admin
function ensureIntent() {
return window.confirm("Are you sure you want to end the current lottery?");
return confirm("Are you sure you want to end the current lottery?");
}
// Composed

View File

@ -133,10 +133,10 @@ function markdown(t) {
if (!reDisableBeforeUnload.test(location.pathname))
{
if (!window.onbeforeunload)
if (!onbeforeunload)
{
window.onbeforeunload = function (e) {
e = e || window.event;
onbeforeunload = function (e) {
e = e || event;
if (e) {
e.returnValue = 'Any string';
}
@ -144,7 +144,7 @@ function markdown(t) {
};
}
else if (!input) {
window.onbeforeunload = null
onbeforeunload = null
}
}
@ -273,5 +273,5 @@ function charLimit(form, text) {
}
function remove_dialog() {
window.onbeforeunload = null;
onbeforeunload = null;
}

View File

@ -1,6 +1,6 @@
let prevScrollpos = window.pageYOffset;
window.onscroll = function () {
const currentScrollPos = window.pageYOffset;
let prevScrollpos = pageYOffset;
onscroll = function () {
const currentScrollPos = pageYOffset;
const topBar = document.getElementById("fixed-bar-mobile");
@ -13,13 +13,13 @@ window.onscroll = function () {
const bottomSafeAreaInset = parseInt(getComputedStyle(bottomBar).getPropertyValue("--safe-area-inset-bottom")) || 0;
if (bottomBar != null) {
if (prevScrollpos > currentScrollPos && (window.innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
if (prevScrollpos > currentScrollPos && (innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
bottomBar.style.bottom = "0px";
}
else if (currentScrollPos <= 125 && (window.innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
else if (currentScrollPos <= 125 && (innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
bottomBar.style.bottom = "0px";
}
else if (prevScrollpos > currentScrollPos && (window.innerHeight + currentScrollPos) >= (document.body.offsetHeight - 65)) {
else if (prevScrollpos > currentScrollPos && (innerHeight + currentScrollPos) >= (document.body.offsetHeight - 65)) {
bottomBar.style.bottom = `-${50 + bottomSafeAreaInset}px`;
}
else {

View File

@ -1,5 +1,5 @@
if (!is_pwa) {
if (window.innerWidth <= 737) {
if (innerWidth <= 737) {
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
tt.show()
document.getElementsByClassName('tooltip')[0].addEventListener('click', function(e) {

View File

@ -1,4 +1,4 @@
const standalone = navigator.standalone || window.matchMedia("(display-mode: standalone)").matches;
const standalone = navigator.standalone || 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 (window.scrollY < threshold) {
if (scrollY < threshold) {
location.reload();
}
});
addEventListener("scroll", () => {
img.setAttribute("src", window.scrollY < threshold ? thresholdImg : defaultImg);
img.setAttribute("src", scrollY < threshold ? thresholdImg : defaultImg);
});
} else {
const pulltorefresh = document.getElementById("pulltorefresh")

View File

@ -223,7 +223,7 @@ function submit(form) {
//SAVE FILES
const indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
const indexedDB = indexedDB || mozIndexedDB || webkitIndexedDB || msIndexedDB || shimIndexedDB;
const open = indexedDB.open("files", 1);