Restore the maintaining image of Jianshu

Restore these maintaining image of Jianshu.com

  1. // ==UserScript==
  2. // @name Restore the maintaining image of Jianshu
  3. // @name:zh-CN 恢复简书维护中的图片
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.4
  6. // @description Restore these maintaining image of Jianshu.com
  7. // @description:zh-cn 纯前端恢复简书维护中的图片
  8. // @author rrkelee_k
  9. // @match https://www.jianshu.com/p/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. var delay_load = 1000, max_retry_times = 5;
  15. !function restore_callback (times) {
  16. var target = document.querySelector('.image-package .image-container .image-view-maintain');
  17. if (times <= 0) {
  18. return;
  19. }
  20. if (target === null) {
  21. // avoid arguments.callee
  22. setTimeout(restore_callback, delay_load, times - 1);
  23. return;
  24. }
  25. var maintain_tips = getComputedStyle(target, ':after').getPropertyValue('content');
  26. if (maintain_tips.length) {
  27. var node_list = document.querySelectorAll("img[data-original-src]")
  28. node_list.forEach(function (elem) {
  29. // mv "data-original-src" to "src", from dataset to property
  30. elem.src = elem.dataset.originalSrc;
  31. delete elem.dataset.originalSrc;
  32. elem.classList.remove("image-loading");
  33. });
  34. // remove maintaining tip via dynamic style
  35. var styleElem = document.head.appendChild(document.createElement("style"));
  36. styleElem.innerHTML = ".image-package .image-container .image-view-maintain:after {content: '';} .image-package .image-container .image-view-error:after {content: '';}";
  37. }
  38. }(max_retry_times);
  39. })();

QingJ © 2025

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