转换编号为直达链接,并不知道站长知道了这东西会不会做出什么应对措施.
当前为
// ==UserScript==
// @name dm1080直接跳转
// @namespace http://tampermonkey.net/
// @version 0.0.0.0.0.0.1
// @description 转换编号为直达链接,并不知道站长知道了这东西会不会做出什么应对措施.
// @homepage https://gf.qytechs.cn/zh-CN/scripts/29313-dm1080%E7%9B%B4%E6%8E%A5%E8%B7%B3%E8%BD%AC
// @author You
// @match dm1080p.com/archives/*
// @grant none
// ==/UserScript==
var urlRegex = /([0-9a-z]{7})(?=-)/ig;
var snapTextElements = document.evaluate("//text()[not(ancestor::a) " +
"and not(ancestor::script) and not(ancestor::style) and "+
"contains(.,'资料编号')]",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i <snapTextElements.snapshotLength; i++) {
var elmText = snapTextElements.snapshotItem(i);
if (urlRegex.test(elmText.nodeValue)) {
var elmSpan = document.createElement("span");
var sURLText = elmText.nodeValue;
elmText.parentNode.replaceChild(elmSpan, elmText);
urlRegex.lastIndex = 0;
for (var match = null, lastLastIndex = 0;
(match = urlRegex.exec(sURLText)); ) {
elmSpan.appendChild(document.createTextNode(
sURLText.substring(lastLastIndex, match.index)));
var elmLink = document.createElement("a");
elmLink.setAttribute("href",'http://zzzpan.com/?/file/view-'+match[0]+'.html');
elmLink.setAttribute("target", "_blank");
elmLink.appendChild(document.createTextNode(match[0]));
elmSpan.appendChild(elmLink);
lastLastIndex = urlRegex.lastIndex;
}
elmSpan.appendChild(document.createTextNode(
sURLText.substring(lastLastIndex)));
elmSpan.normalize();
}
}
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址