expand image for 2chan

javascript:(function(){Array.forEach(document.images, function(e){if(e.src.match(location.host,'i')){var img=new Image();img.src=e.src.replace(/\/thumb\/\d+s/,function(e){return '/src/'+e.match(/\d+/)});var tid=setInterval(function(){if(img.complete) {clearInterval(tid);if(img.width&&img.height){e.src=img.src;e.width=img.width;e.height = img.height;}}},100);}})})()

SoTした時にサムネイルをpostするのを防ぐ。

追記

んだよ・・・Animation GIFじゃないのになんでGIFだよ・・・
そうか。post時のフォーマットを維持するのか。

flickr_large_image v0.2

個別ページの画像を初めから大きくしておく。

// ==UserScript==
// @name flickr_large_image
// @namespace http://d.hatena.ne.jp/yheld
// @include http://www.flickr.com/photos/*
// @version 0.2
// ==/UserScript==

var large = function () {
	var small = $x('//div[@class="photoImgDiv"]/img')[0];
	var url = $x('//a[@class="image_link"]')[0].href;

	GM_xmlhttpRequest({
		method: 'GET',
		url: url,
		onload: function (res) {
			if (res.status != 200) {
				return;
			}

			var html = document.createElement('html');
			html.innerHTML = res.responseText;
			var big = $x('div[@class="DownloadThis"]/p/img', html)[0];
			var tid = setInterval(function () {
				if (big.complete) {
					clearInterval(tid);
					if (big.width && big.height) {
						small.width = big.width;
						small.height = big.height;
						small.src = big.src;
						small.parentNode.style.width = big.width;
					}
				}
			}, 200);
		}
	});
}

large();

// cho45 - http://lowreal.net/
function $x(exp, context) {
	var Node = unsafeWindow.Node;
	if (!context) context = document;
	var resolver = function (prefix) {
		var o = document.createNSResolver(context)(prefix);
		return o ? o : (document.contentType == "text/html") ? "" : "http://www.w3.org/1999/xhtml";
	}
	var exp = document.createExpression(exp, resolver);
	
	var result = exp.evaluate(context, XPathResult.ANY_TYPE, null);
	switch (result.resultType) {
		case XPathResult.STRING_TYPE : return result.stringValue;
		case XPathResult.NUMBER_TYPE : return result.numberValue;
		case XPathResult.BOOLEAN_TYPE: return result.booleanValue;
		case XPathResult.UNORDERED_NODE_ITERATOR_TYPE: {
			result = exp.evaluate(context, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
			var ret = [];
			for (var i = 0, len = result.snapshotLength; i < len ; i++) {
				var item = result.snapshotItem(i);
				switch (item.nodeType) {
				case Node.ELEMENT_NODE:
					ret.push(item);
					break;
				case Node.ATTRIBUTE_NODE:
				case Node.TEXT_NODE:
					ret.push(item.textContent);
					break;
				}
			}
			return ret;
		}
	}
	return null;
}