Disable image resize in Feedly

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

目前為 2016-05-02 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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();