NewsBlur/media/iphone/storyDetailView.js

32 lines
831 B
JavaScript
Raw Normal View History

2012-06-21 11:53:48 -07:00
Zepto(function($) {
$('img').each(function() {
setImage(this);
});
2012-06-21 11:53:48 -07:00
$('img').bind('load', function() {
setImage(this);
});
2012-06-21 11:53:48 -07:00
function setImage(img) {
var $img = $(img);
console.log($img.parent().attr('href'));
if ($img.parent().attr('href')) {
$img.parent().addClass('NB-contains-image')
}
var width = $(img).width();
if ($(img).attr('src').indexOf('feedburner') != -1) {
$(img).addClass('NB-feedburner');
} else if (width > 300) {
$(img).addClass('NB-large-image');
$(img).removeClass('NB-small-image');
} else if (width > 10) {
$(img).addClass('NB-small-image');
$(img).removeClass('NB-large-image');
} else {
$(img).addClass('NB-tracker');
}
}
})