Free and Proper Elections

NCFPE Poltical Blog and News Tracker

Free and Proper Elections - NCFPE Poltical Blog and News Tracker

AT&T has marketing mishap with 9/11 tribute tweet

“; //console.log(“wordCount = “+wordCount); //console.log(“specialClass = “+specialClass); addSidebar(id, specialClass, storyContent, storyGraph, lg); if(fullTotal>=1){ $wn(“#sidebarContainer”).show(); } if(linkTotal >= 1){ $wn(“#DisplaySizeId22 ul li.wnItem:not(.header,.story)”).first().addClass(‘featureSS’); $wn(‘#sidebarContent’).prepend(“”); $wn(‘#sidebarContent .ss.SBsection’).prepend($wn(“#DisplaySizeId22 ul li.wnItem.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+linkTotal, 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(”); } /** * Counts total words in Story Body * @param {featureTotal} a * @param {linkTotal} b * @param {relatedTotal} c * @param {pollTotal} d * @return {Total words needed to wrap sidebar.} */ function countWords(a,b,c,d){ var slideshow = (($wn(“#WNStoryRelatedBox”).children().length)>=1)?120:140; var ssw = (a>=1)?140:0; //console.log(‘countWords | a = ‘+a+’ – ssw = ‘+ssw); var sw = (b>=1)?slideshow:0; //console.log(‘countWords | b = ‘+b+’ – sw = ‘+sw); var lw = (c>=1)?20+(c*18):0; //console.log(‘countWords | c = ‘+c+’ – lw = ‘+lw); var pw = (d>=1&&(a+b)==0)?140:0; //console.log(‘countWords | c = ‘+c+’ – pw = ‘+pw); return ssw+sw+lw+pw; } /** * Inserts poll into either the sidebar or below the last story body image * @param {number} a [Total of featured items. (featureTotal)] * @param {object} b [jQuery path to the poll. (poll)] */ function insertPoll(a, b){ $wn(“#DisplaySizeId12 .wnGroup .wnItem.header”).remove(); /** * a(featureTotal) * @type {nuber} */ if (a == 0){ var pollContainer = “”; $wn(‘#sidebarContent .additionalLinks’).before(pollContainer); }else{ var pollContainer = “”; $wn(“.wnStoryBodyGraphic:last”).after(pollContainer); } $wn(‘#pollContent’).append($wn(poll).contents()); /** * Hack to make poll results appear in the sidebar */ if($(“#DisplaySizeId12 .wnGroup”).hasClass(‘wnPollVoted’)){ $(‘#pollContent’).addClass(‘wnPollVoted’); }
} /** * Adds sidebar to story body copy * @param {string} id [The producer the story orignates from] * @param {string} a [Story size (storySize)] * @param {string} b [Sidebar HTML (sidebarContent)] * @param {object} c [Story body p tag (storyGraph)] * @param {number} d [Number representing the last graph of story body (lg)] */ function addSidebar(id, a, b, c, d,e){ if(a ==’wideSidebar’){ $wn(c[lg]).before(b); }else if(a != ‘wideSidebar’ && id==”APMOBILE”){ $wn(c[1]).after(b); }else{ $wn(c[0]).after(b); } //if (window.PIE) { //$wn(“#sidebarContainer, .wnGroup”).each(function() { //PIE.attach(this); //}); //} } /** * Adds items assigned as Related Links * @param {string} a [Identifier detailing which header to use. Options are (”) and (‘featuring’)] */ function additionalLinks(a){ var link = “#DisplaySizeId3 ul li.wnItem:not(.header)”; // Links+ assigned as Secondary Horizontal – Col 3 var feature = “#DisplaySizeId3 ul li.wnItem.feature.story”; // Story assigned as Secondary Horizontal – Col 3 var linkTotal = checkLength(link); var featureTotal = checkLength(feature);
if(a==” && linkTotal >= 1){ var siteLinkTitle = ($wn(‘#DisplaySizeId3 ul li.wnItem.header h3 span.siteDefault’).text()==””)?”Related Links”:$wn(‘#DisplaySizeId3 ul li.wnItem.header h3 span.siteDefault’).text(); //console.log(‘siteLinkTitle = ‘+siteLinkTitle); $wn(‘#sidebarContent .additionalLinks’).append(”); $wn(‘#sidebarContainer #sidebarHeader .FAL h3 span’).text(siteLinkTitle); $wn(‘#sidebarContent .additionalLinks’).append($wn(link)); $wn(‘.additionalLinks’).fadeIn(‘fast’); }else if(a==’featuring’ && linkTotal >=1){ var siteLinkTitle = ($wn(‘#DisplaySizeId3 ul li.wnItem.header h3 span.siteDefault’).text()==””)?”Related Links”:$wn(‘#DisplaySizeId3 ul li.wnItem.header h3 span.siteDefault’).text(); $wn(‘.additionalLinks .FAL’).hide(); $wn(‘#sidebarContainer #sidebarHeader .FAL’).show(); $wn(‘#sidebarContainer #sidebarHeader .moreHead’).hide(); $wn(‘#sidebarContent .additionalLinks’).append($wn(link)); $wn(‘.additionalLinks’).fadeIn(‘fast’); }else{
} } 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 = “

  • “+headline+image+storyBody+”Continue reading >>
  • ” $wn(‘#sidebarContent .sideStory’).append(storyContent); var imageLength = (image != “”)?true:false; sidebarHeight(clickable, imageLength); } /** * This function creates a story link if needed * @param {string} a [‘True’ if the story has the abridged headline set to clickable] * @param {string} b [The story’s ID] * @param {string} c [The story’s readable URL text] * @param {string} d [The Title/Headline of the story] * @return {string} [If clickable(a) is ‘True’, the headline’s HTML will be returned with a link. If clickable(a) is ‘False’, the headline’s HTML will be returned without a link.] */ function linkedHeadline(a, b, c, d){ if(a == ‘True’){ return “

    “+d+”

    “; }else{ return “

    “+d+”

    “; } } /** * This function creates the HTML if the story includes a story body image * @param {string} a [The link to the story body image (if applicable)] * @param {string} b [The story’s ID] * @param {string} c [The story’s readable URL text] * @return {string} [If an image(a) is passed through the function, it will be rendered in HTML. If an image is not passed through, an empty string will be returned] */ 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 = ($wn(“#sidebarContainer”).hasClass(‘wideSidebar’)==’false’)?showParagraph(sIndex, percent):2;
    //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; }
    }

    All comments are held until links can be removed.

    Your email address will not be published. Required fields are marked *

    *