addSidebar(storySize, storyContent, storyGraph, lg);
var link = "#DisplaySizeId22 ul li.wnItem.link";
var linkTotal = checkLength(link);
if(linkTotal >= 1){
$wn(link+":first").addClass('featureSS');
$wn('#sidebarContent').prepend("");
$wn('#sidebarContent .ss.SBsection').prepend($wn(link+".featureSS"));
}
var feature = "#DisplaySizeId22 ul li.wnItem.feature.story";
var featureTotal = checkLength(feature);
if(featureTotal >= 1){
$wn("#sidebarContent .additionalLinks").before("");
var idNum = $wn(""+feature+":first h4 a").attr("href");
var retIdNum = idNum.match(/\d+/);
requestFeed("http://api.worldnow.com/feed/v3.0/stories/" + retIdNum);
}
var poll = "#WNCol3 #WNDS12 .wnDVPoll";
var pollTotal = checkLength(poll);
if(pollTotal >= 1){
insertPoll(featureTotal, poll);
}
if(pollTotal == 0 && featureTotal == 0 && linkTotal == 0){
additionalLinks('featuring');
}else{
additionalLinks('');
}
}
function insertPoll(a, b){
if (a == 0){
var pollContainer = "";
$wn('#sidebarContent .additionalLinks').before(pollContainer);
}else{
var pollContainer = "";
$wn(".wnStoryBodyGraphic:last").after(pollContainer);
}
$wn('#pollContent').append($wn(poll));
}
function additionalLinks(a){
var link = "#DisplaySizeId3 ul li.wnItem.link";
var feature = "#DisplaySizeId3 ul li.wnItem.feature.story";
var linkTotal = checkLength(link);
var featureTotal = checkLength(feature);
if(linkTotal >= 1 || featureTotal >= 1){
$wn('#sidebarContent .additionalLinks').append('');
}
if(linkTotal >= 1){
$wn('#sidebarContent .additionalLinks').append($wn(link));
$wn('.additionalLinks').fadeIn('fast');
}
if(featureTotal >= 1){
$wn('#sidebarContent .additionalLinks').append($wn(feature));
$wn('.additionalLinks').fadeIn('fast');
}
if(a == 'featuring'){
$wn('.additionalLinks .FAL').hide();
$wn('#sidebarContainer #sidebarHeader .FAL').show();
$wn('#sidebarContainer #sidebarHeader .moreHead').hide();
}else if(a == ''){
$wn('#sidebarContainer #sidebarHeader .FAL').hide();
}
}
function sidebarFeed(feed){
var feature = "#DisplaySizeId22 ul li.wnItem.feature.story";
$wn(""+feature+":first").remove();
var xml = feed.response.responseXML;
var story = xml.getElementsByTagName("story");
var img = $wn(xml).find("story storyimage:first filename").text();
var clickable = $wn(xml).find("isclickable").text();
var title = $wn(xml).find("story abridged headline").text();
//story[0].getElementsByTagName("headline")[0].childNodes[0].nodeValue;
var body = story[0].getElementsByTagName("body")[0].childNodes[0].nodeValue;
var pageURL = story[0].getElementsByTagName("pageurl")[0].childNodes[0].nodeValue;
var id = story[0].getElementsByTagName("id")[0].childNodes[0].nodeValue;
var headline = linkedHeadline(clickable, id, pageURL, title);
var image = SBimage(img, id, pageURL);
var storyBody = "
" + body + "
"; var storyContent = ""+d+"
"; }else{ return ""+d+"
"; } } function SBimage(a, b, c){ if(a == ''){ return ''; }else{ return ""; } } function sidebarHeight(clickable){ $wn(document).ready(function(){ var sideBarHeight = $wn('#sidebarContainer').height(); var link = "#sidebarContent li.wnItem.feature"; var ss = "#sidebarContent li.featureSS"; var linkTotal = checkLength(link); var ssTotal = checkLength(ss); var storyHeight = $wn('#firstStory').height(); var percent = storyHeight; //console.log(clickable); if(sideBarHeight >= bodyHeight && clickable == 'True'){ storyHide(linkTotal, ssTotal, storyHeight, bodyHeight); //console.log(linkTotal, ssTotal, storyHeight, bodyHeight); }else{ $wn(".continueReading.more").hide(); } }); } function storyHide(a, b, c, d){ var lh = height(a,50,40); var sh = height(b,300,1); var sbe = lh+sh+250; var sbh = Math.round((d*.15)+(d-sbe)); var sIndex = $wn("#firstStory .summary p, #firstStory .summary h3, #firstStory .summary ol, #firstStory .summary ul").length+1; var percent = (sbh/c).toFixed(2); var showP = Math.floor(sIndex*percent); //console.log("lh = "+lh+" sh = "+sh+ " sbe = "+sbe+" sbh = "+sbh+" sIndex = "+sIndex+" percent = "+percent+" showP = "+showP); if (showP == sIndex){ $wn(".continueReading.more").hide(); }else{ for(i=sIndex; i>=showP; i--){ $wn("#firstStory .summary.abridged >:eq("+i+")").hide(); } } function height(a, b, c){ if(a >= 1){ return (b*a)+c; }else{ return a; } } } function sidebaruError(){} function requestFeed(url){WNHttpRequestManager.makeRequest(url, { onSuccess: sidebarInit, onError: sidebaruError});}; function sidebarInit(){sidebarFeed(this);} function checkLength(a){var items = $wn(""+a+"").length;return items;} function addSidebar(a, b, c, d){ if(a >= 3){$wn(c[0]).after(b);}else if(a >= 2 && aSource: http://www.fox19.com/story/19079888/health-insurance-rebates-in-ohio-to-total-113m
university of kentucky ncaa oakland news alec baldwin alec baldwin college basketball oakland
No comments:
Post a Comment