简单两招绕过电信屏蔽访问Google cache(快照)

作者: csbde 分类: Other 发布时间: 2009-01-07 15:59

Greasemonkey 2  添加 Js

// This is a greasemonkey script, for use with the Firefox extension Greasemonkey.
// More info: http://greasemonkey.mozdev.org/
//
// ==UserScript==
// @name         Google Cache
// @version      1.0.1
// @author       sunwan
// @e-mail       [email protected]
// @description  Fix google cache to work in china
// @namespace    http://www.cnnj.8866.org/download/greasemonkey/
// @include      http://www.google.com/*
// @include      http://www.google.cn/*
// ==/UserScript==
var fixed = false;
document.addEventListener('click', catchEvent, true);
function catchEvent(e) {
   if ( /\/search\?q=cache:/.test(e.target.href) )   {
      e.preventDefault();               // disable click before fixed
   }
   if ( fixed ) {
      document.removeEventListener('click', catchEvent, true);
   }
}
function checkPage()   {
   if (/^http:\/\/www\.google\..+\/search\?/i.test(location.href))   {
      var els = document.getElementsByTagName("a");
      for (var i = 0; i < els.length; i++)   {
         try {
            if ( /^[^\/]+\/\/[^\/]+\/search\?q=cache:/.test(els[i].href) )   {      //is cache
               els[i].href = els[i].href.replace(/\/search\?q=cache:/,'/search?&wc=zf&q=cache:');// replace the href
            }
         } catch (e) {}
      }
      fixed = true;
   }
}
checkPage();
]]>

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注