mirror of
https://github.com/xodivorce/xeorl.git
synced 2025-12-20 00:29:34 +05:30
v4.2.0
This commit is contained in:
28
htdocs/assets/js/_header.js
Normal file
28
htdocs/assets/js/_header.js
Normal file
@@ -0,0 +1,28 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const burgerToggle = document.getElementById("burger-toggle");
|
||||
const sidebar = document.querySelector(".sidebar");
|
||||
|
||||
// Ensure sidebar is hidden initially
|
||||
sidebar.style.display = "none";
|
||||
|
||||
burgerToggle.addEventListener("click", function () {
|
||||
if (sidebar.style.display === "none" || sidebar.style.display === "") {
|
||||
sidebar.style.display = "flex";
|
||||
sidebar.classList.add("active");
|
||||
} else {
|
||||
sidebar.style.display = "none";
|
||||
sidebar.classList.remove("active");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
window.addEventListener('scroll', function () {
|
||||
const header = document.querySelector('.header'); // Get the header element
|
||||
|
||||
// Check if the page has been scrolled
|
||||
if (window.scrollY > 0) {
|
||||
header.classList.add('scrolled'); // Add the "scrolled" class
|
||||
} else {
|
||||
header.classList.remove('scrolled'); // Remove the "scrolled" class
|
||||
}
|
||||
});
|
||||
@@ -1,14 +1,3 @@
|
||||
window.addEventListener('scroll', function () {
|
||||
const header = document.querySelector('.header'); // Get the header element
|
||||
|
||||
// Check if the page has been scrolled
|
||||
if (window.scrollY > 0) {
|
||||
header.classList.add('scrolled'); // Add the "scrolled" class
|
||||
} else {
|
||||
header.classList.remove('scrolled'); // Remove the "scrolled" class
|
||||
}
|
||||
});
|
||||
|
||||
const form = document.querySelector(".shorten-form"),
|
||||
urlInput = document.querySelector("#url-input"),
|
||||
shortenBtn = document.querySelector("#shorten-btn"),
|
||||
@@ -47,7 +36,7 @@ shortenBtn.onclick = () => {
|
||||
let data = xhr.response;
|
||||
if (data.length <= 5) {
|
||||
//This is your domain name
|
||||
const domain = "xeorl.buzz/";
|
||||
const domain = "http://localhost/Php-Projects/xeorl/htdocs/";
|
||||
let shortenURL = domain + data;
|
||||
|
||||
// Remove the default message if it exists
|
||||
|
||||
62
htdocs/assets/js/_unzipper.js
Normal file
62
htdocs/assets/js/_unzipper.js
Normal file
@@ -0,0 +1,62 @@
|
||||
// Countdown logic
|
||||
let countdown = 10;
|
||||
let countdownInterval;
|
||||
const timerElement = document.getElementById("timer");
|
||||
const button = document.getElementById("getLinkBtn");
|
||||
|
||||
function updateCountdown() {
|
||||
if (countdown > 0) {
|
||||
countdown--;
|
||||
timerElement.textContent = countdown;
|
||||
}
|
||||
if (countdown <= 0) {
|
||||
button.disabled = false; // Enable the button when countdown ends
|
||||
button.classList.add("active"); // Optional, if you use active class for style
|
||||
button.style.cursor = "pointer"; // Enable cursor
|
||||
setTimeout(function () {
|
||||
button.textContent = "Getting links..."; // Change text before enabling
|
||||
}, 300); // 0.3 seconds delay
|
||||
setTimeout(function () {
|
||||
button.textContent = "Get link"; // Final button text
|
||||
}, 600); // After another 0.3 seconds
|
||||
clearInterval(countdownInterval);
|
||||
}
|
||||
}
|
||||
|
||||
function startCountdown() {
|
||||
countdownInterval = setInterval(updateCountdown, 1000);
|
||||
}
|
||||
|
||||
function stopCountdown() {
|
||||
clearInterval(countdownInterval);
|
||||
}
|
||||
|
||||
function init() {
|
||||
// Initialize countdown value and button state
|
||||
countdown = 10;
|
||||
timerElement.textContent = countdown;
|
||||
button.disabled = true;
|
||||
button.classList.remove("active");
|
||||
button.style.cursor = "not-allowed";
|
||||
button.textContent = "PLEASE WAIT...";
|
||||
|
||||
startCountdown();
|
||||
}
|
||||
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
if (document.hidden) {
|
||||
stopCountdown();
|
||||
} else {
|
||||
startCountdown();
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("beforeunload", () => {
|
||||
init(); // Reset state when the page is about to be unloaded
|
||||
});
|
||||
|
||||
init(); // Call init to initialize the countdown when the page loads
|
||||
|
||||
function redirect() {
|
||||
window.location.href = redirectUrl; // Redirect to the full URL
|
||||
}
|
||||
Reference in New Issue
Block a user