我正在尋找一個Greasemonkey腳本,用於替換Tumblr,Pinterest,Flickr,Facebook和Webstagram RSS Feed中的圖像, InoReader。用InoReader中的大版本替換Tumblr,Pinterest,Flickr圖像(RSS閱讀器)
我在谷歌閱讀器中爲Tumblr和Pinterest成功使用了以下腳本。想將它們移植到InoReader並將它們合併成一個腳本。
老谷歌閱讀器的tumblr腳本:
// ==UserScript==
// @name Big Photos from Tumblr on Google Reader
// @include http://*.google.com/reader/view/*
// @include https://*.google.com/reader/view/*
// ==/UserScript==
document.getElementById("chrome").addEventListener("DOMNodeInserted", function (e) {
if (e.target.tagName && e.target.tagName == "DIV" && /entry\s?/.test(e.target.className)) {
var t = e.target.getElementsByTagName("img");
for (var n in t) {
var r = t[n];
r.style.maxHeight = "1080px";
var i = r.src;
if (i.indexOf("tumblr") > -1) {
r.src = r.src.replace("_500.jpg", "_1280.jpg");
r.onerror = function() {
this.src = this.src.replace("_1280.jpg", "_500.jpg")
}
}
}
}
}, false)
老谷歌閱讀器Pinterest的腳本:
// ==UserScript==
// @id greader-pinteresturlreplacer
// @name Google Reader - Pinterest URL Replacer
// @version 1.3
// @include https://www.google.com/reader/*
// ==/UserScript==
document.getElementById("chrome").addEventListener("DOMNodeInserted", function (e) {
var t = e.target;
if (t.tagName && t.tagName == "DIV" && /entry\b/i.test(t.className)) {
var n = t.getElementsByTagName("img");
for (var r in n) {
var i = n[r];
if (/pinterest\.com.*_b\.\w+$/.test(i.src) || /pinterest\.com\/192x\//.test(i.src)) {
i.style.width = "inherit";
i.style.height = "inherit";
i.src = i.src.replace(/_b\.(\w+)$/, ".$1");
i.src = i.src.replace(/\.com\/192x\//, ".com/550x/")
}
}
}
}, false);
document.getElementById("chrome").addEventListener("DOMNodeInserted", function (e) {
var t = e.target;
if (t.tagName && t.tagName == "DIV" && /entry\b/i.test(t.className)) {
var n = t.getElementsByTagName("img");
for (var r in n) {
var i = n[r];
if (/pinimg\.com.*_b\.\w+$/.test(i.src) || /pinimg\.com\/192x\//.test(i.src)) {
i.style.width = "inherit";
i.style.height = "inherit";
i.src = i.src.replace(/_b\.(\w+)$/, ".$1");
i.src = i.src.replace(/\.com\/192x\//, ".com/550x/")
}
}
}
}, false)
對於Facebook正在努力的Greasemonkey腳本InoReader以下,Webstagram和Flickr。
InoReader Facebook的:
// ==UserScript==
// @id inoreaderfacebookthumbs
// @name InoReader Facebook Thumbnail Replacer
// @version 1.0
// @include https://inoreader.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
/* Facebook Thumbnails */
waitForKeyElements (
"#reader_pane div.article_full_contents div.article_content a.underlink img",
swapOutFbcdnThumnails
);
function swapOutFbcdnThumnails (jNode) {
/*-- Change src from:
https://fbcdn-photos- ... _s.jpg
to:
https://fbcdn-sphotos- ... _n.jpg
*/
var newSrc = jNode[0].src.replace (/fbcdn\-photos\-/, "fbcdn-sphotos-");
newSrc = newSrc.replace (/_s\.jpg$/, "_n.jpg");
jNode[0].src = newSrc;
}
InoReader Webstagram:
// ==UserScript==
// @id inoreaderwebstagramthumbs
// @name InoReader Webstagram Thumbnail Replacer
// @version 1.0
// @include https://inoreader.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/* Webstagram Thumbnails */
waitForKeyElements (
"#reader_pane div.article_full_contents div.article_content a.underlink img",
swapOutWebstgmThumnails
);
function swapOutWebstgmThumnails (jNode) {
/*-- Change src from:
https://*.amazonaws.com ... _6.jpg
to:
https://*.amazonaws.com ... _7.jpg
*/
var newSrc = jNode[0].src.replace (/amazonaws/, "amazonaws");
newSrc = newSrc.replace (/_6\.jpg$/, "_7.jpg");
jNode[0].src = newSrc;
}
InoReader Flickr的:
// ==UserScript==
// @id inoreaderflickrthumbsreplacer
// @name InoReader Flickr Thumbnail Replacer
// @version 1.0
// @include https://inoreader.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/* Flickr Thumbnails */
waitForKeyElements (
"#reader_pane div.article_full_contents div.article_content a.underlink img",
swapOutFlickrThumnails
);
function swapOutFlickrThumnails (jNode) {
/*-- Change src from:
https://*.staticflickr ... _m.jpg
to:
https://*.staticflickr ... _b.jpg
*/
var newSrc = jNode[0].src.replace (/staticflickr/, "staticflickr");
newSrc = newSrc.replace (/_m\.jpg$/, "_b.jpg");
jNode[0].src = newSrc;
}
以下是對每個樣品的一些RSS提要:Tumblr,Flickr,Pinterest,Facebook,Webstagram
如何合併這些腳本? 在此先感謝。
很好,謝謝!我添加了額外的語句來轉換Pinterest的拇指,這工作正常。 只有在「_1280.jpg」版本存在的情況下,Tumblr零件纔有效。如果添加原始Tumblr腳本中的.onerror條件以返回「_500.jpg」,如果「_1280.jpg」不在那裏? – user2031073
好的,更新的答案應該這樣做。我也添加了建議的編輯更改。 *重要提示:*第一個答案有潛在的錯誤。我改變了這個新版本如何設置'src'來解決這個問題。 –
完美!謝謝! – user2031073