Keyword Refresher

refresh page based on keyword

目前为 2024-01-07 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Keyword Refresher
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description refresh page based on keyword
  6. // @author san07
  7. // @include *
  8. // @match http://*/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=whatsapp.com
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Define the keyword or sentence to trigger the refresh
  17. const keyword = "Clicking";
  18.  
  19. // Function to check if the keyword is present in the page
  20. function checkForKeyword() {
  21. const pageContent = document.body.textContent || document.body.innerText;
  22. return pageContent.includes(keyword);
  23. }
  24.  
  25. // Function to refresh the page
  26. function refreshPage() {
  27. location.reload();
  28. }
  29.  
  30. // Check for the keyword periodically and refresh the page if found
  31. setInterval(function() {
  32. if (checkForKeyword()) {
  33. refreshPage();
  34. }
  35.  
  36. }, 3000); // Adjust the interval (in milliseconds) as needed
  37. })();