您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
3/8/2020, 10:42:28 PM
当前为
- // ==UserScript==
- // @name Allow full screen on embedded Youtube
- // @namespace mwisnicki@gmail.com
- // @match *://*/*
- // @grant none
- // @version 1.0
- // @author mwisnicki@gmail.com
- // @description 3/8/2020, 10:42:28 PM
- // ==/UserScript==
- function fixVideos() {
- const iframes = document.body.querySelectorAll('iframe[src^="https://www.youtube.com/embed/"]:not([allowfullscreen])')
- for (const iframe of iframes) {
- iframe.setAttribute("allowfullscreen","");
- // force reload
- // TODO maybe there's a way to refresh state without reload?
- const span = document.createElement("span");
- iframe.replaceWith(span);
- span.replaceWith(iframe);
- console.log("Forced Youtube allowfullscreen on %o", iframe);
- }
- }
- fixVideos();
- new MutationObserver(fixVideos).observe(document, { childList: true, subtree: true });