真实链接替换

将页面中所有链接文本为网址,href却不一致的a标签替换的小工具

目前為 2020-02-20 提交的版本,檢視 最新版本

// ==UserScript==
// @name         真实链接替换
// @namespace    https://www.frank6.com/
// @version      0.3
// @description  将页面中所有链接文本为网址,href却不一致的a标签替换的小工具
// @author       Frank6
// @grant        none
// @include      http*
// ==/UserScript==
// @require      https://code.jquery.com/jquery-3.3.1.min.js
(function() {
    'use strict';
    $('a').each(function(index,item){
        var regex = /^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;
        if(regex.test(item.text)){
            item.href = item.text;
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址