reload scheduler

it does nothing but just schedule a page reload

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        reload scheduler
// @description it does nothing but just schedule a page reload
// @namespace   http://mfish.twbbs.org/
// @include     http://*
// @include     https://*
// @version     0.1.1
// @grant       GM_registerMenuCommand 
// ==/UserScript==

(function(){

var reload = function (min_timewait) {
  if (min_timewait > 0) {
    setTimeout(function(){
      location.reload();
    }, min_timewait * 1000 * 60)
  }
}


var onclick = function() {
  var reloadTime = window.prompt("Reload after x minute :", "0");
  var parsedNum = parseInt(reloadTime, 10);
  if (!isNaN(parsedNum) && parsedNum > 0) {
    alert('will reload after : ' + parsedNum + ' minutes');
    reload(parsedNum);
  } else {
    alert('not scheduled');
  }
}

GM_registerMenuCommand("schedule reload", onclick);
  
}())