Close Up to Date Script Pages

Auto closes the script page that you have already installed and that is already Up to Date. Auto Update and close the script page you have already installed and that ISN'T Up to Date. You have 3 secs to click anywhere to stop this script actions.

  1. // ==UserScript==
  2. // @name Close Up to Date Script Pages
  3. // @namespace ScriptUpdateHelper
  4. // @version 5
  5. // @description Auto closes the script page that you have already installed and that is already Up to Date. Auto Update and close the script page you have already installed and that ISN'T Up to Date. You have 3 secs to click anywhere to stop this script actions.
  6. // @author hacker09
  7. // @include /^https?:\/\/greasyfork\.org\/.*\/scripts/
  8. // @exclude /^https?:\/\/greasyfork\.org\/.*\/scripts\/.*\/(admin|stats|code|delete|derivatives|feedback|versions)/
  9. // @exclude https://greatest.deepsurf.us/en/scripts?q=*
  10. // @exclude https://greatest.deepsurf.us/en/scripts/by-site/*
  11. // @exclude https://greatest.deepsurf.us/en/scripts?language=*
  12. // @exclude https://greatest.deepsurf.us/*/scripts/*/versions/new
  13. // @icon https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://greatest.deepsurf.us/&size=64
  14. // @grant window.close
  15. // @run-at document-end
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20. var Close = setTimeout(function() { //Starts the settimeout function
  21. if (document.body.innerText.search("Update to version") > -1) //If the text "Update to version" is found on the script page
  22. { //Starts the if condition
  23. document.querySelector("a.install-link").click();
  24. window.top.close(); //Close the actual tab
  25. } //Finishes the if condition
  26. else { //Starts the if condition
  27. window.top.close(); //Close the actual tab
  28. } //Finishes the else condition
  29. }, 3000); //Run the script after 3 secs
  30.  
  31. document.body.insertAdjacentHTML('beforeend', '<div id="Close" style="width: 100vw; height: 100vh; z-index: 2147483647; background: rgb(0 0 0 / 86%); position: fixed; top: 0px; font-size: 40px; color: white;"><center>You\'ve 3 secs to click Anywhere if you don\'t want the page to auto update/close</center></div>'); //Show an option to the user
  32.  
  33. document.querySelector("#Close").onclick = function() { //If anywhere is clicked
  34. clearTimeout(Close); //Stop the auto Updating/Closing process
  35. document.querySelector("#Close").style.display = 'none'; //Hide the option
  36. } //Stop the Closing process if the user clicks anywhere
  37. })();