Kissanime Downloader with Jdownloader

Adds Download Button

当前为 2018-02-03 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Kissanime Downloader with Jdownloader
// @namespace    https://github.com/Meisterlala/Kissanime-Downloader
// @version      v2.0.0
// @description  Adds Download Button
// @author       Meisterlala
// @include      */kissanime.*/Anime/*
// @exclude      */kissanime.*/Anime/*/*
// @grant        GM_setClipboard
// @grant        GM_addStyle
// @noframes
// ==/UserScript==

// Adds the CSS for button formatting
var maincolor = window.getComputedStyle ( document.querySelector ( '.bigChar' ) ).color;
var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = "#myButton{z-index:222;cursor:pointer;position:relative;margin-right:15px;background-color:transparent;outline:0;border:none;\n" +
"display:inline-block;text-decoration:none;font:400 27px Tahoma,Arial,Helvetica,sans-serif;transition-duration:.4s;border-radius:4px;\n" +
"color:" + maincolor + "}#myButton:hover{color:#000;background-color:" + maincolor + "}#myButtonContainer{text-align:center}" ;
document.body.appendChild(css);
// Adds the button to the page
let container = document.createElement ( 'div' );
container.setAttribute ( 'id', 'myButtonContainer' );

let button = document.createElement ( 'button' );
button.setAttribute ( 'type', 'button' );
button.setAttribute ( 'id', 'myButton' );
button.innerHTML = 'Download with JDownloader';

let containerContainer = document.querySelector ( '.barContent > div:nth-child(2)' );

container.appendChild ( button );
containerContainer.appendChild ( container );

// Activate the added button
button.addEventListener ( 'click', function ( ) {
    GM_setClipboard ( Array.prototype.slice.call ( document.querySelectorAll ( '.episodeList a[href*=Episode]' ) )
                     .map ( elem => document.location.protocol + '//' + document.location.hostname + elem.getAttribute ( 'href' ) )
                     .reverse ( )
                     .join ( '\n' ) );
}, false );