Hi,

I would like to write a script that makes video links opened from the Youtube subscriptions page open in a new tab instead of the current, but I'm quite a noob at writing code.

Anyone able to give a helping hand please ?

Without writing it for you, here's a general approach to it:

  1. Identify all tags on the page
document.getElementsByTagName('a'));
  1. Loop through the collection of tags.
  2. Set the target attribute on each to force them to open in a new tab. A keyword of '_blank' will ensure a new tab each time the link is clicked. Or a unique identifier (such as the video's ID from the url) will ensure clicking the same link multiple times will only create / overwrite it's specified named tab.
  3. (Advanced): Everything above will only work for things on the page at the time the script runs and not on newly fetched content (such as clicking 'Load More' on a playlist). For that, you'll need to watch the parent container for newly added content ('Mutations') and call your function on that new content. One way is with the MutationObserver

Thanks for trying to help XFoxPrower,
unfortunately it looks like Youtube does something to disallow links from opening in a new tab.
I already had this script, which AFAIK should work for clicking thumbnails & video titles on the subscription page, I even saw the target='_blank' being added to the specific elements, but it somehow doesn't get picked up upon clicking any of them.

var Alink = document.getElementsByClassName('yt-uix-tile-link yt-ui-ellipsis yt-ui-ellipsis-2       spf-link ');
for (var i = Alink.length - 1; i > -1; i--)
 {
   Alink[i].setAttribute("target", "_blank");
 }