tracks.tra.in refresh

Refresh Tracks when you click on it after a period of inactivity

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name       tracks.tra.in refresh
// @namespace  http://ostermiller.org/
// @version    1.0
// @description  Refresh Tracks when you click on it after a period of inactivity
// @match      http://tracks.tra.in/*
// @copyright  2014, Stephen Ostermiller
// ==/UserScript==
var lastrefresh = new Date().getTime();
window.addEventListener("focus", function(event) { 
    // console.log("tracks has focus");
    var age = new Date().getTime() - lastrefresh;
    // console.log("Age: " + age);
    if (age > 1000 * 60 * 60 * 4) {
    	// more than four hours old
        // console.log("Refreshing Tracks");
        location.reload();
    }
}, false);