Skip to content

Instantly share code, notes, and snippets.

@neoOpus
Forked from thefloodshark/.js
Last active September 22, 2024 15:02
Show Gist options
  • Save neoOpus/289db98775b1657719515c80b064f0d1 to your computer and use it in GitHub Desktop.
Save neoOpus/289db98775b1657719515c80b064f0d1 to your computer and use it in GitHub Desktop.
Tampermonkey Userscript - Automatically Close Tab Based on Page Text
// ==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();
}
@dlepold
Copy link

dlepold commented Mar 9, 2022

so, what's the fork here? I can't see any difference? Greetings.

@neoOpus
Copy link
Author

neoOpus commented Mar 9, 2022

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 :)

@worldor
Copy link

worldor commented Apr 30, 2024

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