您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
inject yohoho iframe replace youtube iframe in tastedive site
// ==UserScript== // @name tastedive yohoho injector // @description inject yohoho iframe replace youtube iframe in tastedive site // @match https://tastedive.com/* // @grant GM_getResourceText // @license MIT // @version 0.3 // @namespace https://greasyfork.org/users/739921 // ==/UserScript== let search = true; let observer = new MutationObserver(mutationRecords => { if (search) { const ifr = document.querySelector('div > iframe[class^="JustWatchWidget"]'); if (ifr && !document.querySelector('div[id="yohoho"][data-title]')) { search = false; const script = document.createElement('script'); script.src = "https://yohoho.cc/yo.js"; document.body.appendChild(script); const title = document.querySelector(`meta[itemprop="name"][content]`).getAttribute("content"); const year = document.querySelector(`meta[itemprop="url"][content]`).getAttribute("content").split("-").slice(-1)[0]; const yohoho = document.createElement('div'); yohoho.id = "yohoho"; yohoho.setAttribute("data-title", `${title} (${year})`); ifr.parentNode.replaceChild(yohoho, ifr); console.log(`mounted: <div id="yohoho" data-title="${title} (${year})"></div>`); search = true; } } }); observer.observe(document, { childList: true, subtree: true, characterDataOldValue: true });