// Copyright (C) 2017 Comcast Cable Communications, LLC
// Contact Us: http://customer.xfinity.com/contact-us/
// Intended use of this message is to display critical and time sensitive notifications to customers.
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
http://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html
*/
var _ComcastAlert = (function(){
return {
SYS_URL: '/e8f6b078-0f35-11de-85c5-efc5ef23aa1f/aupm/notify.do'
, dragObj: {zIndex: 999999}
, browser: null
, comcastCheck: 1
, comcastTimer: null
, xmlhttp: null
, go: function(){
if(self.location !== top.location) return;
if(document.body){
_ComcastAlert.browser = _ComcastAlert.checkBrowser();
_ComcastAlert.ComcastBrowserNotice();
_ComcastAlert.getXmlhttp();
_ComcastAlert.checkBulletin();
_ComcastAlert.initResizeCheck();
_ComcastAlert.polyfillClassList();
return _ComcastAlert;
}else{
setTimeout(_ComcastAlert.go, 200);
}
}
, ComcastBrowserNotice: function(){
// var image_url = 'http://bnpsa.g.comcast.net:80/images/ubb/';
var image_url = 'https://bnp-service-alerts.gslb2.comcast.com/images/';
var comcastAlertAnalytics = 'comcastalert.png';
var noticeBMUID = '156848959';
var winObj = {
image_url: image_url
, comcastAlertAnalytics: comcastAlertAnalytics
, comcastlogo_url: ''
, xfinitylogo_url: ''
, headertext1: 'You've used 90% of your data usage plan'
, textline1: 'As of 10-29-2019, you have 102 GB remaining of your 1024 GB Internet data usage plan for this calendar month. As a courtesy, we give you 2 months of complimentary overages. Your courtesy month balance is 1.'
, confirmBtn: 'CLICK TO CLOSE'
, privacypolicylink: 'PRIVACY POLICY'
, termslink: 'TERMS OF SERVICE'
, usagemeterlink: 'USAGE METER'
, faqlink: 'FAQs'
, closebulletin: ''
, analytics: ''
};
this.createWindow(winObj);
}
, createWindow: function(winObj){
var html = '';
if (_ComcastAlert.browser.isIE && _ComcastAlert.browser.version<10){
html += '
';
}else{
var mq = window.matchMedia("(max-width: 650px)");
if(mq.matches){
html += '
';
}else{
html += '
';
}
}
html += '';
html += '
';
html += '
';
html += winObj.headertext1;
html += '
';
html += '
';
html += winObj.textline1;
html += '
';
html += '
';
html += winObj.confirmBtn;
html += '
';
html += '';
html += '
';
html += '
';
html += '
';
html += '
';
document.body.innerHTML = document.body.innerHTML + html;
}
// Function to Determine browser and version. Copyright 2001 by Mike Hall.
, checkBrowser: function() {
var ua, s, i;
var browser = {
isIE: false
, isNS: false
, version: null
};
ua = navigator.userAgent;
s = "MSIE";
if ((i = ua.indexOf(s)) >= 1) {
browser.isIE = true; browser.version = parseFloat(ua.substr(i + s.length));
}
s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
browser.isNS = true; browser.version = parseFloat(ua.substr(i + s.length));
}
s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
browser.isNS = true; browser.version = 6.1;
}
return browser;
}
, dragStart: function(event, id) {
var browser1 = _ComcastAlert.browser;
var dragObj = _ComcastAlert.dragObj;
//console.log("dragObj="+ dragObj)
var el;
var x, y;
if (id) dragObj.elNode = document.getElementById(id);
else {
if (browser1.isIE) dragObj.elNode = window.event.srcElement;
if (browser1.isNS) dragObj.elNode = event.target;
if (dragObj.elNode.nodeType == 3) dragObj.elNode = dragObj.elNode.parentNode;
}
if (browser1.isIE) {
x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
}
if (browser1.isNS) {
x = event.clientX + window.scrollX;
y = event.clientY + window.scrollY;
}
dragObj.cursorStartX = x;
dragObj.cursorStartY = y;
dragObj.elStartLeft = parseInt(dragObj.elNode.style.left, 10);
dragObj.elStartTop = parseInt(dragObj.elNode.style.top, 10);
if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = dragObj.elNode.offsetLeft;//100;
if (isNaN(dragObj.elStartTop)) dragObj.elStartTop = dragObj.elNode.offsetTop;//400;
if (browser1.isIE) {
document.attachEvent("onmousemove", _ComcastAlert.dragGo);
document.attachEvent("onmouseup", _ComcastAlert.dragStop);
window.event.cancelBubble = true;
window.event.returnValue = false; }
if (browser1.isNS) {
document.addEventListener("mousemove", _ComcastAlert.dragGo, true);
document.addEventListener("mouseup", _ComcastAlert.dragStop, true);
event.preventDefault();
}
}
// End Function
, initResizeCheck: function() {
var browser1 = _ComcastAlert.browser;
if (browser1.isIE && browser1.version<9){
window.attachEvent("onresize", _ComcastAlert.onWindowResize);
_ComcastAlert.onWindowResize();
}else{
window.addEventListener('resize', _ComcastAlert.onWindowResize, false);
_ComcastAlert.monitorScroll();
}
}
, onWindowResize: function() {
var browser1 = _ComcastAlert.browser;
if (browser1.isIE && browser1.version<9){
var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var dragObj = document.getElementById("comcast_content");
dragObj.style.position = "absolute";
dragObj.style.left = (windowWidth-dragObj.offsetWidth)/2 +"px";
dragObj.style.top = '70px';
}else{
var popup = document.getElementById('comcast_content');
var obj = popup.classList.contains('mobile-size');
// console.log(obj)
var mq = window.matchMedia("(max-width: 650px)");
// console.log(mq)
if(mq.matches) {
//alert('match')
popup.classList.add('mobile-size');
} else{
popup.classList.remove('mobile-size');
}
}
}
, comcastContentnoCache: function() {
return Math.round(Math.random() * 96151252);
}
, dragGo: function(event) {
var browser1 = _ComcastAlert.browser;
var dragObj = _ComcastAlert.dragObj;
var x, y;
if (browser1.isIE) {
x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
}
if (browser1.isNS) {
x = event.clientX + window.scrollX; y = event.clientY + window.scrollY;
}
dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
dragObj.elNode.style.top = (dragObj.elStartTop + y - dragObj.cursorStartY) + "px";
if (browser1.isIE) { window.event.cancelBubble = true; window.event.returnValue = false; }
if (browser1.isNS) event.preventDefault();
}
, dragStop: function(event) {
var browser1 = _ComcastAlert.browser;
if (browser1.isIE) {
document.detachEvent("onmousemove", _ComcastAlert.dragGo);
document.detachEvent("onmouseup", _ComcastAlert.dragStop);
}
if (browser1.isNS) {
document.removeEventListener("mousemove", _ComcastAlert.dragGo, true);
document.removeEventListener("mouseup", _ComcastAlert.dragStop, true);
}
}
, getXmlhttp: function(){
var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}
this.xmlhttp = xmlhttp;
}
, checkBulletin: function(){
if(_ComcastAlert.comcastCheck==0) { return; }
var xmlhttp = _ComcastAlert.xmlhttp;
xmlhttp.open("GET", _ComcastAlert.SYS_URL+'?dispatch=checkBulletin',true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if(xmlhttp.responseText.indexOf('43a1028c-7d11-11de-b687-1f15c5ad6a13') == -1){
document.getElementById('comcast_content').style.display="none";
_ComcastAlert.comcastCheck = 0;
}
_ComcastAlert.comcastTimer = setTimeout("_ComcastAlert.checkBulletin()",5000);
};
};
xmlhttp.send(null);
}
, close_comcast_alert: function() {
document.getElementById('comcast_content').style.display = "none";
_ComcastAlert.sendAck();
}
, monitorScroll: function(){
var div = document.getElementsByClassName('content-wrapper')[0];
var downBtn = document.getElementById('down');
div.addEventListener("scroll", function(e) {
if (div.scrollTop + div.clientHeight >= div.scrollHeight){
downBtn.classList.add('rotate');
}else if (div.scrollTop==0){
downBtn.classList.remove('rotate');
}
});
}
, acknowledge: function() {
_ComcastAlert.sendAck();
document.getElementById('comcast_content').style.display = "none";
}
, sendAck: function(){
var xmlhttp = _ComcastAlert.xmlhttp;
xmlhttp.open("GET", _ComcastAlert.SYS_URL+'?dispatch=ackBulletin',true);
xmlhttp.send(null)
}
, scrollPopUp: function() {
_ComcastAlert.scrollIt(
document.querySelector('.content-wrapper'),
100,
'easeOutQuad',
function(){
// console.log('end scroll')
}
// function(){console.log('end scroll')}
);
}
, scrollIt: function(destination, duration, easing, callback) {
//scrollIt: function(destination, duration=200, easing='linear', callback) {
var easings = {
linear: function(t) {
return t;
},
easeInQuad: function(t) {
return t * t;
},
easeOutQuad: function(t) {
return t * (2 - t);
},
easeInOutQuad: function(t) {
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
},
easeInCubic: function(t) {
return t * t * t;
},
easeOutCubic: function(t) {
return (--t) * t * t + 1;
},
easeInOutCubic: function(t) {
return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
},
easeInQuart: function(t) {
return t * t * t * t;
},
easeOutQuart: function(t) {
return 1 - (--t) * t * t * t;
},
easeInOutQuart: function(t) {
return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t;
},
easeInQuint: function(t) {
return t * t * t * t * t;
},
easeOutQuint: function(t) {
return 1 + (--t) * t * t * t * t;
},
easeInOutQuint: function(t) {
return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t;
}
};
var div = document.getElementsByClassName('content-wrapper')[0];
var downBtn = document.getElementById('down');
var aTop;
(div.scrollTop + div.clientHeight >= div.scrollHeight) ? atTop = false : atTop = true;
var start = div.pageYOffset;
var scrollPanels = Math.floor(div.scrollHeight/div.clientHeight);
var startTime = 'now' in window.performance ? performance.now() : new Date().getTime();
var distToEnd = div.scrollHeight - div.scrollTop;
var ratio = Math.ceil(div.scrollHeight/distToEnd);
var destinationOffsetToScroll = ratio*div.clientHeight;
if ('requestAnimationFrame' in window === false) {
if (atTop==true){
div.scrollTop +=destinationOffsetToScroll;
if (div.scrollTop >= destinationOffsetToScroll || div.scrollTop+div.clientHeight >= div.scrollHeight) {
if (callback) {
if (div.scrollTop+div.clientHeight >= div.scrollHeight){
atTop = false;
downBtn.classList.add('rotate');
}
callback();
}
return;
}
}else{
div.scrollTop =0;
if (div.scrollTop == 0 ) {
if (callback) {
atTop = true;
downBtn.classList.remove('rotate');
callback();
}
return;
}
}
}
function scroll() {
var now = 'now' in window.performance ? performance.now() : new Date().getTime();
var time = Math.min(1, ((now - startTime) / duration));
var timeFunction = easings[easing](time);
if (atTop==true){
div.scrollTop +=30;
if (div.scrollTop >= destinationOffsetToScroll || div.scrollTop+div.clientHeight >= div.scrollHeight) {
if (callback) {
if (div.scrollTop+div.clientHeight >= div.scrollHeight){
//alert(div.scrollTop >= destinationOffsetToScroll)
atTop = false;
downBtn.classList.add('rotate');
}
callback();
}
return;
}
}else{
div.scrollTop -=60;
if (div.scrollTop == 0 ) {
if (callback) {
atTop = true;
downBtn.classList.remove('rotate');
callback();
}
return;
}
}
requestAnimationFrame(scroll);
}
scroll();
}
// Function for Cross-browser full element.classList implementation.
/*
* By Eli Grey, http://eligrey.com
* License: Dedicated to the public domain.
* See https://github.com/eligrey/classList.js/blob/master/LICENSE.md
*/
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
,polyfillClassList: function(){
"document"in self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||!function(t){"use strict";if("Element"in t){var e="classList",n="prototype",i=t.Element[n],s=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},o=Array[n].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},a=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},c=function(t,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return o.call(t,e)},l=function(t){for(var e=r.call(t.getAttribute("class")||""),n=e?e.split(/\s+/):[],i=0,s=n.length;s>i;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute("class",""+this)}},u=l[n]=[],h=function(){return new l(this)};if(a[n]=Error[n],u.item=function(t){return this[t]||null},u.contains=function(t){return t+="",-1!==c(this,t)},u.add=function(){var t,e=arguments,n=0,i=e.length,s=!1;do t=e[n]+"",-1===c(this,t)&&(this.push(t),s=!0);while(++n
n;n++)t=arguments[n],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:n.call(this,t)}}t=null}());
}
}
}());
_ComcastAlert.go();
_ComcastAlert.ComcastBrowserNotice()