Gaia - No Image Cache

Remove Gaia's image cache from the image source

  1. // ==UserScript==
  2. // @name Gaia - No Image Cache
  3. // @namespace gaiarch_v3
  4. // @match http://*.gaiaonline.com/*
  5. // @version 2.3.1
  6. // @grant none
  7. // @description Remove Gaia's image cache from the image source
  8. // ==/UserScript==
  9. (function() {
  10. var recursiveCheck = function (elem, className) {
  11. if (elem && elem.classList && elem.classList.contains(className)) {
  12. return true;
  13. } else {
  14. if (elem.parentNode) {
  15. return recursiveCheck(elem.parentNode, className);
  16. }
  17. else {
  18. return false;
  19. }
  20. }
  21. };
  22. function noCache() {
  23. var image = document.getElementsByTagName('img');
  24.  
  25. for(let img of image) {
  26. if(img.src.indexOf('img-cache.cdn.gaiaonline.com') !== -1)
  27. img.src = decodeURIComponent(img.src.substr(69)).replace(/&/gi, '&');
  28. }
  29. };
  30. document.addEventListener('click', function (evt) {
  31. if (recursiveCheck(evt.target, 'yui3-pjax')) {
  32. new MutationObserver(function (mutations) {
  33. mutations.some(function (mutation, idx, mutated) {
  34. if (mutation.addedNodes.length === 21) {
  35. for (var i = 0; i < mutation.addedNodes.length; i++) {
  36. if (mutation.addedNodes[i].id === 'post_container') {
  37. noCache();
  38. console.log('changed')
  39. break; // stop for-loop post_container search
  40. };
  41. };
  42. return true; // stop iterating added nodes
  43. };
  44. });
  45. this.disconnect(); // stop listening for changes on the target regardless if post_container exists
  46. }).observe(document.querySelector('#content-padding'), {
  47. childList: true
  48. });
  49. };
  50. });
  51. return noCache();
  52. })();

QingJ © 2025

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