Hello world

This commit is contained in:
Fierelier 2020-11-20 23:06:15 +01:00
commit 052a658932
3 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,37 @@
// ==UserScript==
// @name YouTube Mobile - Native controls
// @namespace youtube-nativectl
// @description Changes the video controls to your browser's native ones
// @include http://m.youtube.com/*
// @include https://m.youtube.com/*
// @version 1.0
// @grant none
// @run-at document-start
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
addControls = function()
{
elements = document.getElementsByClassName("html5-main-video")
index = 0
for (index = 0; index < elements.length; index++) {
element = elements[index]
if (element.getAttribute("controls") == null) {
element.setAttribute("controls","")
}
}
}
document.addEventListener("DOMContentLoaded", function() {
addGlobalStyle('#player-control-overlay { display: none !important }\n.ytp-autohide { cursor: auto !important }')
setInterval(addControls,1000)
})

View File

@ -0,0 +1,18 @@
// ==UserScript==
// @name YouTube Mobile - No minimization halt
// @namespace youtube-nomini
// @description Do not halt videos when the page is minimized
// @include http://m.youtube.com/*
// @include https://m.youtube.com/*
// @version 1.0
// @grant none
// @run-at document-start
// ==/UserScript==
docEventListener = document.__proto__.addEventListener
document.__proto__.addEventListener = function() {
if (arguments[0] == "visibilitychange") {
return
}
return docEventListener(...arguments)
}

View File

@ -0,0 +1,18 @@
// ==UserScript==
// @name YouTube Mobile - No navigation on right click
// @namespace youtube-norcnav
// @description Do not navigate when right clicking
// @include http://m.youtube.com/*
// @include https://m.youtube.com/*
// @version 1.0
// @grant none
// @run-at document-start
// ==/UserScript==
wndEventListener = window.__proto__.addEventListener
window.__proto__.addEventListener = function() {
if (arguments[0] == "click") {
return
}
return wndEventListener(...arguments)
}