Disable image resize in Feedly

By default feedly.com uses own thumb generator service. This script disables it

当前为 2016-07-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Disable image resize in Feedly
  3. // @description By default feedly.com uses own thumb generator service. This script disables it
  4. // @namespace zcarot
  5. // @match *://*.feedly.com/*
  6. // @version 1.1
  7. // @grant GM_addStyle
  8. // ==/UserScript==
  9. /*jslint browser:true */
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. var wait = function () {
  15. var divs = document.querySelectorAll('div.u5EntryAnnotationHolder, div.u4EntryAnnotationHolder, div.topRecommendedEntry'),
  16. imgs = document.querySelectorAll('div.content img');
  17.  
  18. [].forEach.call(divs, function (div) {
  19. var preview = div.childNodes[1],
  20. style,
  21. src;
  22.  
  23. if (!(preview.getAttribute('data-fetched'))) {
  24. preview.setAttribute('data-fetched', 1);
  25. style = preview.currentStyle || window.getComputedStyle(preview, false);
  26. if (style.backgroundImage) {
  27. src = /url=([^&]+)/.exec(style.backgroundImage);
  28. if (src && src[1]) {
  29. preview.style.backgroundImage = 'url(' + decodeURIComponent(src[1]) + ')';
  30. }
  31. }
  32. }
  33. });
  34.  
  35. [].forEach.call(imgs, function (image) {
  36. if (!(image.getAttribute('data-fetched'))) {
  37. image.setAttribute('data-fetched', 1);
  38. var src = image.getAttribute('data-original');
  39. if (src) {
  40. image.src = src;
  41. }
  42. }
  43. });
  44.  
  45. setTimeout(wait, 200);
  46. };
  47. wait();
  48. }());