Long lines at Rivers Casino for first Steelers home game since sports betting began | WPXI"),
jqAd = jqAdRow.find('.mod-ad');
UI.list.prepend( jqAdRow );
me._addWaitingAd( jqAd.get(0) );
me.loadAds();
};
proto.loadAds = function() {
var me = nh, UI = me.UI;
if( me.isOpen && UI.waitingAds.length ) {
// Make refresh call so waypoint can check itself in viewport
$.each(UI.waitingAds, function(idx, adWatcher){
adWatcher.refresh();
});
}
};
var setCookie = function(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
};
var getCookie = function(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i 0 && me.adCount 0) {
setInterval(me.refresh, me.interval);
}
};
proto.resetStates = function() {
var me = this,
UI = this.UI;
me.unreadCount = 0;
UI.counter.text('');
UI.counter.removeClass('counter');
UI.list.find('li').addClass('read');
UI.listCount.text('');
var viewTime = me.lastRefreshTime > 0 ? me.lastRefreshTime : new Date().getTime();
setCookie("homestreamLastViewTime", viewTime, 5);
};
proto.open = function() {
var me = this,
UI = this.UI;
if( !me.isOpen ){
scrollbarWidth = (typeof scrollbarWidth === 'undefined') ? measureScrollbar() : scrollbarWidth;
UI.icon.addClass('open');
UI.homestream.stop(true).slideDown();
jqHtml.addClass('noscroll');
jqNeedsScrollPadding.css('padding-right', scrollbarWidth+'px');
// Scroll to top of the list when open it
UI.listContainer.scrollTo(0);
// COX-544, reset homestream state when opening the dropdown
me.resetStates();
// Load sponsored AD when dropdown list opens for the first time
if (!UI.sponsoredAd || !UI.sponsoredAd.find('.ep-ad-slot').length) {
var adJsonConfig = UI.sponsoredAd.data('ad-json');
if (adJsonConfig && adJsonConfig.targetting && adJsonConfig.targetting.ad_slot.length) {
EP.Utils.AdUtils.createIncrementingContent(adJsonConfig, UI.sponsoredAd, "append");
UI.sponsoredAd.find('.ep-ad-slot').attr('name', adJsonConfig.targetting.ad_slot[0]);
}
}
// clicking off closes it
me._closeHandler = function(e){
var target = e.target,
instance = UI.instance.get(0),
// check if click came from itself or within
clickedInside = target && (target===instance || $.contains(instance, target));
if( !clickedInside ){
me.close();
}
};
// to prevent body scrolling on IOS touch
me._moveHandler = function(e){
e.preventDefault();
e.stopImmediatePropagation();
e.stopPropagation();
};
UI.clickClosable.bind('click', me._closeHandler);
UI.touchImmovable.bind('touchmove', me._moveHandler);
me.isOpen = true;
$.each(UI.waitingAds, function(idx, adWatcher) {
adWatcher.enable();
});
me.loadAds();
}
};
proto.close = function() {
var me = this,
UI = this.UI;
if( me.isOpen ){
jqNeedsScrollPadding.css('padding-right', '');
jqHtml.removeClass('noscroll');
UI.homestream.stop(true).slideUp();
UI.icon.removeClass('open');
// cleanup event listeners
UI.clickClosable.unbind('click', me._closeHandler);
UI.touchImmovable.unbind('touchmove', me._moveHandler);
me.isOpen = false;
$.each(UI.waitingAds, function(idx, adWatcher) {
adWatcher.disable();
});
me.resetStates();
}
};
// source: https://www.npmjs.com/package/measure-scrollbar
var measureScrollbar = function () {
var div = document.createElement('div');
div.style.width = '100px';
div.style.height = '100px';
div.style.overflow = 'scroll';
div.style.position = 'absolute';
div.style.top = '-9999px';
document.body.appendChild(div);
var barWidth = div.offsetWidth - div.clientWidth;
document.body.removeChild(div);
return barWidth;
};
var AdWatcher = function( modAd, jqWindow, callback ){
var self = this;
self.modAd = modAd;
var waypoint = new Waypoint.Inview({
element: modAd,
enter: function() {
callback( self );
},
enabled: false,
context: jqWindow.get(0)
});
self.waypoint = waypoint;
self.enable = function(){
waypoint.enable();
};
self.disable = function(){
waypoint.disable();
};
self.destroy = function(){
waypoint.destroy();
waypoint = null;
};
self.refresh = function(){
// refresh inner inview waypoints
if( waypoint.waypoints && waypoint.waypoints.length ) {
var ways = waypoint.waypoints,
i = ways.length;
while(i--){
ways[i].context.refresh();
}
}
};
};
var config = {
source: 'C_HOMESTREAM_SOURCE_AUTOFLOW',
groupId: 12333161,
companyId: 10155,
interval: 0,
adInterval: 10,
interstitialAdConfig: '{"baseAdUnitPath":"Pittsburgh_TV/wpxi_web_default","contentId":"","isCompanion":false,"lazyLoad":"scroll","isOOP":false,"networkID":"12523293","refreshOnResize":false,"siteKey":"","size":[[320, 50]],"sizeMapping":[],"targetting":{"ad_slot":["HS01"]},"wxTargeting":{"skycond":"","weather":"", "temp":""}}'
};
var nh = new NavigationHomestream(config);
EP.Clients.CMG = EP.Clients.CMG || {};
EP.Clients.CMG.navigationHomestream = EP.Clients.CMG.navigationHomestream || [];
EP.Clients.CMG.navigationHomestream.push(nh);
nh.start();
})(jQuery);
');
dropdownContainer = navItem.find('.'+dropdownContainerCls);
}
dropdownContainer.append(html.trim());
A.use('ep-carousel', function(){
/* Wait for carousel */
updateTruncation( dropdownContainer );
});
}
})
} else {
updateTruncation( navItem.find('.'+dropdownContainerCls) );
}
});
}
}
};
var $win = $(window).resize(function(e){
var wd = $win.width();
if(wd !== lastWindowWidth){
/* Only update if there really was a change */
lastWindowWidth = wd;
asyncCheckNav();
}
});
checkNav();
};
timer = setLater(timer, 10, gCtx, init);
})(jQuery, AUI(), false);
Read more