Skip to content

Instantly share code, notes, and snippets.

@thefloodshark
Created April 3, 2018 04:30
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thefloodshark/53e4497d6c8b1daefb24f5949ecae55e to your computer and use it in GitHub Desktop.
Save thefloodshark/53e4497d6c8b1daefb24f5949ecae55e 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();
}
@optionsx
Copy link

good shit

@Cattraighe
Copy link

Is this still working ?

If so, then: this only works with ONE tab, right ?
Can someone help me to make this work for multiple open tabs ?

I have like 100 tabs open and need to close those who have a certain word in it.
This script would be perfect, but i cant get it to run unfortunately...

Can someone help me ???? PLEASE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment