您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a Button to YouTube
// ==UserScript== // @name youtube Extend Button // @version 0.1 // @description Adds a Button to YouTube // @author MarissaChan // @include http*://*.youtube.com/* // @include http*://youtube.com/* // @include http*://*.youtu.be/* // @include http*://youtu.be/* // @run-at document-end // @grant MIT // @namespace https://greasyfork.org/users/149000 // ==/UserScript== function addExtendButton(){ if (document.getElementById("watch8-secondary-actions") !== null && document.getElementById("watch8-secondary-actions").querySelector("#extendButton") === null){ var extendButton = document.createElement("button"); extendButton.setAttribute("id", "extendButton"); extendButton.classList.add("yt-uix-button", "yt-uix-button-size-default", "yt-uix-button-opacity", "yt-uix-tooltip"); var content = document.createElement("span"); content.classList.add("yt-uix-button-content"); content.innerHTML = "Extend"; extendButton.appendChild(content); document.getElementById("watch8-secondary-actions").insertBefore(extendButton, document.getElementById("watch8-secondary-actions").children[2]);var url = window.location.href; var videoid = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); if(videoid !== null) { console.log("video id = ",videoid[1]); extendButton.addEventListener('click', function() { document.location.href = "https://www.youtube.com/embed/" + videoid[1]; }, false); } } } setInterval(addExtendButton, 50);