2012-06-28 15:11:39 -07:00
|
|
|
$('.NB-story img').each(function() {
|
2012-06-28 13:24:40 -07:00
|
|
|
setImage(this);
|
|
|
|
});
|
2012-06-21 11:53:48 -07:00
|
|
|
|
2012-06-28 15:11:39 -07:00
|
|
|
$('.NB-story img').bind('load', function() {
|
2012-06-28 13:24:40 -07:00
|
|
|
setImage(this);
|
|
|
|
});
|
2012-06-21 11:53:48 -07:00
|
|
|
|
2012-06-28 13:24:40 -07:00
|
|
|
function setImage(img) {
|
|
|
|
var $img = $(img);
|
|
|
|
var width = $(img).width();
|
|
|
|
var height = $(img).height();
|
2012-06-25 23:06:16 -07:00
|
|
|
|
2012-06-28 13:24:40 -07:00
|
|
|
if ($img.attr('src').indexOf('feedburner') != -1) {
|
|
|
|
$img.attr('class', 'NB-feedburner');
|
|
|
|
} else if (width > 300 && height > 50) {
|
|
|
|
$img.attr('class', 'NB-large-image');
|
|
|
|
if ($img.parent().attr('href')) {
|
|
|
|
$img.parent().addClass('NB-contains-image')
|
|
|
|
}
|
|
|
|
} else if (width > 30 && height > 30) {
|
|
|
|
$img.attr('class', 'NB-medium-image');
|
|
|
|
if ($img.parent().attr('href')) {
|
|
|
|
$img.parent().addClass('NB-contains-image')
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$img.attr('class', 'NB-small-image');
|
|
|
|
}
|
|
|
|
}
|
2012-06-21 11:53:48 -07:00
|
|
|
|
2012-06-25 23:06:16 -07:00
|
|
|
window.onload = load;
|
|
|
|
|
|
|
|
function load() {
|
2012-06-28 13:24:40 -07:00
|
|
|
document.getElementsByClassName('NB-share-button')[0].addEventListener("touchstart", touchStart, false);
|
|
|
|
document.getElementsByClassName('NB-share-button')[0].addEventListener("touchend", touchEnd, false);
|
2012-06-25 23:06:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function touchStart(e) {
|
2012-06-28 13:24:40 -07:00
|
|
|
var original_class = e.target.getAttribute("class");
|
|
|
|
e.target.setAttribute("class", original_class + " active");
|
|
|
|
return false;
|
2012-06-25 23:06:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function touchEnd(e) {
|
2012-06-28 13:24:40 -07:00
|
|
|
var original_class = e.target.getAttribute("class");
|
|
|
|
e.target.setAttribute("class", original_class.replace('active', ''));
|
|
|
|
window.location = "http://ios.newsblur.com/share";
|
|
|
|
return false;
|
2012-06-25 23:06:16 -07:00
|
|
|
}
|