javascript - How do I stop the function in TamperMonkey -


I have a script in TamperMonkey, which I want to run again. Should promptly prompt the user then stop filling the box. But it keeps asking ...

  function login () {s = prompt ('enter your username') document.getElementById ("Header_Login_tbUsername"). Value = s; S2 = Prompt ('Enter your password') document.getElementById ("Header_Login_tbPassword"). Value = s2; . Click on Document.getElementById ('Header_Login_btLogin') (); A = sign ('paste the link') window.location.replace (a); }  log in();  

You can add, examine, and delete later cookie functions in your script Cookies

Every time your script runs, check the cookies existence:

  function log () {var cookieValue = 'myLogin'; Var exists = read cookie (cookie value); // If the cookie is not set, create signals and cookies to log in if (! Exists) {create cookie (cookievalue, '', 1); // promptLogin (store for 1 day); }} Function prompt () {s = Prompt ('Enter your username'); Document.getElementById ("Header_Login_tbUsername"). Value = s; S2 = Prompt ('Enter your password'); Document.getElementById ("Header_Login_tbPassword"). Value = s2; . Click on Document.getElementById ('Header_Login_btLogin') (); A = Prompt ('Paste Link'); Window.location.replace (a); }  log in();  

Check out more deep discussion on the code below.

  Create a function (name, value, day) {var expires; If (day) {var date = new date (); Date.SsetTime (date.getTime (+) + Day * 86400000); Ends = "; expires =" + date.toGMTString (); } And {end; = ""; } Document.cookie = name + "=" + value + finished + "path = /"; } Read the function (name) {var nameEQ = name + "="; Var ca = document.cookie.split (';'); For (var i = 0; i & lt; ca.length; i ++) {var c = ca [i]; While (c.charAt (0) == '') {c = c.svstring (1, c.length); } If (c.indexOf (nameEQ) == 0) {return c.substring (nameEQ.length, c.length); }} Return tap; } Delete the cookie (name) {createCookie (name, "", -1); }  

Comments