tracks.tra.in refresh

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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);