Let Me Multitask, Bro

A Tampermonkey script that allows picture-in-picture mode to be used for videos, even if the website has disabled it.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Let Me Multitask, Bro
// @author       Christopher Conley
// @copyright    Copyright (C) 2023 Christopher Conley
// @license      GPL-2.0-only
// @version      0.2.1
// @description  A Tampermonkey script that allows picture-in-picture mode to be used for videos, even if the website has disabled it.
// @namespace    https://github.com/rosettast0ned/let-me-multitask-bro
// @source       https://github.com/rosettast0ned/let-me-multitask-bro
// @supportURL   https://github.com/rosettast0ned/let-me-multitask-bro/issues
// @match        *://*/*
// @icon         https://raw.githubusercontent.com/rosettast0ned/let-me-multitask-bro/main/tampermonkey/let_me_multitask_bro.png
// @icon64       https://raw.githubusercontent.com/rosettast0ned/let-me-multitask-bro/main/tampermonkey/let_me_multitask_bro64.png
// @run-at       document-idle
// ==/UserScript==
//
// Picture in picture icon by Ria Fitriana from https://thenounproject.com/browse/icons/term/picture-in-picture/ Noun Project (CC BY 3.0)
//

(function () {
    console.log('LMMB: Let Me Multitask, Bro extension triggered.')

    var poller = setInterval(function () {
        if (document.querySelector('video') !== null) {
            clearInterval(poller);
            console.log("LMMB: Found video element.");

            var videos = document.querySelectorAll('video');

            videos.forEach(video => {
                if (video.hasAttribute('disablepictureinpicture')) {
                    console.log('LMMB: Removing disablepictureinpicture attribute from video element.');
                    video.removeAttribute('disablepictureinpicture');
                }
            });
        }
    }, 50);

})();