我正在使用Firefox浏览json文件进行导航,我必须复制并粘贴文档中的链接。
是否有可能使这些链接超链接式可点击?
答案 0 :(得分:0)
使用以下GreaseMonkey脚本(也可以选择为您的域上的JSON路径触发它)。
// ==UserScript==
// @name JSON links
// @namespace http://example.com/json-links
// @description Clickable links in JSON
// @include http://localhost/*
// @version 1
// @grant none
// ==/UserScript==
setTimeout(function() {
Array.forEach(
document.querySelectorAll('.objectBox-string'),
function(span) {
var url = span.firstChild.nodeValue;
url = /^\s*"((?:http|https|ftp):\/\/.*)"\s*$/.exec(url);
if(!url) return;
url = url[1];
var a = document.createElement('a');
a.href = url;
a.appendChild(span.firstChild);
span.parentNode.replaceChild(a, span);
}
);
}, 300); // FF dev tools transform JSON into HTML dynamically therefore timeout
如果您还需要在本地文件上运行它,请参阅以下答案:
(虽然我不知道它是否适用于当前版本的Firefox)。