filesbox/web/dist/design/designstatic/common/js/userMobile.js

3 lines
101 KiB
JavaScript
Raw Permalink Normal View History

2024-07-26 06:10:54 +00:00
var Ce=(o,d,a)=>new Promise((r,i)=>{var e=n=>{try{s(a.next(n))}catch(l){i(l)}},t=n=>{try{s(a.throw(n))}catch(l){i(l)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(e,t);s((a=a.apply(o,d)).next())});(function(o,d){window.tsnfors=getPar("targetServerNameForOverride")||getPar("host")?"?targetServerNameForOverride="+(getPar("targetServerNameForOverride")||getPar("host")):"",d.user={getQueryRetailId:function(a){for(var r=window.location.search.substring(1),i=r.split("&"),e=0;e<i.length;e++){var t=i[e];if(t.indexOf("diliater=")==0)return a?t.replace(/diliater=/,""):decrypt(t.replace(/diliater=/,"")).split(",")}return""},isWeiXin:function(){var a=window.navigator.userAgent.toLowerCase();return a.match(/MicroMessenger/i)=="micromessenger"},isOpenWxLogin:function(){var a=window.roominfo,r=(a==null?void 0:a.thirdLoginType)||"";return parseInt(a==null?void 0:a.isThirdLogin)==1&&r.indexOf("wechat")>-1},changeSearch:function(a){var r=this;return!!(a&&r.isIOS()&&r.getQueryRetailId(location.href)!=a&&location.href.indexOf("/pages/wap/bundle.html")<0&&r.isWeiXin()&&location.href.indexOf("/shop/item.html")<0&&location.href.indexOf("/gallery/item.html")<0)},saveRetailId:function(){var a=this,r=location.origin,i=location.pathname;if(a.getQueryRetailId(!0))window.localStorage.encryptId=a.getQueryRetailId(!0),window.sessionStorage.encryptId=a.getQueryRetailId(!0);else if(location.href.indexOf("myroom")<0&&location.href.indexOf("aroom")<0&&location.href.indexOf("/views/")<0&&location.href.indexOf("/pay/")<0){var e=a.clearRetailId(location.search),t=window.localStorage.encryptId||window.sessionStorage.encryptId,s=r+i+(t?e?e+"&diliater="+t:"?diliater="+t:e);a.changeSearch(t)?location.search=e?e+"&diliater="+t:"?diliater="+t:history.replaceState({},"",s)}},clearRetailId:function(a){for(var r=a.split("&"),i="",e=0,t=r.length;e<t;e++){var s=r[e];s.indexOf("?diliater=")>-1?e+1!==t&&(i+="?"):s.indexOf("diliater=")==0||(i+=i&&i!="?"?"&"+s:s)}return i},isIOS9:function(){var a=function(){var e=/OS ((\d+_?){2,3})\s/;if(navigator.userAgent.match(/iPad/i)||navigator.platform.match(/iPad/i)||navigator.userAgent.match(/iP(hone|od)/i)||navigator.platform.match(/iP(hone|od)/i)){var t=e.exec(navigator.userAgent);if(t.length>0)return t[0].replace("OS","").replace("os","").replace(/\s+/g,"").replace(/_/g,".")}return""},r=a(),i=r.split(".");return!!(i&&i.length>0&&parseInt(i[0])==9)},isIOS13:function(){var a=function(){var e=/OS ((\d+_?){2,3})\s/;if(navigator.userAgent.match(/iPad/i)||navigator.platform.match(/iPad/i)||navigator.userAgent.match(/iP(hone|od)/i)||navigator.platform.match(/iP(hone|od)/i)){var t=e.exec(navigator.userAgent);if(t.length>0)return t[0].replace("OS","").replace("os","").replace(/\s+/g,"").replace(/_/g,".")}return""},r=a(),i=r.split(".");return!!(i&&i.length>0&&parseInt(i[0])==13)},isIOS:function(){var a=navigator.userAgent,r=!!a.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return r},createRetailId:function(a){for(var r=this,i=location.origin,e=location.pathname,t=a.userId,s=r.getQueryRetailId()||decrypt&&(window.localStorage.encryptId||window.sessionStorage.encryptId)&&decrypt(window.localStorage.encryptId||window.sessionStorage.encryptId).split(",")||[],n=t?[t]:[],l=0,c=s.length;l<c;l++){var f=s[l];f&&t!=f&&n.length<4&&n.push(f)}var p=encrypt(n.join(","));window.localStorage.encryptId=p,window.sessionStorage.encryptId=p;var v=r.clearRetailId(location.search),m=i+e+(v?v+"&diliater="+p:"?diliater="+p);location.href.indexOf("myroom")<0&&location.href.indexOf("aroom")<0&&location.href.indexOf("/views/")<0&&location.href.indexOf("/pay/")<0&&(r.changeSearch(p)?location.search=v?v+"&diliater="+p:"?diliater="+p:history.replaceState({},"",m))},funcUrlDel:function(a){var r=window.location,i=r.origin+r.pathname+"?",e=r.search.substr(1);if(e.indexOf(a)>-1){for(var t={},s=e.split("&"),n=0;n<s.length;n++)s[n]=s[n].split("="),t[s[n][0]]=s[n][1];delete t[a];var l=i+JSON.stringify(t).replace(/[\"\{\}]/g,"").replace(/\:/g,"=").replace(/\,/g,"&");return l}},clearUrlRetailId:function(){var a=this;window.localStorage.encryptId="",window.sessionStorage.enc
`);for(var i="",e=0;e<r.length;e++){var t=r.charCodeAt(e);t<128?i+=String.fromCharCode(t):t>127&&t<2048?(i+=String.fromCharCode(t>>6|192),i+=String.fromCharCode(t&63|128)):(i+=String.fromCharCode(t>>12|224),i+=String.fromCharCode(t>>6&63|128),i+=String.fromCharCode(t&63|128))}return i},a=function(r){for(var i="",e=0,t=0,s=0,n=0,l=0;e<r.length;)t=r.charCodeAt(e),t<128?(i+=String.fromCharCode(t),e++):t>191&&t<224?(n=r.charCodeAt(e+1),i+=String.fromCharCode((t&31)<<6|n&63),e+=2):(n=r.charCodeAt(e+1),l=r.charCodeAt(e+2),i+=String.fromCharCode((t&15)<<12|(n&63)<<6|l&63),e+=3);return i}}(function(o,d){var a=4;function r(s){if(this.options={id:"",canvasId:"verifyCanvas",width:"100",height:"30",type:"blend",code:""},Object.prototype.toString.call(s)=="[object Object]")for(var n in s)this.options[n]=s[n];else this.options.id=s;this.options.numArr="0,1,2,3,4,5,6,7,8,9".split(","),this.options.letterArr=i(),this._init(),this.refresh()}r.prototype={version:"1.0.0",_init:function(){var s=d.getElementById(this.options.id),n=d.createElement("canvas");this.options.width=s.offsetWidth>0?s.offsetWidth:"100",this.options.height=s.offsetHeight>0?s.offsetHeight:"30",n.id=this.options.canvasId,n.width=this.options.width,n.height=this.options.height,n.style.cursor="pointer",n.innerHTML="\u60A8\u7684\u6D4F\u89C8\u5668\u7248\u672C\u4E0D\u652F\u6301canvas",s.appendChild(n);var l=this;n.onclick=function(){l.refresh()}},refresh:function(){this.options.code="";var s=d.getElementById(this.options.canvasId);if(s.getContext)var n=s.getContext("2d");else return;if(n.textBaseline="middle",n.fillStyle=t(180,240),n.fillRect(0,0,this.options.width,this.options.height),this.options.type=="blend")var l=this.options.numArr.concat(this.options.letterArr);else if(this.options.type=="number")var l=this.options.numArr;else var l=this.options.letterArr;for(var c=1;c<=a;c++){var f=l[e(0,l.length)];this.options.code+=f,n.font=30+"px SimHei",n.fillStyle=t(50,160),n.shadowOffsetX=e(-1,1),n.shadowOffsetY=e(-1,1),n.shadowBlur=e(-2,2),n.shadowColor="rgba(0, 0, 0, 0.3)";var p=this.options.width/(a+1)*(c-1)+10,v=this.options.height/2,m=e(-15,15);n.translate(p,v),n.rotate(m*Math.PI/180),n.fillText(f,0,0),n.rotate(-m*Math.PI/180),n.translate(-p,-v)}},validate:function(s){var s=s.toLowerCase(),n=this.options.code.toLowerCase();return s==n?!0:(this.refresh(),!1)}};function i(){var s="a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";return s.split(",")}function e(s,n){return Math.floor(Math.random()*(n-s)+s)}function t(s,n){var l=e(s,n),c=e(s,n),f=e(s,n);return"rgb("+l+","+c+","+f+")"}o.GVerify=r})(window,document);