Last active
July 25, 2018 21:02
-
-
Save ivankolesnik/04eb418c8155a7780aa217b830abad52 to your computer and use it in GitHub Desktop.
Replace YouTube logo URL to subscriptions
This file contains hidden or 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
(function(window) { | |
function setDestination(event) { | |
var url; | |
var data; | |
var parent; | |
var target; | |
target = event.target; | |
if (!(data = target.data)) { | |
parent = target.parentNode; | |
while (parent) { | |
if (parent.data) { | |
target = parent; | |
data = target.data; | |
break; | |
} | |
parent = parent.parentNode; | |
} | |
} | |
if (data && (url = data.webNavigationEndpointData && data.webNavigationEndpointData.url)) { | |
if (url === "/" && event.target.tagName === "YT-ICON" && event.target.id === "logo-icon") { | |
data.browseEndpoint.browseId = "FEsubscriptions"; | |
data.webNavigationEndpointData.url += "feed/subscriptions"; | |
event.target.href = data.webNavigationEndpointData.url; | |
} | |
} | |
} | |
window.document.querySelectorAll('a#logo-container, a#logo').forEach(function(a) { | |
a.href = "/feed/subscriptions"; | |
}) | |
window.addEventListener("mouseup", setDestination, true); | |
console.log('replaced logo href') | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment