Skip to content

Instantly share code, notes, and snippets.

@sacrifs
Created November 30, 2012 12:15
Show Gist options
  • Save sacrifs/4175448 to your computer and use it in GitHub Desktop.
Save sacrifs/4175448 to your computer and use it in GitHub Desktop.
HTMLで画像のサイズが実際のサイズと異なる場合に赤枠を付け、console.logに書き出しするブックマークレット用JS
javascript: (function(){
var d = window.document;
var s = d.createElement('script');
s.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js';
d.body.appendChild(s);
setTimeout(function(){
$("img").each(function(){
var src = $(this).attr("src");
var img = new Image();
img.src = src;
if(img.width != $(this).width() || img.height != $(this).height()){
console.log("サイズが違います", src, "now:" + $(this).width() + "/" + $(this).height() + " real:" + img.width + "/" + img.height);
$(this).css("border", "3px solid red");
}
});
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment