Greasy Fork

Greasy Fork is available in English.

美剧天堂 - 一键复制

在美剧天堂下载Tab中添加"复制全部下载地址"的按钮及其功能

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        美剧天堂 - 一键复制
// @description 在美剧天堂下载Tab中添加"复制全部下载地址"的按钮及其功能
// @namespace   http://tampermonkey.net/
// @match       https://www.meijutt.com/content/*
// @match       https://www.meijutt.tv/content/*
// @grant       none
// @version     1.1
// @author      SkayZhang
// @description 2020/8/23 上午12:00:00
// ==/UserScript==
(function () {
    'use strict';
    const tabItem = $(".tabs-list");
    tabItem.each(function () {
        const $this = $(this);
        $this.find(".copy").remove();
        $this.find(".thunder_down_all").before(`<a href="javascript:void(0);" class="down_btn">复制全部下载地址</a>`);
    });
})();

$(".down_btn").on("click", function () {
    const $this = $(this);
    const $list = $this.parent().parent().find(".down_list");
    if($list==undefined){
        alert("获取下载列表失败");
        return false;
    }
    if (confirm('确认复制全部下载地址?')) {
        let linkList ="";
        $list.find(".down_part_name a").each(function () {
            linkList += $(this).attr("href")+"\n";
        });
        copyText(linkList);
    }
})

function copyText(text){
    var tag = document.createElement('textarea');
    tag.setAttribute('id', 'mj_copy_input');
    tag.value = text;
    document.getElementsByTagName('body')[0].appendChild(tag);
    document.getElementById('mj_copy_input').select();
    document.execCommand('copy');
    document.getElementById('mj_copy_input').remove();
}