Last active
April 4, 2023 18:37
-
-
Save irazasyed/0d7f43f752ae4cfd160a11ced0d9a618 to your computer and use it in GitHub Desktop.
User-Script: YouTube Dark & Wide Mode.
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
// ==UserScript== | |
// @name Dark Wide YouTube | |
// @namespace DWYT | |
// @version 1.0 | |
// @description Dark Wide YouTube | |
// @author Syed I.R. | |
// @match https://*.youtube.com/* | |
// @require https://raw.githubusercontent.com/madmurphy/cookies.js/master/cookies_min.js | |
// @grant none | |
// @noframes | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const FUTURE = new Date('2020'); | |
// Dark Mode On | |
let pref = docCookies.getItem('PREF'); | |
if(pref) { | |
let cookieChanged = false; | |
if(pref.indexOf('f6') === -1) { | |
pref = pref + '&f6=400'; | |
cookieChanged = true; | |
} else if(pref.indexOf('f6=400') === -1) { | |
pref = pref.replace(/(f6=)[^\&]+/, '$1400'); | |
cookieChanged = true; | |
} | |
if(cookieChanged) { | |
docCookies.removeItem('PREF'); | |
docCookies.setItem('PREF', pref, FUTURE, '/', '.youtube.com'); | |
} | |
} | |
// Wide Angle | |
let wide = docCookies.getItem('wide'); | |
if(!wide) { | |
docCookies.setItem('wide', 1, FUTURE, '/', '.youtube.com'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment