您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add an interface to add custom buttons to embeded Vimeo players
// ==UserScript== // @name Vimeo Player Custom Buttons // @namespace http://PennyJim.com/ // @version 6 // @description Add an interface to add custom buttons to embeded Vimeo players // @author PennyJim // @match https://embed.vhx.tv/videos/* // @grant none // @license GNU GPLv3 // ==/UserScript== function addMessageHandler(handler) { if (window.onmessage === null) { window.onmessage = handler; } else { let oldHandler = window.onmessage window.onmessage = function(e) { oldHandler(e); handler(e); } } } //function addPlayerButton(name, callBack, width, icon, beforeWhat) { function addPlayerButton(data, origin) { let newBtn = document.createElement("button") newBtn.classList.add(data.name) newBtn.onclick = event => { window.top.postMessage({method: data.callBack}, origin) } newBtn.innerHTML = data.icon; newBtn.style.width = data.width; newBtn.style.height = "100%"; newBtn.style.marginLeft = "1em"; document.querySelector(".vp-controls > div").insertBefore(newBtn, document.querySelector(data.beforeWhat)); console.log(`${data.name} Button Added`); window.top.postMessage({method: "eventCall", event: "buttonAdded"}, origin); } (function() { 'use strict'; addMessageHandler(function(e) { let data = e.data if (data.method == "addPlayerButton") { addPlayerButton(data, e.origin); } }); })();