Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var exposeUserInURL = function() {
- 'use strict';
- // To fix issue with user name, parse it from a different query, so
- // the following method works currently. Variable channelId will thus
- // contain the Youtube user name.
- // Replace lines from "var link = document.querySelector ..." to
- // "var channelId = ..." with the following code (within "// ---"):
- // ---
- var link = document.querySelector('[id="watch7-user-header"] a[href^="/user/"]');
- if ( link === null ) {
- return;
- }
- var linkHref = link.getAttribute('href');
- var linkmatch = linkHref.match(/\/user\/(.+)/);
- if (linkmatch === null)
- return;
- var channelId = linkmatch[1];
- // ---
- // Code below need not be changed
- var newArg = channelId !== '' ? 'user=' + encodeURIComponent(channelId) : '';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement