Last active
March 14, 2021 15:06
-
-
Save sn02/22f84ce0c8d2fd518266b1d4318099e6 to your computer and use it in GitHub Desktop.
UserScripts
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 HLScat.com - Unhide stream URLs | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Shows the URL of each result instead of the copy-button. | |
// @author sn0 | |
// @match https://hlscat.com/* | |
// @icon https://www.google.com/s2/favicons?domain=hlscat.com | |
// @updateURL https://gist.github.com/sn02/22f84ce0c8d2fd518266b1d4318099e6/raw/HLScat.com-streamURLs.user.js | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Iterate over all copy-buttons: | |
Array.from(document.getElementsByClassName("get_vlc")).forEach((element) => { | |
// Get URL from copy-button | |
let streamurl = element.getAttribute("data-clipboard-text").slice(0,-21); // slice removes the ad on the url | |
element.setAttribute("data-clipboard-text", streamurl); | |
// Create and insert a clickable link before copy-button: | |
let newNode = document.createElement("a"); | |
newNode.href = streamurl; | |
newNode.innerHTML = streamurl; | |
element.insertBefore(document.createTextNode("\u00A0"), element.firstChild); // Add a space between link and copy-button | |
element.insertBefore(newNode, element.firstChild); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment