您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
转换编号为直达链接,并不知道站长知道了这东西会不会做出什么应对措施.
当前为
// ==UserScript== // @name dm1080直接跳转 // @namespace http://tampermonkey.net/ // @version 0.0.0.0.0.0.2 // @description 转换编号为直达链接,并不知道站长知道了这东西会不会做出什么应对措施. // @homepage http://greasyfork.icu/zh-CN/scripts/29313-dm1080%E7%9B%B4%E6%8E%A5%E8%B7%B3%E8%BD%AC // @author You // @match https://dm1080p.com/archives/* // @match https://52kbd.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(.,'资料编码:') or 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",'https://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(); } }