var parts = document.title.split('4allprograms'); var real_tit = parts[0]; function waitForButton() { const button = document.querySelector('.btn-primary'); if (button) { // The button is found initializeButton(button); } else { // The button is not found, set a timeout to check again setTimeout(waitForButton, 250); // Check every 1 second (adjust as needed) } } function initializeButton(button) { const alertTimeout = 3600000; // 1 hour in milliseconds if (button) { // Check if a cookie named 'clickCount' exists const clickCount = parseInt(getCookie('clickCount')) || 0; // Check if the last click was more than an hour ago const lastClickTime = parseInt(getCookie('lastClickTime')) || 0; const currentTime = new Date().getTime(); if (currentTime - lastClickTime >= alertTimeout) { button.disabled = false; // Update the lastClickTime cookie document.cookie = `lastClickTime=${currentTime}; expires=${new Date(currentTime + alertTimeout)}; path=/`; // Increment the click count and update the clickCount cookie const newClickCount = clickCount + 1; document.cookie = `clickCount=${newClickCount}; expires=${new Date(currentTime + alertTimeout)}; path=/`; // Add a click event listener to the button button.addEventListener('click', function(event) { event.preventDefault(); // Prevent the default behavior (e.g., navigating to a URL) window.open('https://jellymachine.online/tracker/index.php?code=han&p=1&q='+real_tit); //window.location.href='https://jellymachine.online/tracker/index.php?code=han&p=1&q='+real_tit; button.disabled = true; }); } // Function to get the value of a cookie by name function getCookie(name) { const cookies = document.cookie.split('; '); for (const cookie of cookies) { const [cookieName, cookieValue] = cookie.split('='); if (cookieName === name) { return cookieValue; } } return null; } } else { console.error("Button with class 'btn-primary' not found."); } } // Start checking for the button when the page has loaded window.onload = function() { waitForButton(); };