您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Keeps you in Google cache when you click links on cached pages.
当前为
- // ==UserScript==
- // @name StayCached
- // @name:pl StayCached
- // @namespace mailto:szopgracz@op.pl
- // @author Szop Gracz
- // @description Keeps you in Google cache when you click links on cached pages.
- // @description:pl Po kliknięciu odnośnika na kopii strony od Google, przenosi do kopii strony docelowej a nie do oryginału.
- // @match *://webcache.googleusercontent.com/*
- // @version 1.2
- // ==/UserScript==
- const enabled_protocols = ['http','https','ftp','ftps'];
- const cache_header = document.getElementById('google-cache-hdr');
- document.body.addEventListener('click',
- function(e)
- {
- var target = e.target || e.srcElement;
- if ( !target || cache_header.contains(target) ) return;
- while ( !target.href && target.parentNode )
- target = target.parentNode;
- if ( target.href )
- {
- const target_protocol = target.href.substr(0,target.href.search(':'));
- if ( enabled_protocols.indexOf(target_protocol)>=0 && !target.href.match('^http://webcache.googleusercontent.com/') && !target.href.match('^https://webcache.googleusercontent.com/') )
- target.href = location.protocol + '//webcache.googleusercontent.com/search?q=cache:' + target.href.replace(/\+/g, '%2B');
- }
- }
- );