Skip to content

Instantly share code, notes, and snippets.

@thefloodshark
Created April 2, 2018 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thefloodshark/447d84a8584359f063bd0436b85eaad6 to your computer and use it in GitHub Desktop.
Save thefloodshark/447d84a8584359f063bd0436b85eaad6 to your computer and use it in GitHub Desktop.
Tampermonkey UserScript - Automatic Tab Closer Based on Designated URL Text
// ==UserScript==
// @name Autoclose URL
// @namespace Autoclose URL
// @include *
// @grant window.close
// ==/UserScript==
function check_if_should_close(url) {
if (url.match(/rnoreward/))
return true;
return false;
}
if (check_if_should_close(document.location.href)) {
var win = window.open('your current page URL', '_self', '');
window.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment