Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fix inactive forward button for videos on youtube.com
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Jul 26, 2019
1 parent 1db1cd4 commit e8a0232
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/src/main/assets/web_extensions/webcompat_youtube/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ try {
}

const newUrl = getNewUrl(qs);
if (newUrl && window.location.pathname + window.location.search !== newUrl) {
if (newUrl && (window.location.pathname + window.location.search) !== newUrl) {
window.history.replaceState({}, document.title, newUrl);
return newUrl;
}
Expand Down Expand Up @@ -289,6 +289,16 @@ try {
window.ytplayer.config.args.jsapicallback = 'onYouTubePlayerReady';
}
});

window.addEventListener("beforeunload", function (e) {
// Make sure that the disable_polymer parameter is kept. Youtube processes the parameter but removes it from the URL.
// See https://github.com/MozillaReality/FirefoxReality/issues/1426
let qs = new URLSearchParams(window.location.search);
qs.set('disable_polymer', '1');
let url = getNewUrl(qs);
window.history.replaceState({}, document.title, url);
});

} catch (err) {
console.error(LOGTAG, 'Encountered error:', err);
}

0 comments on commit e8a0232

Please sign in to comment.