-
-
Save liu246542/912fa0f220a159383fd1453519b89c7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name byr添加链接 | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Cao | |
// @include https://bt.byr.cn/details.php?* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const passkey = ''; // 把自己的秘钥粘贴到引号里面 | |
const srcObj = document.getElementsByClassName('index')[0]; | |
const trueLink = srcObj.href + '&passkey=' + passkey; | |
let downLink = document.createElement('tr'); | |
let downTile = document.createElement('td'); | |
let downTrue = document.createElement('td'); | |
downTile.className = 'rowhead'; | |
downTile.width = '13%'; | |
downTile.innerHTML = '下载链接'; | |
downTrue.className = 'rowfollow'; | |
downTrue.width = '87%'; | |
downTrue.align = 'left'; | |
let trueAli = document.createElement('a'); | |
trueAli.href = trueLink; | |
trueAli.innerHTML = '*'.repeat(24); | |
downTrue.appendChild(trueAli); | |
downTrue.innerHTML += ' [涉及个人信息,请勿泄露此链接] <button id="linkbtn">点击复制</button>'; | |
downLink.appendChild(downTile); | |
downLink.appendChild(downTrue); | |
let tbObj = document.getElementsByTagName('tbody')[5]; | |
tbObj.insertBefore(downLink,tbObj.childNodes[2]); | |
document.getElementById('linkbtn').onclick = ()=>{Copy(trueLink)}; | |
//downTrue.onclick = Copy(trueLink); | |
})(); | |
function Copy(str) { | |
let result = false; | |
let save = function(e) { | |
e.clipboardData.setData('text/plain', str); | |
e.preventDefault(); | |
} | |
document.addEventListener('copy', save); | |
result = document.execCommand('copy'); | |
document.removeEventListener('copy', save); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment