Twitterで画像をサムネイル表示するスクリプト

やったー。ついにiPhone4ホワイトが発売です。
世の中的には全然盛り上がってないみたいですけども。

私の場合、今使ってる3Gの月々割が来月でちょうど満期を迎えます。
きっとそれを待っての発表だったのでしょう。
ちゃんともらえるものは全てもらってから買い替えなさいと。


すみません、余談でした。


掲題の件ですが、instagramのサムネイルも展開するようにしました。

使い方は前回の記事を参照してください。

最新のスクリプトは下記になります。
(いい加減、ダウンロードできるようにした方がいいんですが、あまり需要なさそうだし、、、)



// ==UserScript==
// @name Tweet Image Viewer
// @namespace
// @description
// @include http://twitter.com/*
// @auther ugon105
// v0.1 : 2010.04.19 : First Release
// v1.0 : 2010.10.03 : version 1.0 Release
// v1.1 : 2010.11.17 : support for movapic, twipple
// v1.2 : 2011.04.28 : support for instagram

var targetClass = undefined;
function insertImg() {
var anchors = document.getElementsByClassName(targetClass);
for (var i = 0, len = anchors.length; i < len; i++) {
if (anchors[i].className.indexOf("preview-done") > 0) {
continue;
}
var href = anchors[i].href;
var thUrl = undefined;
// twitpic
if (href.indexOf("http://twitpic.com") == 0) {
var pid = href.substr(href.lastIndexOf("/") + 1);
thUrl = "http://twitpic.com/show/thumb/" + pid;
}
// yfrog
else if (href.indexOf("http://yfrog.com") == 0) {
thUrl = href + ".th.jpg";
}
// plixi
else if (href.indexOf("http://plixi.com/p/") == 0) {
thUrl = "http://api.plixi.com/api/TPAPI.svc/imagefromurl?size=small&url=" + href;
}
// movapic
else if (href.indexOf("http://movapic.com/") == 0) {
var pid = href.substr(href.lastIndexOf("/") + 1);
thUrl = "http://image.movapic.com/pic/s_" + pid + ".jpeg";
}
// twipple
else if (href.indexOf("http://p.twipple.jp/") == 0) {
var id = href.substr(href.lastIndexOf("/") + 1);
thUrl = "http://p.twipple.jp/data/"
+ id.substr(0,1) + "/"
+ id.substr(1,1) + "/"
+ id.substr(2,1) + "/"
+ id.substr(3,1) + "/"
+ id.substr(4,1) + "_s.jpg";

}
// instagram
else if (href.indexOf("http://instagr.am/p/") == 0) {
thUrl = href + "media/?size=t";
}

if (thUrl) {
var img = document.createElement("img");
img.src = thUrl;
with (img.style) {
border = "1px solid #ccc";
padding = "5px";
display = "block";
marginTop = "10px";
}
anchors[i].appendChild(img);
anchors[i].className += " preview-done";
}
}
}

if (document.getElementById("timeline")) {
targetClass = "tweet-url web";
} else if (document.getElementById("doc") && document.getElementById("top-stuff")) {
targetClass = "twitter-timeline-link";
}

if (targetClass) {
insertImg(targetClass);
setInterval(insertImg, 5000);
}