在 chrome 下快速查看完整的下载 url

Chrome 浏览器下面的下载很不好用,管理功能极少,连最基本的复制下载的 url 都不可以,以前我都是打开下载窗口,里面有 url 可以复制,但超过一定长度的 url 会变为短地址。以前我都是点到 url 然后审查元素,浏览 DOM 然后从里面复制 url ,但这样很不方便,每次操作都费时费力,就去 google ,结果发现有人写了一个脚本可以方便的做到我想要的效果,代码如下:

(function (window, document, Array) {
    // change all the text to <a> tags
    Array.prototype.slice.call(document.querySelectorAll('div.url')).forEach(function (el) {
        var a = document.createElement('a');
        a.innerHTML = a.href = el.innerHTML;
        a.target = '_blank';
        a.style.color = 'inherit';
        el.innerHTML = '';
        el.appendChild(a);
    });
}(this, this.document, this.Array));

可以将这个代码修改下然后保存到书签栏,以后只要打开下载窗口然后执行这个书签,就可以简单的在 url 上点出菜单,复制 url 了,下面提供可以放到书签的代码:

javascript:(function (window, document, Array) {Array.prototype.slice.call(document.querySelectorAll('div.url')).forEach(function (el) { var a = document.createElement('a'); a.innerHTML = a.href = el.innerHTML; a.target = '_blank'; a.style.color = 'inherit'; el.innerHTML = ''; el.appendChild(a); }); }(this, this.document, this.Array));

此代码原始出处来自:Makes ellipsified download URLs into actual links

About SXPCrazy

程序员一名,好 Web 后台编程,各种技术经验列表: HTML(11年) Javascript(1年) Java(7年) Scala(1年) CSS(.5年) Erlang(学习中) Python(学习中)
This entry was posted in 工具, 生活 and tagged , . Bookmark the permalink.

发表评论