您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
将网页中的网址文字都替换成链接
当前为
// ==UserScript== // @name 生成链接 // @namespace Violentmonkey Scripts // @match *://*/* // @grant none // @version 1.1.2 // @author amateur // @description 将网页中的网址文字都替换成链接 // ==/UserScript== // 网页加载完成后执行 window.onload = function () { let res = new Array(); // res[0] = new RegExp('https?://.*/(.*?\.(html|htm|php|jsp))?', 'g'); res[0] = new RegExp('https?://.*([/ ]|html|htm|php|jsp)', 'g'); // 根据选择器获取标签 body = document.querySelector('body'); for (const re of res) { let urls = body.innerText.match(re); for (const url of urls) { body.innerHTML = body.innerHTML.replace(url, `<a href=${url} target="_blank">${url}</a>`); } } }