Advertisement
Guest User

ComcastAlert

a guest
Oct 25th, 2013
823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Comcast Cable Communications, LLC Proprietary. Copyright 2013.
  2. // Intended use is to display browser notifications for critical and time sensitive alerts.
  3. var _ComcastAlert = (function(){
  4.     return {
  5.         SYS_URL: '/e8f6b078-0f35-11de-85c5-efc5ef23aa1f/aupm/notify.do'
  6.         , dragObj: {zIndex: 9999}
  7.         , browser: null
  8.         , comcastCheck: 1
  9.         , comcastTimer: null
  10.         , xmlhttp: null
  11.        
  12.         , go: function(){
  13.             if(self.location !== top.location) return;
  14.             if(document.body){
  15.                 _ComcastAlert.MyDeviceOwnedAlert();
  16.                 _ComcastAlert.browser = _ComcastAlert.checkBrowser();
  17.                 _ComcastAlert.getXmlhttp();
  18.                 _ComcastAlert.checkBulletin();
  19.                 return _ComcastAlert;
  20.             }else{
  21.                 setTimeout(_ComcastAlert.go, 200);
  22.             }
  23.         }
  24.  
  25.         , MyDeviceOwnedAlert: function(){
  26.             var image_url = 'http://servicealerts.comcast.net:8080/images/mydevicealert/browser/';
  27. //          var mydeviceDeviceAlertDate = 'Wednesday 30-OCT-2013';
  28.             var mydeviceDeviceAlertDate = 'Tuesday 19-NOV-2013';
  29. //          var mydeviceDeviceAlertDate = 'Tuesday 10-DEC-2013';
  30. //          var myDeviceAlertAnalytics = 'mydevicealert_owned_cd.png?';
  31.             var myDeviceAlertAnalytics = 'mydevicealert_owned_ned.png?';
  32. //          var myDeviceAlertAnalytics = 'mydevicealert_owned_wd.png?';
  33.             var winObj = {
  34.                 image_url: image_url
  35.                 , myDeviceAlertAnalytics: myDeviceAlertAnalytics
  36.                 , mydeviceDeviceAlertDate: mydeviceDeviceAlertDate
  37.                 , headertext1: '<strong>XFINITY Internet Service Reminder</strong>'
  38.                 , textline1:  '<b>Hello, Comcast Customer!</b>'
  39.                 , textline2:  'As of <b>' + mydeviceDeviceAlertDate + '</b>, your cable modem will no longer be able to operate on Comcast&#39;s network.'
  40.                 , textline3:  '<b>To avoid service interruption, please immediately make arrangements to replace your modem using one of the convenient modem replacement options available to you:</b>'
  41.                 , textline4:  'Visit a retailer to purchase a new cable modem.  You may visit  <a href=\"#\" onClick="document.location.href=\'' + this.SYS_URL + '?dispatch=ackBulletinRedirectSleep&redirectName=mydevicealert\'">http://mydeviceinfo.comcast.net</a> for a list of modems certified to work on our network'
  42.                 , textline5:  'Arrange to lease a cable modem by calling 1-800-XFINITY.'
  43.                 , textline6:  'Please properly recycle your older modem by following the instructions provided in the letter we mailed to you.'
  44.                 , textline7:  'If you have any questions, please chat with us online at <a href="https://www.comcastsupport.com/EOS-EOL" target="_new">https://www.comcastsupport.com/EOS-EOL</a>.'
  45.                 , privacystatement:  '<a style="text-decoration: underline; "href="http://xfinity.comcast.net/privacy/2012-03/" target="_new">PRIVACY STATEMENT</a>'
  46.  
  47.             };
  48.             this.createWindow(winObj);
  49.         }              
  50.        
  51.         , createWindow: function(winObj){
  52.             var html = '<style type="text/css">';
  53.             html += '#comcast_content {width: 650px; height:500px; box-shadow: 10px 10px 5px #888; background: #fff; border: 1px solid #454545; position:absolute; top:50px; left:100px; zoom:1; z-index: 9999999; opacity:0.99; filter:alpha(opacity=99);}';
  54.             html += '#comcast_content .header {height: 30px; background-color:rgb(220,220,220); repeat-x;}';
  55.             html += '#comcast_content .a {color: #00a3e0;}';
  56.             html += '#comcast_content .logo {float:left;}';
  57.             html += '#comcast_content .closebn {float:right; text-decoration: none; margin: 9px 10px 0 0; font: 15px/16px bold Arial, Helvetica, sans-serif; color: #2ca4e3;}';
  58.             html += '#comcast_content .content-wrapper {padding-left: 18px; padding-right: 15px; padding-bottom: 12px;}';
  59.             html += '#comcast_content .headerimage { margin-top: 15px;}';
  60.             html += '#comcast_content .header1 {margin: 18px 0 0 0; color: #DD1524; padding: 0; font: 24px/26px bold Arial, Helvetica, sans-serif;}';
  61.             html += '#comcast_content .textcontent {margin: 10px 10px 0 0; color: #303030; word-spacing: 1px; font: 15px/16px Arial, Helvetica, sans-serif; line-height: 1.50;}';
  62.             html += '#comcast_content .acknowledge {padding-top:3px; text-align: center;}';
  63.             html += '#comcast_content .bulletcontent li {list-style-type:disc; list-style-position:outside; color: #303030; padding-left: 0.1em; margin: 10px 10px 10px 10px; font: 14px/15px Arial, Helvetica, sans-serif; line-height:1.50;}';
  64.             html += '#comcast_content .how-do-i {float:left; position:absolute; bottom:20px; left:18px; margin: 12px 0 0 0; font: 13px/14px bold Arial, Helvetica, sans-serif; text-align: bottom;}';
  65.             html += '#comcast_content .comcast-logo {float:right; position:absolute; bottom:5px; right:5px; padding-top:10px; text-align: right;}';
  66.             html += '#comcast_content .privacystatement {float:left; position:absolute; bottom:10px; left:20px; margin: 12px 0 0 0; font: 13px/14px sans-serif; text-align: bottom;}';
  67.             html += '</style>';
  68.             html += '<div class="main-wrapper" id="comcast_content">';
  69.             html += '<div class="header" onmousedown="javascript:_ComcastAlert.dragStart(event,\'comcast_content\')">';
  70.             html += '<img src="' + winObj.image_url + 'xfinity-logo.png" height="30" width="84" alt="Comcast" class="logo" />';
  71.             html += '<a href=\"#\" onClick=\"javascript:_ComcastAlert.close_comcast_alert()\" class="closebn"><b>CLOSE X</b></a>';
  72.             html += '</div>';
  73.             html += '<div class="content-wrapper">';
  74.             html += '<p class="header1">';
  75.             html += winObj.headertext1;
  76.             html += '</p>';
  77.             html += '<p class="textcontent">';
  78.             html += winObj.textline1;
  79.             html += '</p>';
  80.             html += '<p class="textcontent">';
  81.             html += winObj.textline2;
  82.             html += '</p>';
  83.             html += '<p class="textcontent">';
  84.             html += winObj.textline3;
  85.             html += '</p>';
  86.             html += '<ul class="bulletcontent">';
  87.             html += '<li>';
  88.             html += winObj.textline4;
  89.             html += '</li>';
  90.             html += '<li>';
  91.             html += winObj.textline5;
  92.             html += '</li>';
  93.             html += '</ul>';
  94.             html += '<p class="textcontent">';
  95.             html += winObj.textline6;
  96.             html += '</p>';
  97.             html += '<p class="textcontent">';
  98.             html += winObj.textline7;
  99.             html += '</p>';
  100.             html += '<div class="privacystatement">';
  101.             html += winObj.privacystatement;
  102.             html += '</div>';
  103.             html += '<div class="comcast-logo">';
  104.             html += '<img src="' + winObj.image_url + winObj.myDeviceAlertAnalytics + _ComcastAlert.comcastContentnoCache() + '"  width="1" height="1">';
  105.             html += '<img src="' + winObj.image_url + 'comcast-logo.png" height="50" width="115" alt="Message by Comcast"/>';
  106.             html += '</div>';
  107.             html += '</div>';
  108.             html += '</div>';
  109.             html += '</div>';
  110.             document.body.innerHTML = document.body.innerHTML + html;
  111.         }
  112.        
  113.         // Function to Determine browser and version. Copyright 2001 by Mike Hall.
  114.         // See http://www.brainjar.com for terms of use.
  115.         , checkBrowser: function() {
  116.             var ua, s, i;
  117.             var browser = {
  118.                 isIE: false
  119.                 , isNS: false
  120.                 , version: null
  121.             };
  122.             ua = navigator.userAgent;  
  123.             s = "MSIE";
  124.             if ((i = ua.indexOf(s)) >= 1) {
  125.                 browser.isIE = true; browser.version = parseFloat(ua.substr(i + s.length));
  126.             }  
  127.             s = "Netscape6/";
  128.             if ((i = ua.indexOf(s)) >= 0) {
  129.                 browser.isNS = true; browser.version = parseFloat(ua.substr(i + s.length));
  130.             }  
  131.             s = "Gecko";
  132.             if ((i = ua.indexOf(s)) >= 0) {
  133.                 browser.isNS = true; browser.version = 6.1;
  134.             }
  135.             return browser;
  136.         }
  137.                      
  138.         , dragStart: function(event, id) {
  139.             var browser1 = _ComcastAlert.browser;
  140.             var dragObj = _ComcastAlert.dragObj;
  141.             var el;
  142.             var x, y;  
  143.             if (id) dragObj.elNode = document.getElementById(id);
  144.             else {
  145.                 if (browser1.isIE) dragObj.elNode = window.event.srcElement;
  146.                 if (browser1.isNS) dragObj.elNode = event.target;  
  147.                 if (dragObj.elNode.nodeType == 3) dragObj.elNode = dragObj.elNode.parentNode;
  148.             }  
  149.             if (browser1.isIE) {
  150.                 x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
  151.                 y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
  152.             }
  153.             if (browser1.isNS) {
  154.                 x = event.clientX + window.scrollX;
  155.                 y = event.clientY + window.scrollY;
  156.             }  
  157.             dragObj.cursorStartX = x;
  158.             dragObj.cursorStartY = y;
  159.             dragObj.elStartLeft = parseInt(dragObj.elNode.style.left, 10);
  160.             dragObj.elStartTop  = parseInt(dragObj.elNode.style.top, 10);  
  161.             if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 100;
  162.             if (isNaN(dragObj.elStartTop)) dragObj.elStartTop = 50;    
  163.             if (browser1.isIE) {
  164.                 document.attachEvent("onmousemove", _ComcastAlert.dragGo);
  165.                 document.attachEvent("onmouseup",  _ComcastAlert.dragStop);
  166.                 window.event.cancelBubble = true;
  167.                 window.event.returnValue = false; }
  168.             if (browser1.isNS) {
  169.                 document.addEventListener("mousemove", _ComcastAlert.dragGo,  true);
  170.                 document.addEventListener("mouseup",  _ComcastAlert.dragStop, true);
  171.                 event.preventDefault();
  172.             }
  173.         }  
  174.            
  175.             // End Function
  176.            
  177.         , comcastContentnoCache: function() {
  178.                return Math.round(Math.random() * 103050709);
  179.                 }      
  180.                
  181.         , dragGo: function(event) {
  182.             var browser1 = _ComcastAlert.browser;
  183.             var dragObj = _ComcastAlert.dragObj;
  184.             var x, y;  
  185.             if (browser1.isIE) {
  186.                 x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
  187.                 y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
  188.             }
  189.             if (browser1.isNS) {
  190.                 x = event.clientX + window.scrollX; y = event.clientY + window.scrollY;
  191.             }  
  192.             dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  193.             dragObj.elNode.style.top = (dragObj.elStartTop + y - dragObj.cursorStartY) + "px";  
  194.             if (browser1.isIE) { window.event.cancelBubble = true; window.event.returnValue = false; }
  195.             if (browser1.isNS) event.preventDefault();
  196.         }  
  197.            
  198.         , dragStop: function(event) {
  199.             var browser1 = _ComcastAlert.browser;
  200.             if (browser1.isIE) {
  201.                 document.detachEvent("onmousemove", _ComcastAlert.dragGo);
  202.                 document.detachEvent("onmouseup",  _ComcastAlert.dragStop);
  203.             }
  204.             if (browser1.isNS) {
  205.                 document.removeEventListener("mousemove", _ComcastAlert.dragGo,  true);
  206.                 document.removeEventListener("mouseup",  _ComcastAlert.dragStop, true);
  207.             }
  208.         }
  209.        
  210.         , getXmlhttp: function(){
  211.             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 @*/
  212.             if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  213.                 try {
  214.                     xmlhttp = new XMLHttpRequest();
  215.                 } catch (e) {
  216.                     xmlhttp=false;
  217.                 }
  218.             }
  219.             if (!xmlhttp && window.createRequest) {
  220.                 try {
  221.                     xmlhttp = window.createRequest();
  222.                 } catch (e) {
  223.                     xmlhttp=false;
  224.                 }
  225.             }
  226.             this.xmlhttp = xmlhttp;
  227.         }
  228.        
  229.         , checkBulletin: function(){
  230.             if(_ComcastAlert.comcastCheck==0) { return; }
  231.             var xmlhttp = _ComcastAlert.xmlhttp;
  232.             xmlhttp.open("GET", _ComcastAlert.SYS_URL+'?dispatch=checkBulletin',true);
  233.             xmlhttp.onreadystatechange = function() {
  234.                 if (xmlhttp.readyState == 4) {
  235.                     if(xmlhttp.responseText.indexOf('43a1028c-7d11-11de-b687-1f15c5ad6a13') == -1){
  236.                         document.getElementById('comcast_content').style.display="none";
  237.                         _ComcastAlert.comcastCheck = 0;
  238.                     }
  239.                     _ComcastAlert.comcastTimer = setTimeout("_ComcastAlert.checkBulletin()",5000);
  240.                 };
  241.             };
  242.             xmlhttp.send(null);
  243.         }
  244.        
  245.         , sendAck: function(){
  246.             var xmlhttp = _ComcastAlert.xmlhttp;
  247.             xmlhttp.open("GET", _ComcastAlert.SYS_URL+'?dispatch=ackBulletin',true);
  248.             xmlhttp.send(null)
  249.         }
  250.        
  251.         , close_comcast_alert: function() {
  252.             document.getElementById('comcast_content').style.display = "none";
  253.             _ComcastAlert.sendAck();  
  254.         }  
  255.        
  256.     }
  257. }());
  258.    
  259. _ComcastAlert.go();
  260. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement