// ==UserScript== // @name 获取网页链接地址 // @namespace https://github.com/zhchjiang95 // @version 1.0.2 // @description 获取网页中的所有超链接地址,自动生成 json 格式文件。无开启关闭按钮,网页加载自动获取链接。 // @author zhchjiang95 // @include http://* // @include https://* // @require https://code.jquery.com/jquery-3.4.0.min.js // @match http://* // @match https://* // @grant none // @downloadURL none // ==/UserScript== (function(){ var temp = [], aEle = $('a'); for(var i = 0; i < aEle.length; i ++){ var ele = { title: aEle.eq(i).text(), url: aEle.eq(i).attr('href') } temp.push(ele) } var txt = `` $('body').append(txt); $('#s-txt').dblclick(() => { confirm('是否关闭?') ? $('#s-txt').remove() : ''; }) }());