您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
给美剧天堂的 `复制下载地址` 按钮添加点击事件
// ==UserScript== // @name 美剧天堂复制下载地址 // @namespace http://tampermonkey.net/ // @version 0.3 // @description 给美剧天堂的 `复制下载地址` 按钮添加点击事件 // @author Chen // @match https://www.meijutt.com/content/* // @match https://www.meijutt.tv/content/* // @grant none // ==/UserScript== (function () { 'use strict'; const copyButtons = document.getElementsByClassName("copy"); Array.prototype.forEach.call(copyButtons, function (copyButton) { copyButton.onclick = function () { const currentDisplayTabList = Array.prototype.filter.call(document.getElementsByClassName("tabs-list"), function (element) { return element.style.display != "none"; }); try { const currentTab = currentDisplayTabList[0]; const lines = currentTab.getElementsByClassName("down_list")[0].getElementsByTagName("ul")[0].getElementsByTagName("li"); const downloadUrls = []; Array.prototype.forEach.call(lines, function (line) { const checkBox = line.getElementsByTagName("input")[0]; if (checkBox.checked) { downloadUrls.push(checkBox.value); } }) if (downloadUrls.length > 0) { const urlsInOne = downloadUrls.join("\r\n"); copyToClipboard(urlsInOne); } } catch (error) { console.log("出错了"); } } }); })(); function copyToClipboard(value) { const textarea = document.createElement('textarea'); textarea.readOnly = "true" textarea.value = value; document.body.appendChild(textarea); textarea.select(); if (document.execCommand('copy')) { alert('复制成功'); } else { alert("复制失败,请打开开发者工具手动复制!"); console.log(textarea.value); } document.body.removeChild(textarea); }