yuanoook / Iframe allow everything

// ==UserScript==
// @namespace     https://openuserjs.org/users/yuanoook
// @name          Iframe allow everything
// @description   Iframe allow-scripts allow-forms allow-same-origin allow-pointer-lock allow-modals
// @copyright     2020, yuanoook (https://openuserjs.org/users/yuanoook)
// @license       MIT
// @version       1.0.0
// @include       *
// @run-at        document-start
// @grant none
// ==/UserScript==

// ==OpenUserJS==
// @author yuanoook
// ==/OpenUserJS==

function fixIframesForDocument (body) {
    console.log('fixFrames')

    const observer = new MutationObserver(() => {
        const iframes = Array.from(body.querySelectorAll('iframe'))
        iframes.forEach(iframe => {
            "allow-scripts allow-forms allow-same-origin allow-pointer-lock allow-modals".split(' ').forEach(x => {
                !iframe.sandbox.contains(x) && iframe.sandbox.add(x)
            })
        })
    });
    observer.observe(body, {
        childList: true,
        attributes: true,
        subtree: true
    });
}

(function() {
    fixIframesForDocument(document.body)
})();