Skip to content

Commit

Permalink
New userscript: Allow playing videos in background (#1517 #1523)
Browse files Browse the repository at this point in the history
  • Loading branch information
uazo committed Oct 5, 2024
1 parent d4e0398 commit 8253009
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions build/userscripts/Allow-playing-videos-in-background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ==UserScript==
// @name Allow playing videos in background
// @version 1.0.0
// @description Allow playing youtube and vimeo videos in background in cromite. Original Javascript code by timdream and csagan5
// @author uazo
// @match https://*.youtube.com/*
// @match https://*.youtube-nocookie.com/*
// @match https://*.vimeo.com/*
// @grant none
// @run-at document-start
// ==/UserScript==

(function() {
'use strict';

window.addEventListener(
'visibilitychange', evt => evt.stopImmediatePropagation(), true);

// Fullscreen API
const IS_VIMEO = window.location.hostname.search(/(?:^|.+\\.)vimeo.com/) > -1;
if (IS_VIMEO) {
window.addEventListener(
'fullscreenchange', evt => evt.stopImmediatePropagation(), true);
}
})();

0 comments on commit 8253009

Please sign in to comment.