Greasy Fork is available in English.
自动将动漫花园的会员专用链接所指向的文件文件名改为标题名
当前为
// ==UserScript==
// @name dmhy-torrent-auto-rename
// @name:zh-CN 动漫花园种子自动重命名
// @description auto rename torrent for dmhy
// @description:zh-CN 自动将动漫花园的会员专用链接所指向的文件文件名改为标题名
// @license GPL version 3
// @encoding utf-8
// @match *://dmhy.org/topics/view/*
// @match *://www.dmhy.org/topics/view/*
// @match *://share.dmhy.org/topics/view/*
// @author 菜姬
// @version 0.2
// @namespace http://greasyfork.icu/users/171607
// @grant GM_xmlhttpRequest
// @connect dmhy.org
// ==/UserScript==
(function () {
let wholeblock = $("#tabs-1 p:first-child");
let urlblock = wholeblock.children("a");
let filename = urlblock.html() + ".torrent";
urlblock.click(function (e) {
e.preventDefault();
GM_xmlhttpRequest({
method: "get",
url: urlblock.attr('href'),
onload: function (r) {
let blob = new Blob([r.response]);
const anchor = document.createElement("a");
anchor.href = URL.createObjectURL(blob);
anchor.download = filename;
anchor.style["display"] = "none";
document.body.append(anchor);
anchor.click();
setTimeout(() => {
document.body.removeChild(anchor);
URL.revokeObjectURL(anchor.href);
}, 0);
}
});
});
})();