6. //store id the list of opened objects
fullTextList.push(id.toString());
var newContainerHeight = $("#nbItemContainer").height() + ($('#nbItem_'+id).height()-
oldItemHeight);
$("#nbItemContainer").css('height', newContainerHeight);
//reinitialize scroll
window.api.reinitialise();
lastNBObjStr = '';
function isNewData(data)
isNewTemp = false;
currNBObjStr = '';
$.each(data.updates, function(ind)
currNBObjStr = currNBObjStr + data.updates[ind].objId + data.updates[ind].date;
);
//console.log('x'+currNBObjStr);
//console.log('y'+lastNBObjStr);
if(currNBObjStr != lastNBObjStr)
isNewTemp = true;
else
//console.log('no refresh');
lastNBObjStr = currNBObjStr;
return isNewTemp;
isHeaderLinkLoaded = false; // flag to check on if the header hyperlink can be loaded
isShareLinkLoaded = false; // flag to check in the large event the share hyperlink can be loaded
isDoneLoading = false; // flag to test when the html is performed loading inside the jScrollPane
function newsBulletin(data)
7. if(data)
isNewDataFlag = isNewData(data);
if(isNewDataFlag)
//clear contents first
newsbulletin.nbDiv.innerHTML = '';
//console.log('refresh');
updates = data.updates;
headerLink = data.widgetLink;
shareLink = data.shareLink;
if (headerLink != '' && headerLink != null && !isHeaderLinkLoaded)
var twitterImg = " "
$("#newsbulletin > .midcontainer > .widget_head").append("");
$("#newsbulletin > .midcontainer > .widget_head > .twitterLink a new >
.twitterContent").append("" + twitterImg + "");
isHeaderLinkLoaded = true;
//clear the writer cutouts array
newsbulletin.authorCutouts = [];
// examine to find out if there's a height set pertaining to container, if so clear it
// prevents cacheing
var hasHeight = $('#nbItemContainer').attr('style');
if (typeof hasHeight != 'undefined')
$('#nbItemContainer').removeAttr('style');
$.each(updates, function(ind)
var itemDetails = new Object();
it = updates[ind];
//populate your itemDetails object
9. itemDetails.authorfb = 'http://www.facebook.com/abcnews'
itemDetails.authortwitter = 'http://twitter.com/abc'
//only pass the author image if it can be not displayed
within some of the things yet
if($.inArray(it.author.image, newsbulletin.authorCutouts)
== -1)
itemDetails.authorimage = it.author.image;
//add to ignore list
if(it.author.image != '' &&($.inArray(it.author.image,
newsbulletin.authorCutouts) == -1))
newsbulletin.authorCutouts.push(it.author.image);
if(it.text != '')
itemDetails.text = it.text;
else
itemDetails.bgPos = 'bottom right';
if (it.notes)
itemDetails.notes = it.notes;
//build a name worth pair list of id/text
contentObject[itemDetails.id] = itemDetails.text
itemDetails.isExpanded = ($.inArray(itemDetails.id, fullTextList) > -1) ? correct : false;
//build markup
$("#nbItemContainer").append(newsbulletin.displayItems(itemDetails));
);
$("#nbItemContainer").append('');
//set the particular height involving container div
$("#nbItemContainer").css('height',$("#nbItemContainer").height());
11. 60000
);
setInterval(function()
// we're in the position to contact "pane.jScrollPane(settings)" once more however it is
// a lot more convenient to always be able to contact by approach of the actual API as then a original
// settings we passed in are usually immediately remembered.
// Initialization in the container ought to be done right after all the markup may be loaded
// since there will be certainly simply no listener that might be passed straight into reinitialise() for
callback
if (isDoneLoading)
window.api.reinitialise();
isDoneLoading = false;
, 5000);
;
addOnload(newsbulletin.load());
http://abcnews.go.com/Politics/