Feature request - links open in a new tab
Posted: Thu Jan 26, 2023 9:08 am
This is not a deal breaker, but it would be nice to have.
We talk languages
http://forum.language-learners.org/
http://forum.language-learners.org/viewtopic.php?f=16&t=18863
leosmith wrote:This is not a deal breaker, but it would be nice to have.
Odair wrote:Ctrl+click or pressing down on your mouse wheel will open any link on a new tab.
I've always just rt clicked.rdearman wrote:Odair wrote:Ctrl+click or pressing down on your mouse wheel will open any link on a new tab.
On Microsoft Windows and most web-browsers. (This is why I'm careful to caveat advice to people, since I don't know their operating system or web-browser. For all I know, Leosmith could be using Lynx inside a Linux terminal window, or using Emacs on a Mac.)
Code: Select all
// ==UserScript==
// @name Open links in a new tab
// @namespace https://forum.language-learners.org
// @version 0.1
// @match https://forum.language-learners.org/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=language-learners.org
// @grant none
// ==/UserScript==
(function() {
'use strict';
const whitelist = [
"posting.php",
"#top",
];
for (const link of document.querySelectorAll("a")) {
if (!whitelist.some(term => link.href.includes(term))) {
link.target = "_blank";
}
}
})();