-
-
Save neoOpus/289db98775b1657719515c80b064f0d1 to your computer and use it in GitHub Desktop.
Tampermonkey Userscript - Automatically Close Tab Based on Page Text
This file contains hidden or 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 Autoclose Tab | |
// @namespace Autoclose Tab | |
// @include * | |
// ==/UserScript== | |
// separate words or phrases with a comma | |
var blacklist = ["cactus", "finances", "put other text here"], | |
re = new RegExp(blacklist.join('|'), "i"); | |
if (re.test(document.body.textContent)) { | |
var win = window.open("","_self"); | |
win.close(); | |
} |
Ah, It is just as reminder for a snippet, I forgot why I was looking for this but as soon as I can remember I will get back to you and maybe do some changes.
Thanks :)
That is brilliant, thank you but unfortunately it doesn't seem to work, any hint?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
so, what's the fork here? I can't see any difference? Greetings.