From 98c5a0a88e2bcbe6745221cab79a2e16eac47b20 Mon Sep 17 00:00:00 2001 From: KAKXER <89189991+KAKXER@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:25:59 +0330 Subject: [PATCH] Update static.js --- scripts/static.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/static.js b/scripts/static.js index b5c3c11..a4df707 100644 --- a/scripts/static.js +++ b/scripts/static.js @@ -19,6 +19,16 @@ function fetchData(url) { }); } +function checkWindowSize() { + if ($(window).height() > 446) { + $(".loading-page").css("opacity", 0); + $(".container").css("opacity", 1); + } else { + $(".loading-page").css("opacity", 1); + $(".container").css("opacity", 0); + } +} + let AppendData = 0 function RequestLoadPage() { fetchData('https://api.lanyard.rest/v1/users/543465365057961986').then(user => { @@ -61,6 +71,15 @@ function RequestLoadPage() { $(".container").css("opacity", 0); }, 250); }); + + $(window).on('offline', function () { + setTimeout(() => { + $(".loading-page").css("opacity", 1); + $(".container").css("opacity", 0); + }, 250); + }); + + window.onresize = checkWindowSize; } $(".loading-page").css("opacity", 0); @@ -72,5 +91,6 @@ function RequestLoadPage() { } $(document).ready(function() { - RequestLoadPage() + RequestLoadPage(); + });