Greasy Fork is available in English.
磁力链接加磁力头 添加按钮
// ==UserScript==
// @name 给miobt特征码前面加上磁力头
// @namespace DBeidachazi
// @version 0.1
// @description 磁力链接加磁力头 添加按钮
// @author DBeidachazi
// @match http://miobt.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=miobt.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
let x = document.getElementById('text_hash_id');
let xInnerHtml = x.innerHTML;
// ',特征码:a1767f680726a3b6faab26dcf755244b9991bf8b'
let aa = xInnerHtml.split(':');
x.innerHTML = aa[0] + ': magnet:?xt=urn:btih:' + aa[1];
let magneticString = aa[1];
let btn=document.createElement("button");
let t=document.createTextNode("点我复制磁链");
btn.appendChild(t);
document.body.appendChild(btn);
btn.style.position = "fixed";
btn.style.backgroundColor = "pink";
btn.style.border = "2px dotted black";
btn.style.top = "70px";
btn.style.width = "120px";
btn.style.height = "40px";
btn.onmouseover = function (){
btn.style.backgroundColor = "yellow";
}
btn.onmouseout = function (){
btn.style.backgroundColor = "pink";
}
btn.onclick = function
(){
const input = document.createElement("input"); // 直接构建input
input.value = "magnet:?xt=urn:btih:"+magneticString; // 设置内容
document.body.appendChild(input); // 添加临时实例
input.select(); // 选择实例内容
document.execCommand("Copy"); // 执行复制
document.body.removeChild(input); // 删除临时实例
alert("复制成功")
}
})();