Last active
May 6, 2024 12:37
-
-
Save attie/6ee3fa3dea286452070ed6249de98d70 to your computer and use it in GitHub Desktop.
Make image links open in a new tab
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 Make image links open in a new tab | |
// @namespace http://attie.co.uk/ | |
// @source https://gist.github.com/attie/6ee3fa3dea286452070ed6249de98d70 | |
// @version 2024-05-06 | |
// @description Some links should just open in a new tab... | |
// @author Attie Grande <attie@attie.co.uk> | |
// @match https://*.stackexchange.com/* | |
// @match https://stackoverflow.com/* | |
// @match https://superuser.com/* | |
// @match https://serverfault.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=stackexchange.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.querySelectorAll('div.question a > img, div.answer a > img').forEach( | |
(el) => { el.parentNode.setAttribute('target','_blank') } | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment