-
-
Save nowri/5360314 to your computer and use it in GitHub Desktop.
HTMLで画像のサイズが実際のサイズと異なる場合に赤枠を付け、console.logに書き出しするブックマークレット用JS (forked from sacrifs)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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