mobileselect.js 5.5 KB

1
  1. var __mobileselect=function(b){var t=function(k){function p(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 l(a){var b=["cloudsign","mobilephone"];q=a;for(var c in b)a==c?document.getElementById("us-btn-storage-"+b[c])&&(document.getElementById("us-btn-storage-"+b[c]).className="us-layout-storage-btn-on"):document.getElementById("us-btn-storage-"+b[c])&&(document.getElementById("us-btn-storage-"+b[c]).className="us-layout-storage-btn-off")}function g(a){if(null==a||void 0==a)return!1;var f=!b.uiUtil().isItSupportingThisStorage(a);0==f&&null!=b.ESVS.Media&&null!=b.ESVS.Media.list&&0>b.ESVS.Media.list.indexOf(a.name)&&(f=!0);if(f)return!1;f=document.getElementById("us-btn-mobile-btn-list");var c=document.createElement("li");c.setAttribute("id","us-mobile-btn-li-"+a.name,0);c.setAttribute("mediaIndex",a.mediaIndex,0);7==a.mediaIndex&&(c.className="line-first");"hidden"===a.visibility?(c.style.display="none",c.style.visibility="hidden"):(c.style.display="block",c.style.visibility="visible");var e=document.createElement("button");e.setAttribute("type","button",0);e.setAttribute("id","us-btn-storage-"+a.name,0);e.setAttribute("title",a.label,0);e.setAttribute("tabindex",a.tabIndex,0);a.disabled?(e.onclick=function(){b.uiUtil().msgBox(h.IDS_MSGBOX_NOT_SUPPORTED_MEDIA)},e.className="us-layout-storage-btn-none"):(e.onclick=a.onclick,e.className="us-layout-storage-btn-off");c.appendChild(e);if(!b.ESVS.chkEXESetup&&"browsersign"!==a.name&&"qrcode"!==a.name){var d=document.createElement("span");d.className="us-download-select";e.appendChild(d)}d=document.createElement("span");d.className="us-img-storage";var g=document.createElement("img");g.setAttribute("id","us-img-mobile-"+a.name,0);g.setAttribute("alt",a.label,0);a.disabled?g.setAttribute("src",b.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+a.name+"_d.png",0):g.setAttribute("src",b.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+a.name+".png",0);d.appendChild(g);e.appendChild(d);d=document.createElement("span");d.setAttribute("id","us-lbl-mobile-"+a.name,0);d.className="us-layout-lbl-storage";d.appendChild(document.createTextNode(a.label));e.appendChild(d);c.appendChild(e);f.appendChild(c);return!0}var m=function(){var a=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");a.open("GET",b.ESVS.SRCPath+"unisignweb/rsrc/layout/mobileselect.html?version="+b.ver,!1);a.send(null);return a.responseText},r=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+"/mobileselect_"+b.ESVS.Language+".js?version="+b.ver,!1);a.send(null);return a.responseText},h=b.CustomEval(r,!0),n=b.ESVS.TabIndex,q=null;return function(){var a=b.CustomEval(m),f=b.CustomEval(r,!0);p(a());var c=document.getElementById("us-mobile-select-lbl-title");c.appendChild(document.createTextNode(f.IDS_STORAGE_SELECTION));c.setAttribute("tabindex",n++,0);document.getElementById("us-mobile-select-cls-btn-img").setAttribute("src",b.ESVS.SRCPath+"unisignweb/rsrc/img/x-btn.png",0);a=b.CONST.medias.cloudsign;a.label=f.IDS_STORAGE_CLOUDSIGN;a.onclick=function(){l(0)};a.tabIndex=n++;a.mediaIndex=1;a.visibility="visible";g(a);a=b.CONST.medias.mobilephone;a.label=f.IDS_STORAGE_MOBILEPHONE;a.onclick=function(){l(1)};a.tabIndex=n++;a.mediaIndex=2;a.visibility="visible";g(a);var e=document.getElementById("us-mobile-select-confirm-btn");e.setAttribute("value",f.IDS_CONFIRM,0);e.setAttribute("title",f.IDS_CONFIRM+f.IDS_BUTTON,0);e.setAttribute("tabindex",n++,0);e.onclick=function(){if(null==q)alert(f.IDS_MSGBOX_ERROR_PLEASE_SELECT_STORAGE);else k.onConfirm(q)};var d=document.getElementById("us-mobile-select-cancel-btn");d.setAttribute("value",f.IDS_CANCEL,0);d.setAttribute("title",f.IDS_CANCEL+f.IDS_BUTTON,0);d.setAttribute("tabindex",n++,0);d.onclick=function(){k.onCancel()};a=document.getElementById("us-mobile-select-cls-img-btn");a.setAttribute("title",f.IDS_STORAGE_SELECTION_CLOSE,0);a.setAttribute("tabindex",n++,0);a.onclick=function(){k.onCancel()};d.onkeydown=function(a){a=a||window.event;var b=a.which||a.keyCode;9==b&&a.shiftKey&&(d.onblur=function(){setTimeout(function(){e.focus()},10)});9!=b||a.shiftKey||(d.onblur=function(){setTimeout(function(){c.focus()},10)})};var h=!1;c.onkeyup=function(a){a=a||window.event;9==(a.which||a.keyCode)&&a.shiftKey&&h&&(h=!1,setTimeout(function(){d.focus()},10))};c.onkeydown=function(a){a=a||window.event;if(9==(a.which||a.keyCode)&&a.shiftKey)return a.cancelBubble=!0,h=a.returnValue=!0,!1};return document.getElementById("us-div-mobile-select")}()};return function(k){var p=b.uiLayerLevel,l=b.uiUtil().getOverlay(p),g=t({type:k.type,args:k.args,onConfirm:k.onConfirm,onCancel:k.onCancel});g.style.zIndex=p+1;b.ESVS.TargetObj.insertBefore(l,b.ESVS.TargetObj.firstChild);var m=window.onresize;return{show:function(){b.ActiveUI=this;draggable(g,document.getElementById("us-div-mobile-select-title"));l.style.display="block";b.uiUtil().offsetResize(g);window.onresize=function(){b.uiUtil().offsetResize(g);m&&m()};b.uiLayerLevel+=10;b.ESVS.TabIndex+=30;setTimeout(function(){var b=g.getElementsByTagName("p");if(0<b.length)for(var h=0;h<b.length;h++)"us-mobile-select-lbl-title"==b[h].id&&b[h].focus()},10)},hide:function(){l.style.display="none";g.style.display="none"},dispose:function(){window.onresize=function(){m&&m()};g.parentNode.parentNode.removeChild(g.parentNode);l.parentNode.removeChild(l);b.uiLayerLevel-=10;b.ESVS.TabIndex-=30}}}};