Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Help with a userscript for a website (changing a link's destination).

  • No replies
  • 1 has this problem
  • 13 views
more options

Basically any link that I edit in Twitch only works (opens to my desired page) if I open it in a new tab. But if I left click the link, it will not open to my desired page. It will open to the original link.


I'm trying to change the Esports link on the top of the Twitch website to a Stream Manager link.


I created the following code:

waitForKeyElements ("[data-test-selector=top-nav__esports-link]", StreamManagerLink);

function StreamManagerLink (jNode) {jNode.attr("href", "https://dashboard.twitch.tv/u/*****YOURNAMEHERE****/stream-manager");}

And this code as well:

waitForKeyElements ("[data-test-selector=top-nav__esports-link] > div > div.tw-flex-column.tw-hide.tw-sm-flex > div.tw-hide.tw-xl-flex > p, [data-test-selector=top-nav__esports-link] > div > div.tw-flex-column.tw-hide.tw-sm-flex > div.tw-flex.tw-xl-hide > p", RenameEsports);

function RenameEsports (jNode) {jNode.html("Stream Manager");}


For the second part of the code - "RenameEsports" - I had to do both div.tw-hide.tw-xl-flex and div.tw-flex.tw-xl-hide, but it works perfectly and it renames the link. So I am not worried about that.


But for the first part of the code - "StreamMangerLink" - it both works and does not work. It works if I press CTRL while clinking the link. Because then it will open my Stream Manager page in a new tab. Also, works if I right click the link and open in new tab. But if I just left click it, it will open the Esports page in the same tab. I tried inspecting element and then searching entire website for all instances of "Esports" and deleting anything dealing with "Esports". But still, I can't get the Stream Manger page to open up in the same tab. I can only get it to open if I make the link open in a new tab.


Was wondering if someone can play around it and see if they can get it to work.

Basically any link that I edit in Twitch only works (opens to my desired page) if I open it in a new tab. But if I left click the link, it will not open to my desired page. It will open to the original link. I'm trying to change the Esports link on the top of the Twitch website to a Stream Manager link. I created the following code: waitForKeyElements ("[data-test-selector=top-nav__esports-link]", StreamManagerLink); function StreamManagerLink (jNode) {jNode.attr("href", "https://dashboard.twitch.tv/u/*****YOURNAMEHERE****/stream-manager");} And this code as well: waitForKeyElements ("[data-test-selector=top-nav__esports-link] > div > div.tw-flex-column.tw-hide.tw-sm-flex > div.tw-hide.tw-xl-flex > p, [data-test-selector=top-nav__esports-link] > div > div.tw-flex-column.tw-hide.tw-sm-flex > div.tw-flex.tw-xl-hide > p", RenameEsports); function RenameEsports (jNode) {jNode.html("Stream Manager");} For the second part of the code - "RenameEsports" - I had to do both div.tw-hide.tw-xl-flex and div.tw-flex.tw-xl-hide, but it works perfectly and it renames the link. So I am not worried about that. But for the first part of the code - "StreamMangerLink" - it both works and does not work. It works if I press CTRL while clinking the link. Because then it will open my Stream Manager page in a new tab. Also, works if I right click the link and open in new tab. But if I just left click it, it will open the Esports page in the same tab. I tried inspecting element and then searching entire website for all instances of "Esports" and deleting anything dealing with "Esports". But still, I can't get the Stream Manger page to open up in the same tab. I can only get it to open if I make the link open in a new tab. Was wondering if someone can play around it and see if they can get it to work.