Forces use of the Desktop version of YouTube
当前为
// ==UserScript==
// @name Force YouTube Desktop
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Forces use of the Desktop version of YouTube
// @author TheTank20
// @license Unlicense
// @match https://m.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @run-at document-start
// @grant none
// ==/UserScript==
(function() {
'use strict';
let isRunAlready = false;
let doShit = function() {
let URL = window.location.href;
if (isRunAlready === true) {
return;
}
isRunAlready = true;
URL = URL.replace("m.youtube.com", "www.youtube.com");
URL += (getURLParameterCount(URL) > 0) ? "&app=desktop" : "?app=desktop";
location.replace(URL);
};
function getURLParameterCount(urlString) {
const url = new URL(urlString);
return Array.from(url.searchParams.keys()).length;
}
doShit();
})();