Disable image resize in Feedly

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

  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.2
  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. divImgs = document.querySelectorAll('div.list-entries .visual');
  18.  
  19. [].forEach.call(divs, function (div) {
  20. var preview = div.childNodes[1],
  21. style,
  22. src;
  23.  
  24. if (!(preview.getAttribute('data-fetched'))) {
  25. preview.setAttribute('data-fetched', 1);
  26. style = preview.currentStyle || window.getComputedStyle(preview, false);
  27. if (style.backgroundImage) {
  28. src = /url=([^&]+)/.exec(style.backgroundImage);
  29. if (src && src[1]) {
  30. preview.style.backgroundImage = 'url(' + decodeURIComponent(src[1]) + ')';
  31. }
  32. }
  33. }
  34. });
  35.  
  36. [].forEach.call(divImgs, function (divImage) {
  37. if (!(divImage.getAttribute('data-fetched'))) {
  38. divImage.setAttribute('data-fetched', 1);
  39. var src = divImage.getAttribute('data-original');
  40. var divStyle = divImage.currentStyle || window.getComputedStyle(divImage, false);
  41. if (divStyle) {
  42. var linkEncoded = /url=([^&]+)/.exec(divStyle.backgroundImage.slice(4, -1).replace(/"/g, ""));
  43. if (linkEncoded && linkEncoded[1]) {
  44. divImage.style.backgroundImage = "";
  45. var newImage = new Image();
  46. divImage.appendChild(newImage);
  47. newImage.src = decodeURIComponent(linkEncoded[1]);
  48. newImage.style.maxWidth = divStyle.width;
  49. }
  50. }
  51. }
  52. });
  53.  
  54. [].forEach.call(imgs, function (image) {
  55. if (!(image.getAttribute('data-fetched'))) {
  56. image.setAttribute('data-fetched', 1);
  57. var src = image.getAttribute('data-original');
  58. if (src) {
  59. image.src = src;
  60. }
  61. }
  62. });
  63.  
  64. setTimeout(wait, 200);
  65. };
  66. wait();
  67. }());