NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @license GPL-2.0-only
// @name Refresh Neto
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Avoids timeout by refreshing the page every 10 minutes
// @author Nicholas Smith
// @include /^https?://www\.telcoantennas\.com\.au/_cpanel/.*$/
// @include /^https?://www\.telcoantennas\.com\.au/_cpanel
// @grant none
// ==/UserScript==
(function() {
'use strict';
function startTimer(duration) {
var timer = duration, minutes, seconds;
var cpanelURL = "https://www.telcoantennas.com.au/_cpanel";
// Count down from the timer value second by second
var end = setInterval(function () {
minutes = parseInt(timer / 60, 10)
seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
console.log("INFO: " + minutes.toString() + ":" + seconds.toString() + " until refresh. mm:ss");
if (--timer < 0) {
// Open the CPanel page
if (window.location.href == cpanelURL) {
console.log("INFO: Opening CPanel page.");
location.reload();
// Refresh the CPanel page
} else {
window.open(cpanelURL, "_blank");
console.log("INFO: Refreshing CPanel page because it was already open.");
}
clearInterval(end);
}
}, 1000);
}
window.onload = function () {
var tenMinutes = 600,
display = document.querySelector('#time');
startTimer(tenMinutes);
};
})();