NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @author Dexmaster
// @grant GM_getValue
// @grant GM_setValue
// @include http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_form_submit
// @name Test Script Saver (GM_getValue/GM_setValue)
// @namespace TestScript
// @noframes
// @run-at document-end
// @version 0.2
// ==/UserScript==
(function () {
"use strict";
document.addEventListener("DOMContentLoaded", function() {
var el = document.querySelector('html body form input[name="LastName"]'), vals = GM_getValue("my_vals", []);
if (el !== undefined) { // If element exists
if (vals.indexOf(el.value) < 0) { // And was not added
vals.push(el.value); // ADD Value TO AN ARRAY
GM_setValue("my_vals", vals); // Save Array
}
}
setTimeout(function(){
window.location.reload();
/* or window.location = window.location.href; */
}, (int)( 1000 * 60 * ( 30 + ( Math.random() * 30 ) ) ) ); // (1sec * 60 * (30 + 0~30)) 30~60 minutes
console.log( GM_getValue( "my_vals" ) );
});
}());