Skip to content

Instantly share code, notes, and snippets.

@rochefort
Created October 28, 2010 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rochefort/651402 to your computer and use it in GitHub Desktop.
Save rochefort/651402 to your computer and use it in GitHub Desktop.
(gm)display real image size
// ==UserScript==
// @name display real image size
// @namespace http://www.rochefort8.com/
// @include *
// ==/UserScript==
(function(){
var imgs, img;
imgs = xpath('//img');
if(!imgs.snapshotLength) return;
for(var i = 0; i < imgs.snapshotLength; i++){
img = imgs.snapshotItem(i);
img.addEventListener('mouseover', function(event) {
alert(this.naturalWidth + " x " + this.naturalHeight);
}, false);
}
function xpath(query) {
return document.evaluate(query, document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
}
})();
@rochefort
Copy link
Author

画像の実サイズを表示するgreasemonkey - うんたらかんたら日記
http://d.hatena.ne.jp/rochefort/20101028/p1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment