Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Disable Polymer YouTube
- // @match *://*.youtube.com/*
- // @run-at document-start
- // @grant none
- // ==/UserScript==
- //Not the fastest, but please improve as you see fit.
- try {
- var url = document.location.toString();
- var updateUrl = updateQueryStringParameter(url, 'disable_polymer', 'true');
- console.log(updateUrl);
- console.log(url != updateUrl);
- if (url != updateUrl) {
- document.location = updateUrl;
- }
- } catch (e) {}
- function updateQueryStringParameter(uri, key, value) {
- var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
- var separator = uri.indexOf('?') !== -1 ? "&" : "?";
- if (uri.match(re)) {
- return uri.replace(re, '$1' + key + "=" + value + '$2');
- } else {
- return uri + separator + key + "=" + value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement