Last active
July 11, 2022 18:36
-
-
Save happiness801/0ab22d74fd627da14c8fca928a3f26e3 to your computer and use it in GitHub Desktop.
Clears all Link targets (to use same window)
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 clear-link-targets.user.js | |
// @namespace http://onai.net/ | |
// @version 0.3 | |
// @description Clears all link targets so they use the existing window | |
// @author Kevin Gwynn | |
// @match https://*.medium.com/* | |
// @match https://*.twitter.com/* | |
// @match https://*.pluralsight.com/* | |
// @match https://*.linkedin.com/* | |
// @match https://*.gartner.com/* | |
// @match https://*.miro.com/* | |
// @match https://*.oreilly.com/* | |
// @match https://*.excalidraw.com/* | |
// @exclude https://*.linkedin.com/tscp-serving/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let clearLinkTargets = function() { | |
console.log('KAG: clear-link-targets.user.js'); | |
let links = document.getElementsByTagName('a'); | |
for (let x = 0; x < links.length; x++) { | |
if (links[x].target != '') links[x].target = ''; | |
} | |
}; | |
setTimeout(clearLinkTargets, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment