快照链接

把谷歌快照的链接全部转换成谷歌快照

  1. // ==UserScript==
  2. // @name 快照链接
  3. // @namespace lovearia.me
  4. // @description 把谷歌快照的链接全部转换成谷歌快照
  5. // @include http://webcache.googleusercontent.com/search?*q=cache:*
  6. // @version 3.1
  7. // @grant none
  8. // ==/UserScript==
  9. var foreach = function foreach(list, func) {
  10. return Array.prototype.forEach.call(list, func);
  11. };
  12. var translate = function translate(node_list) {
  13. foreach(node_list, function (node) {
  14. if (!!node.href) {
  15. node.href = 'http://webcache.googleusercontent.com/search?q=cache:' + escape(node.href);
  16. }
  17. });
  18. };
  19. var check = function check(node) {
  20. return node.getAttribute('style') === 'position:relative;';
  21. };
  22. var timer = setInterval(function () {
  23. if (document.body.childNodesCount < 3) return;
  24. foreach(document.body.childNodes, function (node) {
  25. if (check(node)) {
  26. translate(node.getElementsByTagName('a'));
  27. clearInterval(timer);
  28. };
  29. });
  30. }, 100);

QingJ © 2025

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