addSidebar(id, storySize, storyContent, storyGraph, lg);
var link = "#DisplaySizeId22 ul li.wnItem.link";
var feature = "#DisplaySizeId22 ul li.wnItem.feature.story";
var poll = "#WNCol3 #DisplaySizeId12 .wnGroup";
var aLink = "#DisplaySizeId3 ul li.wnItem.link";
var aFeature = "#DisplaySizeId3 ul li.wnItem.feature.story";
var linkTotal = checkLength(link);
var featureTotal = checkLength(feature);
var pollTotal = checkLength(poll);
var aLinkTotal = checkLength(aLink);
var aFeatureTotal = checkLength(aFeature);
var fullTotal = featureTotal+pollTotal+linkTotal+aFeatureTotal+aLinkTotal;
if(fullTotal>=1){
$wn("#sidebarContainer").show();
}
if(linkTotal >= 1){
$wn(link+":first").addClass('featureSS');
$wn('#sidebarContent').prepend("");
$wn('#sidebarContent .ss.SBsection').prepend($wn(link+".featureSS"));
}
if(featureTotal >= 1){
if(pageID == 'F' || pageID == ''){
//console.log("pageID = "+pageID);
$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);
}
if(page > 1){
$wn("#sidebarContainer").hide();
}
}
if(pollTotal >= 1){
insertPoll(featureTotal, poll);
}
//console.log("featureTotal = "+featureTotal);
if(pollTotal == 0 && featureTotal == 0 && linkTotal == 0){
additionalLinks('featuring');
}else if(featureTotal >= 1 && linkTotal == 0){
if(pageID == 'N' || pageID == 'L'){
additionalLinks('featuring');
}else{
additionalLinks('');
}
}else{
additionalLinks('');
}
function insertPoll(a, b){
$wn("#DisplaySizeId12 .wnGroup .wnItem.header").remove();
if (a == 0){
var pollContainer = "";
$wn('#sidebarContent .additionalLinks').before(pollContainer);
}else{
var pollContainer = "";
$wn(".wnStoryBodyGraphic:last").after(pollContainer);
}
$wn('#pollContent').append($wn(poll).contents());
//$wn(document).ready(function(){
if($("#DisplaySizeId12 .wnGroup").hasClass('wnPollVoted')){
$('#pollContent').addClass('wnPollVoted');
}
//});
}
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 body = story[0].getElementsByTagName("body")[0].childNodes[0].nodeValue;
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 bodyText = 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 = "
" + bodyText + "
"; var storyContent = ""+d+"
"; }else{ return ""+d+"
"; } } function SBimage(a, b, c){ if(a == ''){ return ''; }else{ return ""; } } function sidebarHeight(clickable, l){ $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("sideBarHeight = "+sideBarHeight+" - bodyHeght = "+bodyHeight+" - clickable = "+clickable); if(sideBarHeight >= bodyHeight && clickable == 'True'){ storyHide(linkTotal, ssTotal, storyHeight, bodyHeight,l); //console.log("linkTotal = "+linkTotal+" ssTotal = "+ ssTotal+" storyHeight = "+ storyHeight+" bodyHeight = "+ bodyHeight); }else{ $wn(".continueReading.more").hide(); } }); } function storyHide(a, b, c, d,l){ //console.log("a = "+a+" - b = "+b+" - c = "+c+" - d = "+d); var lh = height(a,55,40); var sh = height(b,300,0); var sbe = lh+sh+250; var sbh = Math.round((d*.35)+(d-sbe)); var sIndex = $wn("#firstStory .summary p, #firstStory .summary h3, #firstStory .summary ol, #firstStory .summary ul").length; var percent = (l==true)? (sbh/(c+85)).toFixed(2):(sbh/(c)).toFixed(2); var showP = showParagraph(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 showParagraph(a,c){ var b = Math.floor(a*c); if(b = 6){ return 6; }else{ return b; } } 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(id, a, b, c, d){ if(a >= 3 && id=="APMOBILE"){ $wn(c[1]).after(b); }else if(a >= 3){ $wn(c[0]).after(b); }else if(a >= 2 && aSource: http://www.wistv.com/story/20570920/sc-bishop-church-split-brings-clarity-to-future
affordable care act the line us soccer bobby brown arrested the happening black panthers mauritania
No comments:
Post a Comment