Greasy Fork is available in English.
谷歌搜索引擎使用时点开链接会有一个跳转过程,这个脚本可以关闭这个跳转过程。
当前为
// ==UserScript==
// @name 谷歌链接直达
// @version 4.1.0.0
// @grant none
// @namespace happyZYM
// @description:zh-cn 谷歌搜索引擎使用时点开链接会有一个跳转过程,这个脚本可以关闭这个跳转过程。
// @match https://www.google.com/*
// @match https://www.google.com.hk/*
// @description 谷歌搜索引擎使用时点开链接会有一个跳转过程,这个脚本可以关闭这个跳转过程。
// ==/UserScript==
function clean()
{
var url = window.location.href.toLowerCase();
if (url.indexOf("www.google.com.hk") >= 0 || url.indexOf("www.google.com") >= 0 || url.indexOf("/search") >= 0 || url.indexOf("/url") >= 0)
{
var all = document.querySelectorAll("*");
for (var i = 0; i < all.length; i ++)
{
all[i].onmousedown = null;
all[i].setAttribute("onmousedown", " ");
}
var links = document.querySelectorAll('a[href^="/url"]');
for (i = 0; i < links.length; i++) {
url = links[i].getAttribute('href');
var match = /url=(.*?)&/.exec(url);
if (match) {
links[i].setAttribute('href', decodeURIComponent(match[1]));
}
}
}
// 获取id为"center_col"的div元素
const centerCol = document.getElementById('center_col');
// 获取所有超链接
links = centerCol.getElementsByTagName('a');
// 遍历超链接并移除不必要的属性
for (let i = 0; i < links.length; i++) {
const link = links[i];
// 移除不必要的属性
link.removeAttribute('jsname');
link.removeAttribute('data-jsarwt');
link.removeAttribute('data-usg');
link.removeAttribute('data-ved');
link.removeAttribute('onmousedown');
link.removeAttribute('rel');
}
}
setTimeout(clean,10);
setTimeout(clean,500);
setTimeout(clean,5000);
setTimeout(clean,15000);