Funimation AP Features

Search on AP and opening full size cover

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Funimation AP Features
// @namespace    https://greasyfork.org/en/users/689482-quin15
// @version      1.0.2
// @description  Search on AP and opening full size cover
// @author       Quin15
// @match        https://www.funimation.com/shows/*
// @icon         https://www.google.com/s2/favicons?domain=funimation.com
// @grant        none
// ==/UserScript==

var checkElems = function() {if ((document.querySelector('a[data-test="content-hero__watch-cta"]') || document.querySelector('button[data-test="content-hero__watch-cta"]')) && document.querySelector('div[role="img"] div[class^="v-image__image"]').style.backgroundImage) {setTimeout(addButtons, 200)} else {setTimeout(checkElems, 200);}};
checkElems();

var addButtons = function() {
    var searchAP = document.createElement('a');
    searchAP.setAttribute('data-v-06672a12', '')
    searchAP.className = 'px-5 v-btn v-btn--has-bg v-btn--router theme--dark v-size--large secondary';
    searchAP.style.minWidth = "212px";
    searchAP.innerHTML = `<img src="https://www.anime-planet.com/favicon.ico" style="float:left;height:40px;"><span class="v-btn__content"><div data-v-06672a12="" style="margin-left:10px;"> Search On AP </div></span>`;
    document.querySelector('div[class="v-card__actions order-1 order-md-5 px-0 pb-md-0"]').appendChild(searchAP);
    searchAP.addEventListener("click", function() {open(encodeURI("https://www.anime-planet.com/anime/all?name=" + document.querySelector('h1[data-test="content-hero__title"]').innerText), "")});

    var coverImg = document.createElement('a');
    coverImg.setAttribute('data-v-06672a12', '')
    coverImg.className = 'px-5 v-btn v-btn--has-bg v-btn--router theme--dark v-size--large secondary';
    coverImg.style.minWidth = "212px";
    coverImg.innerHTML = `<img src="` + document.querySelector('div[role="img"] div[class^="v-image__image"]').style.backgroundImage.replace(/.*url\(\"/, '').replace('")', '') + `" style="float:left;height:40px;"><span class="v-btn__content"><div data-v-06672a12="" style="margin-left:10px;"> Open Cover Image </div></span>`;
    document.querySelector('div[class="v-card__actions order-1 order-md-5 px-0 pb-md-0"]').appendChild(coverImg);
    coverImg.addEventListener("click", function() {open(document.querySelector('div[role="img"] div[class^="v-image__image"]').style.backgroundImage.replace(/.*url\(\"/, '').replace('")', '').replace(/upload\/.*\,c\_fill/, 'upload/c_fill'), "")});
}