Disable image resize in Feedly

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

Versione datata 02/05/2016. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        Disable image resize in Feedly
// @description By default feedly.com uses own thumb generator service. This script disables it
// @namespace   zcarot
// @match       *://*.feedly.com/*
// @version     1
// @grant       GM_addStyle
// ==/UserScript==

'use strict';

function replaceQueryParam(param, newval, search) {
    var regex = new RegExp("([?;&])" + param + "[^&;]*[;&]?");
    var query = search.replace(regex, "$1").replace(/&$/, '');

    return (query.length > 2 ? query + "&" : "?") + (newval ? param + "=" + newval : '');
}

var wait = function () {
  var divs = document.querySelectorAll('div.u5EntryAnnotationHolder');

  [].forEach.call(divs, function(div) {
    var preview = div.childNodes[1];
    if (!(preview.getAttribute('data-fetched'))) {
        preview.setAttribute('data-fetched', 1);
        var style = preview.currentStyle || window.getComputedStyle(preview, false);
        if (style.backgroundImage) {
            var src = /url=([^&]+)/.exec(style.backgroundImage);
            if (src && src[1]) {
                preview.style.backgroundImage = 'url(' + decodeURIComponent(src[1]) + ')';
            }
        }
    }
  });

  var imgs = document.querySelectorAll('div.content img');

  [].forEach.call(imgs, function(image) {
      if (!(image.getAttribute('data-fetched'))) {
        image.setAttribute('data-fetched', 1);
          var src = image.getAttribute('data-original');
          if (src) {
              image.src = src;
          }
      }
  });

  setTimeout(wait, 200);
};
wait();