您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Ideal if you don't have Flash Player installed in your device. I know I don't.
当前为
- // ==UserScript==
- // @name Replace old Flash Player-based YouTube embeds by their new HTML5 counterparts
- // @description Ideal if you don't have Flash Player installed in your device. I know I don't.
- // @namespace greasyfork.org/users/4813-swyter
- // @include *
- // @version 2015.10.18
- // @noframes
- // @grant none
- // @run-at document-start
- // @icon https://i.imgur.com/L2y0zMj.png
- // ==/UserScript==
- /* wait until the page is ready for the code snipped to run */
- document.addEventListener('DOMContentLoaded', function()
- {
- /* iterate over all the existing SWF Youtube players in the page */
- for (var cur in (vids=document.querySelectorAll('object > embed[src*="youtube.com"]')))
- {
- console.log(vids[cur], typeof vids[cur]);
- /* create the HTML5 player element */
- iframe = document.createElement('iframe');
- iframe.src = 'https://www.youtube.com/embed/' + vids[cur].src.split('?')[0].split('/')[4];
- /* keep their same size */
- iframe.width = vids[cur].width;
- iframe.height = vids[cur].height;
- /* no borders plz, thanks! */
- iframe.setAttribute("frameborder", 0);
- /* replace the old SWF Flash object with it, voilà */
- vids[cur].parentNode.parentNode.replaceChild(iframe, vids[cur].parentNode);
- }
- }, false);