/* Dialog helper function */ dojo.require("dojo.parser"); dojo.require("dijit.Dialog"); dojo.addOnLoad( function() { dojo.parser.parse(); }); //Provides String trim() if browser does not natively support it. if (!String.prototype.trim) { String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }; } function filterPhoneList(obj) { var targetList = document.getElementById("phone_list").getElementsByTagName("li"); var key = obj.value; for (var i=0; i -1 || key=="all") targetList[i].style.display = "inline"; else targetList[i].style.display = "none"; } } $(document).ready(function() { showhidephone = function(){ $(".choosestyle").show(); $(".choosemanu").show(); $(".STREAX54NC, .STZEZ250G, .STHUH226C, .STHUU240C, .STAVV10G, .Tablet, .Sims, .Phone").hide(); $("#phone_list li").not(".STREAX54NC").not(".STZEZ250G").not(".STHUU240C").not(".STHUH226C").not(".STAVV10G") .not(".Tablet").not(".Sims").not(".Phone").show(); $('.choosestyle li input[value="Home Alert"]').parent().hide(); $('.choosestyle li input[value="Hotspot"]').parent().hide(); $('.choosestyle li input[value="home wireless"]').parent().hide(); $('.choosestyle li input[value="bar"]').parent().hide(); $('.choosestyle li input[value="flip"]').parent().hide(); $('.choosestyle li input[value="qwerty"]').parent().hide(); $('.choosestyle li input[value="slide"]').parent().hide(); $(".device_type li input[type=radio]").change(function(){ $this = $(this).val(); if($this =="cell"){ $(".choosestyle").show(); $(".choosemanu").show(); } else { $(".choosestyle").hide(); $(".choosemanu").hide(); } }); } }); //document.ready function showPageDialog(link, classname, hideclosebutton) { var pageDialogId = "urlDrivenPageDialog"; //make sure widget hasn't already been registered dialogWidget = dijit.byId(pageDialogId); if (dialogWidget) { dialogWidget.destroy(); dialogWidget = null; } // set the content of the dialog: pageDialog = new dijit.Dialog({id:pageDialogId}); pageDialog.attr('title',''); pageDialog.attr('href',link); if (classname) pageDialog.attr('class', classname); pageDialog.show(); } function handlerFooterClick(event, elem) { event.preventDefault(); showPageDialog(elem.href); } function showTextDialog(text, classname, hideclosebutton) { var textDialogId = "textDialog"; //make sure widget hasn't already been registered dialogWidget = dijit.byId(textDialogId); if (dialogWidget) { dialogWidget.destroy(); dialogWidget = null; } var textDialog = new dijit.Dialog({id:textDialogId}); textDialog.startup(); textDialog.attr('title',''); textDialog.attr('content',text); if (classname) textDialog.attr('class', classname); textDialog.show(); } function showElementDialog(dojo_id, classname, hideclosebutton) { elem = dijit.byId(dojo_id); elem.attr('title',''); if (classname) elem.attr('class',classname); elem.show(); } function hideElementDialog(dialog_id) { dijit.byId(dialog_id).hide(); } function confirmedElementDialogNavigation(dialog_id, url) { dijit.byId(dialog_id).hide(); document.location.href = url ; } function showPaygoDlg(title, link) { var div_id = "paygo_popup"; loadXMLDoc(link, "paygo_popup_content"); resizeBackground(div_id) var popup = dojo.byId(div_id); if (popup != null) { popup.className = popup.className.replace("hide", ""); } resizePopup("paygo_popup_window"); } function showPageDlg(title, link) { showPageDialog(link); } function showHide(divId) { if(dojo.style(dojo.byId(divId), "display") == "none"){ dojo.style(dojo.byId(divId), "display", "block"); } else { dojo.style(dojo.byId(divId), "display", "none"); } } function numbersonly(e){ var unicode=e.charCode? e.charCode : e.keyCode; if ((unicode!=8)&&(unicode!= 9)){ //if the key isn't the backspace or tab key (which we should allow) if (unicode<48||unicode>57) //if not a number return false ; //disable key press } } function alpha(e) { var k = e.charCode? e.charCode : e.keyCode; return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8 || k == 9 || k == 32); } function letternumber(e) { var key; var keychar; if (window.event) key = window.event.keyCode; else if (e) key = e.charCode? e.charCode : e.keyCode; else return true; keychar = String.fromCharCode(key); keychar = keychar.toLowerCase(); // control keys if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) || (key==32)) return true; // alphas and numbers else if ((("abcdefghijklmnopqrstuvwxyz0123456789").indexOf(keychar) > -1)) return true; else return false; } function addressValidator(e) { var key; var keychar; if (window.event) key = window.event.keyCode; else if (e) key = e.charCode? e.charCode : e.keyCode; else return true; keychar = String.fromCharCode(key); keychar = keychar.toLowerCase(); // control keys if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) || (key==32)) return true; // alphas and numbers else if ((("abcdefghijklmnopqrstuvwxyz0123456789-.,").indexOf(keychar) > -1)) return true; else return false; } function addRemoveStagingCookie(cookieName){ var cookie = dojo.cookie(cookieName); if (cookie == null || cookie == 'null') { dojo.cookie(cookieName, 'true', {path: '/'}); } else { dojo.cookie(cookieName, null, {path: '/', expire: -1}); } } function limitlength(obj, length){ var maxlength=length ; if (obj.value.length>maxlength) obj.value=obj.value.substring(0, maxlength) ; } function isValidEsnValue(value) { var esnRegex = /(^\d{11}$)|(^\d{15}$)|(^\d{18}$)/g; return (value) ? !!value.match(esnRegex) : false; } function isValidPhoneValue(value) { var phoneRegex = /(^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$)|(^\d{10}$)/g; return (value) ? !!value.match(phoneRegex) : false; } function isValidZipValue(value) { var regex = /^\d{5}$/; return regex.test(value); } //ACME JS function change function validateEsnInputs(e) { var unicode=e.charCode? e.charCode : e.keyCode; if ((unicode!=8)&&(unicode!= 9)){ if ((unicode<48||unicode>57)&&(unicode<97||unicode>102)&&(unicode<65||unicode>70)){ return false; } } } function isValidEsnLength(value){ var esnRegex = /(^\w{11}$)|(^\w{14}$)|(^\w{15}$)|(^\w{18}$)|(^\w{19}$)|(^\w{20}$)|(^\w{21}$)/g; return (value) ? !!value.match(esnRegex) : false; } String.prototype.startsWith = function (arg) { return (this.match("^"+arg)==arg); }; function cleanPhoneNumber (number) { var result = String(number); if (result.startsWith("0") || result.startsWith("1")) { result = result.substring(1,result.length); } return result; } /* * Will remove non-hexadecimal characters from a string or from an object's 'value' property. * Returns the manipulated string or object. * All inputs that are not a string or an object (with a 'value' property of type string) are simply returned unaffected. */ function removeNonHexChars(item) { if (item && typeof item == 'object' && 'value' in item) { //Check if the 'value' property exists first. If we don't then the line below will create a 'value' property when one didn't exist before. item.value = removeNonHexChars(item.value); } else if (item && typeof item == 'string' && item != '') { if(item.match(/^[\w ]+$/) == null) { item = item.replace(/[\W]/g, ''); } item = item.replace(/\_/g, ''); item = item.replace(/ /g, ''); item = item.replace(/[G-Zg-z]/g,''); } return item; } function validateSimFormat(sim) { return /^890\d{15}(\d{2})?$/.test(sim); //Starts with 890 and is 18 or 20 digits long } function isValidPinFormat(pin) { return /^\d{15}$/.test(value); } function isAndroidNativeBrowser() { if (!("result" in isAndroidNativeBrowser)) { //Check if result is cached var nua = navigator.userAgent; isAndroidNativeBrowser.result = (nua.indexOf('Mozilla/5.0') > -1 && nua.indexOf('Android ') > -1 && nua.indexOf('AppleWebKit') > -1) && !(nua.indexOf('Chrome') > -1); } return isAndroidNativeBrowser.result; } function formatMinInput(input) { var contents = input.value; var phoneString = ""; var intCount = 0; for (var i = 0; i < contents.length; i++) { var c = contents.charAt(i); if (isFinite(parseInt(c))) { intCount++; if (!isAndroidNativeBrowser()) { if (intCount == 1) { phoneString = "("; } else if (intCount == 4) { phoneString += ") "; } else if (intCount == 7) { phoneString += "-"; } } phoneString += c; if (intCount == 10) { break; } } } input.value = phoneString; } $(function(){ //handle radio input selection functionality $('input[name="service_plans_id_selected"]').click(function(){ var tr = $(this).parent().parent(); $(tr).addClass('active'); $(tr).siblings().removeClass('active'); }); $('#plans tr').click(function(){ var radio = $(this).find('.radio'); $(radio).attr("checked", true).trigger('click'); }); //since tables are seperate we need to reset the color of the rows from the prev table when we click in a new table $('#plans #table1').click(function(){ $('#table2 tr').removeClass('active'); }); $('#plans #table2').click(function(){ $('#table1 tr').removeClass('active'); }); $('#plans .chevron').click(function(){ var panelbody = $(this).parent().parent().find('.panel-body'); var icon = $(this).find('.icon'); $(panelbody).slideToggle(200); if($(icon).hasClass('icon-chevron-up')) { $(icon).removeClass('icon-chevron-up'); $(icon).addClass('icon-chevron-down'); } else if ($(icon).hasClass('icon-chevron-down')){ $(icon).removeClass('icon-chevron-down'); $(icon).addClass('icon-chevron-up'); } }); });dojo.require("dojo.parser"); dojo.require("dijit.Dialog"); dojo.require("dijit.form.Button"); dojo.declare("Monitor", null ,{ _events : null, _idleTime : null, _timers : null, idleTime : null, constructor: function(time,timers){ Monitor.prototype.time=time; this._timers=timers; this.initObservers(); this.setTimer(); }, initObservers:function(){ dojo.forEach(this._events, function(e){ dojo.connect(e[0],e[1], function(event){ Monitor.prototype.onInterrupt(); }); }) }, onInterrupt:function(){ this.idleTime = new Date() - this._idleTime; dojo.publish("state:active", [this.idleTime]); this.setTimer(); }, setTimer: function(){ var oj = Monitor.prototype; this.clearTimers(); this._idleTime = new Date(); this._timers.push(setTimeout(function(){ dojo.publish("state:idle", null); },oj.time)); }, clearTimers: function(){ if(this._timers){ for (var i= 0;i < this._timers.length; i++) { clearTimeout(this._timers[i]); } } this._timers = new Array(); } }); var timerArray = new Array(); var timerMonitor; function sessionTimeoutFunctions(){ var timeout = 1650000; timerMonitor = new Monitor(timeout,timerArray); dojo.subscribe("state:active", null, onActive); dojo.subscribe("state:idle", null, onIdle); function onActive(args){ timerMonitor.clearTimers(); }; function onIdle(){ showPageDialog(timeout_content, 'cancel_dialog'); var countDown = setTimeout(updateCountdownTimer, 1000); }; }; function updateCountdownTimer() { var target = dojo.byId("countdownTimer"); if (target != null) { countDown(); } else { logoutNow(); } } function countDown() { var target = dojo.byId("countdownTimer"); var count = Number(target.innerHTML); var result = (count > 0) ? (count - 1) : 0; target.innerHTML = result; if (result == 0) { logoutNow(); } var decrement = setTimeout(countDown, 1000); } function extendSessionFunctions() { dijit.byId("urlDrivenPageDialog").destroy(); timerMonitor.onInterrupt(); } function logoutNow(){ window.location.href=logoutUrl; }(function(){ var _1=ibmCfg.portalConfig.contentHandlerURI+"?uri=menu:${id}"; var _2=false; var _3=function(){ return i$.hasClass(document.getElementsByTagName("body")[0],"edit-mode"); }; if(typeof wptheme==="undefined"||!wptheme){ wptheme={}; } i$.mash(wptheme,{getWindowIDFromSkin:function(_4){ while((_4=_4.parentNode)!=null){ if(i$.hasClass(_4,"component-control")){ var m=_4&&(_4.className||"").match(/id-([\S]+)/); return m&&m[1]; } } return null; },getPortletState:function(_5){ var _6=i$.byId("portletState"); if(_6){ if(!_6._cache){ _6._cache=i$.fromJson(_6.innerHTML); _6._cache._defaults={"windowState":"normal","portletMode":"view"}; } if(_6._cache[_5]){ return _6._cache[_5]; }else{ return _6._cache._defaults; } } return {}; },isValidOp:function(_7){ if(_7.visibility===false){ return false; } var _8=_7.metadata||{}; switch(_7.id){ case "ibm.portal.operations.changePortletMode": return wptheme.getPortletState(_8.wid).portletMode!=_8.portletMode; case "ibm.portal.operations.changeWindowState": return wptheme.getPortletState(_8.wid).windowState!=_8.windowState; default: } return true; },operation:{changeToHelpMode:function(_9){ var _a=window.location.href; if(_9.actionUrl){ if(_9.actionUrl.indexOf("?")==0){ var _b=_a.indexOf("#"); if(_b!=-1){ var _c=_a.substring(0,_b); var _d=_a.substring(_b); _a=_c+(_c.indexOf("?")==-1?"?":"&")+_9.actionUrl.substring(1); _a+=_d; }else{ _a+=(_a.indexOf("?")==-1?"?":"&")+_9.actionUrl.substring(1); } }else{ _a=_9.actionUrl; } } window.open(_a,"","resizable=yes,scrollbars=yes,menubar=no,toolbar=no,status=no,width=800,height=600,screenX=10,screenY=10,top=10,left=10"); }},contextMenu:{cache:{},css:{focus:"wpthemeMenuFocus",disabled:"wpthemeMenuDisabled",show:"wpthemeMenuShow",error:"wpthemeMenuError",menuTemplate:"wpthemeTemplateMenu",submenuTemplate:"wpthemeTemplateSubmenu",loadingTemplate:"wpthemeTemplateLoading"},init:function(_e,_f,_10){ _e._contextMenu=_e._contextMenu||{}; _e._contextMenu.id=_e._contextMenu.id||Math.round(Math.random()*1000000000); _e.setAttribute("id",_e._contextMenu.id); _e._contextMenu.menuId=_f; _e._contextMenu.jsonQuery=_10; var _11=_e._contextMenu; var _12=function(_13){ if(_13.displayMenu){ i$.addClass(i$.byId(_11.id),wptheme.contextMenu.css.show); var _14=i$.byId(_11.id)._firstSelectable; if(_14){ _14.focus(); i$.byId(_11.id)._currentSelected=_14; } } }; wptheme.contextMenu._initialize(_e).then(_12,_12); _e=null; },initSubmenu:function(_15,_16,_17){ _15._contextMenu=_15._contextMenu||{}; _15._contextMenu._submenu=true; _15._contextMenu._menuitemTemplate=_17._menuitemTemplate; _15._contextMenu._subMenuTemplate=_17._subMenuTemplate; _15._contextMenu._loadingTemplate=_17._loadingTemplate; wptheme.contextMenu.init(_15,_16,_17.jsonQuery); },_findFocusNode:function(_18){ var _19,i,_1a; var _1b=function(_1c,_1d){ var l=_1c.childNodes.length; for(i=0;i=0;i--){ _22=_24.childNodes[i]; if(i$.hasClass(_22,wptheme.contextMenu.css.menuTemplate)){ _1f=_22; continue; } if(i$.hasClass(_22,wptheme.contextMenu.css.submenuTemplate)){ _20=_22; continue; } if(i$.hasClass(_22,wptheme.contextMenu.css.loadingTemplate)){ _21=_22; continue; } if(_22.childNodes){ i=_23(_22,i); } } return _25; }; _23(_1e); return {"menu":_1f,"submenu":_20,"loading":_21}; },_invalidateCallback:function(){ wptheme.contextMenu.cache={}; },_initialize:function(_26){ var _27=true; var _28=_26._contextMenu; if(wptheme.contextMenu.cache[_28.id]||_28._inProgress){ return i$.promise.resolved({displayMenu:_27}); } _28._inProgress=true; i$.addListener("wptheme/contextMenu/invalidate/all",wptheme.contextMenu._invalidateCallback); var _29,_2a,tmp=i$.createDom("div"); if(_28._submenu){ tmp.innerHTML=_28._subMenuTemplate.replace(/\$\{submenu-id\}/g,_28.id+"_menu"); _26.appendChild(tmp.firstChild); _29=i$.byId(_28.id+"_menu"); _2a=i$.createDom("div"); _2a.innerHTML=_28._loadingTemplate; }else{ var _2b=wptheme.contextMenu._findNodes(_26); _29=_2b.menu; if(!_28._menuitemTemplate){ _28._menuitemTemplate=i$.trim(_29.innerHTML); } if(!_28._loadingTemplate){ _2a=i$.createDom("div"); _2a.appendChild(_2b.loading); _28._loadingTemplate=i$.trim(_2a.innerHTML); _2a=null; } _2a=i$.createDom("div"); _2a.innerHTML=_28._loadingTemplate; tmp.appendChild(_2b.submenu.cloneNode(true)); if(!_28._subMenuTemplate){ _28._subMenuTemplate=i$.trim(tmp.innerHTML); } } while(_29.firstChild){ _29.removeChild(_29.firstChild); } _29.appendChild(_2a); i$.addClass(_26,wptheme.contextMenu.css.show); i$.bindDomEvt(i$.byId(_28.id),"onmouseleave",function(){ if(_28._inProgress){ _27=false; } var _2c=i$.byId(_28.id); i$.removeClass(_2c,wptheme.contextMenu.css.show); if(!_28.activeAction){ var _2d=_2c._currentSelected; if(_2d){ _2d.blur(); } var _2e=wptheme.contextMenu._findFocusNode(_2c); ((_2e)?_2e:_2c).focus(); } }); return wptheme.contextMenu._load(_28).then(function(_2f){ var _30=wptheme.contextMenu._parseData(_2f).then(function(_31){ _31=wptheme.contextMenu._filterMenu(_31); if(!_31||_31.length==0){ var tmp=i$.createDom("div"); tmp.innerHTML=wptheme.contextMenu._fromTemplate(_28._menuitemTemplate,wptheme.contextMenu.css.error,"No items to display."); while(_29.firstChild){ _29.removeChild(_29.firstChild); } _29.appendChild(tmp); }else{ wptheme.contextMenu._buildMenu(_28,_29,_31); } _28._inProgress=false; wptheme.contextMenu.cache[_28.id]=true; return {displayMenu:_27}; }); return _30; },function(){ var tmp=i$.createDom("div"); tmp.innerHTML=wptheme.contextMenu._fromTemplate(_28._menuitemTemplate,wptheme.contextMenu.css.error,"Error happened while loading the menu."); while(_29.firstChild){ _29.removeChild(_29.firstChild); } _29.appendChild(tmp); _28._inProgress=false; wptheme.contextMenu.cache[_28.id]=true; return {displayMenu:_27}; }); },_load:function(_32){ var _33=_1.replace(/\$\{id\}/g,_32.menuId); if(_32.jsonQuery){ _33+=(_33.indexOf("?")==-1?"?":"&")+i$.toQuery(_32.jsonQuery); } return i$.xhrGet({url:_33,headers:{"X-IBM-XHR":"true"},responseType:"json"}).then(function(_34){ return _34.data; },function(_35){ var _36=_35.xhr.getResponseHeader("Content-Type")||""; if((_36.indexOf("text/html")==0)||(_35.xhr.status==401)){ window.setTimeout(function(){ document.location.reload(); },0); } console.log("Error trying to load the context menu feed for '"+_32.menuId+"': "+_35); return null; }); },_parseData:function(_37){ var _38=[]; i$.each(_37,function(_39){ var _3a=i$.fromPath("moduleInfo.deferred",false,_39)?i$.modules.loadDeferred():i$.promise.resolved(true); _38.push(_3a.then(function(){ var _3b=wptheme.contextMenu._checkFunction(_39,_39.visibilityFn,_39,(typeof _39.visibility!="undefined")?_39.visibility:true); var _3c=wptheme.contextMenu._checkFunction(_39,_39.enableFn,_39,(typeof _39.enabled!="undefined")?_39.enabled:true); return i$.whenAll(_3b,_3c).then(function(_3d){ _39._visible=_3d[0]; _39._enabled=_3d[1]; return _39; }); })); }); return i$.whenAll.apply(i$,_38); },_filterMenu:function(_3e){ var _3f=[],_40,_41={"type":"Separator"}; for(var i=_3e.length-1;i>=0;i--){ _40=_3e[i]; if(!_40._visible){ continue; } if(_40.type=="Separator"){ if(_41.type=="Separator"){ continue; } }else{ if(_40.type=="Header"){ if((_41.type=="Separator")||(_41.type=="Header")){ continue; } } } _41=_40; _3f.unshift(_40); } while(_3f.length>0&&_3f[0].type=="Separator"){ _3f=_3f.slice(1); } return _3f; },_buildMenu:function(_42,_43,_44){ var _45=document.createDocumentFragment(),tmp=i$.createDom("div"),_46,_47,_48,_49; for(var i=0,l=_44.length;i