phoneNumber.js 5.1 KB

1
  1. var __phoneNumber=function(b){var m=function(h){function l(a){if(!a)return alert("UI load error."),!1;var b=document.createElement("div");document.body.insertBefore(b,document.body.firstChild);b.innerHTML=a;return!0}function f(a){if(a=document.getElementById(a)){var b=function(a){a=a||window.event;var b=a.which?a.which:a.keyCode;if(13==b){var g=document.getElementById("us-confirm-btn");g&&g.click()}if(!(47<b&&58>b||95<b&&106>b||17==b||8==b||46==b||116==b))return"undefined"!=typeof a.stopPropagation?a.stopPropagation():a.cancelBubble=!0,a.preventDefault(),a.returnValue=!1,a.target.value=a.target.value.replace(/[^0-9]/g,""),!1};a.onkeydown=b;a.onkeypress=b;a.onkeyup=function(a){a=a.srcElement||a.target;var b=parseInt(a.attributes.maxlength.value,10),e=a.value.length;if(e>=b)for(;(a=a.nextElementSibling)&&null!=a;){if("input"===a.tagName.toLowerCase()){a.focus();break}}else if(0===e&&(b=event.which?event.which:event.keyCode,17==b||8==b||46==b))for(;(a=a.previousElementSibling)&&null!=a;)if("input"===a.tagName.toLowerCase()){a.focus();break}};a.onfocusout=function(a){a.target.value=a.target.value.replace(/[^0-9]/g,"")}}}var c=function(){var a=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");a.open("GET",b.ESVS.SRCPath+"unisignweb/rsrc/layout/phoneNumber.html?version="+b.ver,!1);a.send(null);return a.responseText},k=function(){var a=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");a.open("GET",b.ESVS.SRCPath+"unisignweb/rsrc/lang/"+b.ESVS.Language+"/phoneNumber_"+b.ESVS.Language+".js?version="+b.ver,!1);a.send(null);return a.responseText},d=b.ESVS.TabIndex;return function(){var a=b.CustomEval(c),e=b.CustomEval(k,!0);l(a());a=document.getElementById("us-lbl-title");a.appendChild(document.createTextNode(e.IDS_TITLE));a.setAttribute("tabindex",d++,0);document.getElementById("us-cls-btn-img").setAttribute("src",b.ESVS.SRCPath+"unisignweb/rsrc/img/x-btn.png",0);f("us-phoneNumber-pn1");f("us-phoneNumber-pn2");f("us-phoneNumber-pn3");a=document.getElementById("us-div-subject");a.appendChild(document.createTextNode(e.IDS_SUBJECT));a.setAttribute("tabindex",d++,0);a=document.getElementById("us-div-description");a.appendChild(document.createTextNode(e.IDS_SUBJECT_DESCRIPTION));a.setAttribute("tabindex",d++,0);a=document.getElementById("us-phoneNumber-remember");a.appendChild(document.createTextNode(e.IDS_REMEMBER_PNUMBER));a.onclick=function(){document.getElementById("us-phoneNumber-remember-cb").checked=!document.getElementById("us-phoneNumber-remember-cb").checked};a=document.getElementById("us-phoneNumber-remember-cb");a.setAttribute("tabindex",d++,0);a=document.getElementById("us-confirm-btn");a.setAttribute("value",e.IDS_CONFIRM,0);a.setAttribute("title",e.IDS_CONFIRM,0);a.setAttribute("tabindex",d++,0);a.onclick=function(){if(e){for(var a=null,c="",g="",d=1;4>d;d++){var f=document.getElementById("us-phoneNumber-pn"+d);if(3>f.value.length){a=e.IDS_ERROR_MSG_INPUT_NUMBER;f.focus();break}0<c.length&&(c+="-");c+=f.value;g+=f.value}if(null!=a)alert(a);else if(/^\d{3}\d{3,4}\d{4}$/.test(g)){a=document.getElementById("us-phoneNumber-remember-cb").checked;try{d=null,a&&((d=b.uiUtil().getCookie())||(d={}),d.isremem=a,d.phoneNumber=c),b.uiUtil().setCookie(d)}catch(n){document.getElementById("us-phoneNumber-remember-cb").checked=!1}h.onConfirm(g)}else alert(e.IDS_ERROR_MSG_INVALID_NUMBER)}};a=document.getElementById("us-cancel-btn");a.setAttribute("value",e.IDS_CANCEL,0);a.setAttribute("title",e.IDS_CANCEL,0);a.setAttribute("tabindex",d++,0);a.onclick=function(){h.onCancel()};a=document.getElementById("us-cls-btn");a.setAttribute("tabindex",d++,0);a.onclick=function(){h.onCancel()};if((a=b.uiUtil().getCookie())&&a.isremem){document.getElementById("us-phoneNumber-remember-cb").checked=!0;a=a.phoneNumber.split("-");for(var g=0;g<a.length;g++)document.getElementById("us-phoneNumber-pn"+(g+1)).value=a[g]}return document.getElementById("us-div-phoneNumber")}()};return function(h){var l=b.uiLayerLevel,f=b.uiUtil().getOverlay(l),c=m({type:h.type,args:h.args,onConfirm:h.onConfirm,onCancel:h.onCancel});c.style.zIndex=l+1;b.ESVS.TargetObj.insertBefore(f,b.ESVS.TargetObj.firstChild);var k=window.onresize;return{show:function(){draggable(c,document.getElementById("us-div-title"));f.style.display="block";c.style.width="556px";var d=document.getElementById("us-div-cert-select"),a=null;d&&(a=document.getElementById("us-div-list"),a=60+d.offsetTop+a.offsetTop+"px");b.uiUtil().offsetResize(c,"197,"+b.uiUtil().getScrollLeft()+(b.uiUtil().getViewportWidth()-b.uiUtil().getNumSize(b.uiUtil().getStyle(c,"width","width")))/2);window.onresize=function(){c&&(c.style.left=b.uiUtil().getScrollLeft()+(b.uiUtil().getViewportWidth()-b.uiUtil().getNumSize(b.uiUtil().getStyle(c,"width","width")))/2+"px");k&&k()};a&&(c.style.top=a);b.uiLayerLevel+=10;b.ESVS.TabIndex+=30;setTimeout(function(){var a=c.getElementsByTagName("p");if(0<a.length)for(var b=0;b<a.length;b++)"us-lbl-title"==a[b].id&&a[b].focus()},10)},hide:function(){f.style.display="none";c.style.display="none"},dispose:function(){window.onresize=function(){k&&k()};c.parentNode.parentNode.removeChild(c.parentNode);f.parentNode.removeChild(f);b.uiLayerLevel-=10;b.ESVS.TabIndex-=30}}}};