Google Cache Browser

Continue browsing the page in Google cache

  1. // ==UserScript==
  2. // @name Google Cache Browser
  3. // @namespace qixinglu.com
  4. // @description Continue browsing the page in Google cache
  5. // @grant none
  6. // @include http://webcache.googleusercontent.com/search?*
  7. // @include https://webcache.googleusercontent.com/search?*
  8. // @version 0.0.1.20140517140355
  9. // ==/UserScript==
  10.  
  11. var convertCacheLinks = function(url) {
  12. var selector = 'body > div[style="position:relative"] a';
  13. var links = document.querySelectorAll(selector);
  14. var i, link;
  15. for (i = 0; i < links.length; i += 1) {
  16. link = links[i];
  17. link.href = location.href.replace(url, encodeURIComponent(link.href));
  18. }
  19. };
  20.  
  21. var addOriginalLink = function(url) {
  22. var html = 'Go back to <a href="${href}">original page</a>.';
  23. var paragraph = document.createElement('p');
  24. paragraph.innerHTML = html.replace('${href}',decodeURIComponent(url));
  25. document.body.appendChild(paragraph);
  26. };
  27.  
  28. var url = location.href.match(/q=cache:([^&+]+)/)[1];
  29. if (document.title === 'Error 404 (Not Found)!!1') {
  30. addOriginalLink(url);
  31. } else {
  32. convertCacheLinks(url);
  33. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址