Created
February 23, 2022 06:15
-
-
Save peterwzhang/9b3e07c2c355c3402615d13177d8d217 to your computer and use it in GitHub Desktop.
Periodically check for a given text on a site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Checker | |
// @version 1 | |
// @description Check all text on a site for a keyword. | |
// @author Peter Zhang | |
// @match !!!!!Put what site you want to check on!!!!! | |
// @grant none | |
// ==/UserScript== | |
const SEARCH_TEXT = "PUT TEXT HERE"; | |
// create a function called reload that reloads the page | |
function reload() { | |
if (document.getElementsByClassName("changeme") == SEARCH_TEXT) { // change this to whatever class will have your text | |
window.alert("You found the text!") | |
window.focus() | |
} | |
else{ | |
location.reload(); | |
} | |
} | |
function setup() { | |
// check after 30 seconds | |
setTimeout(reload, 30000); | |
} | |
window.addEventListener("load", setup, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment