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-07-26 13:54:45 -07:00
|
|
|
$('a.NB-show-profile').live('click', function(){
|
2012-07-11 18:08:07 -07:00
|
|
|
var offset = $('img', this).offset();
|
2012-07-03 17:54:36 -07:00
|
|
|
console.log(offset);
|
|
|
|
var url = $(this).attr('href') + "/" + offset.left + "/" + (offset.top - window.pageYOffset) + "/" + offset.width + "/" + offset.height;
|
|
|
|
window.location = url;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
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-07-26 10:17:08 -07:00
|
|
|
//window.onload = load;
|
|
|
|
//
|
|
|
|
//function load() {
|
|
|
|
// document.getElementsByClassName('NB-share-button')[0].addEventListener("touchstart", touchStart, false);
|
|
|
|
// document.getElementsByClassName('NB-share-button')[0].addEventListener("touchend", touchEnd, false);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//function touchStart(e) {
|
|
|
|
// var original_class = e.target.getAttribute("class");
|
|
|
|
// e.target.setAttribute("class", original_class + " active");
|
|
|
|
// return false;
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//function touchEnd(e) {
|
|
|
|
// 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-07-03 17:54:36 -07:00
|
|
|
|