webdriverio-automation
Version:
WebdriverIO-Automation android ios project
9 lines (8 loc) • 5.75 kB
JavaScript
function(){return function(){var c=this;var aa=window;var h=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};
function l(a,b){var d=0;a=h(String(a)).split(".");b=h(String(b)).split(".");for(var f=Math.max(a.length,b.length),e=0;!d&&e<f;e++){var g=a[e]||"",k=b[e]||"";do{g=/(\d*)(\D*)(.*)/.exec(g)||["","","",""];k=/(\d*)(\D*)(.*)/.exec(k)||["","","",""];if(0==g[0].length&&0==k[0].length)break;d=m(0==g[1].length?0:parseInt(g[1],10),0==k[1].length?0:parseInt(k[1],10))||m(0==g[2].length,0==k[2].length)||m(g[2],k[2]);g=g[3];k=k[3]}while(!d)}return d}function m(a,b){return a<b?-1:a>b?1:0};var n;a:{var p=c.navigator;if(p){var q=p.userAgent;if(q){n=q;break a}}n=""}function r(a){return-1!=n.indexOf(a)};function t(){return(r("Chrome")||r("CriOS"))&&!r("Edge")};function u(){return r("iPhone")&&!r("iPod")&&!r("iPad")};var v=r("Opera"),w=r("Trident")||r("MSIE"),x=r("Edge"),y=r("Gecko")&&!(-1!=n.toLowerCase().indexOf("webkit")&&!r("Edge"))&&!(r("Trident")||r("MSIE"))&&!r("Edge"),z=-1!=n.toLowerCase().indexOf("webkit")&&!r("Edge");function A(){var a=c.document;return a?a.documentMode:void 0}var B;
a:{var C="",D=function(){var a=n;if(y)return/rv\:([^\);]+)(\)|;)/.exec(a);if(x)return/Edge\/([\d\.]+)/.exec(a);if(w)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(z)return/WebKit\/(\S+)/.exec(a);if(v)return/(?:Version)[ \/]?(\S+)/.exec(a)}();D&&(C=D?D[1]:"");if(w){var E=A();if(null!=E&&E>parseFloat(C)){B=String(E);break a}}B=C}var F;var G=c.document;F=G&&w?A()||("CSS1Compat"==G.compatMode?parseInt(B,10):5):void 0;var ba=r("Firefox"),ca=u()||r("iPod"),da=r("iPad"),H=r("Android")&&!(t()||r("Firefox")||r("Opera")||r("Silk")),ea=t(),I=r("Safari")&&!(t()||r("Coast")||r("Opera")||r("Edge")||r("Silk")||r("Android"))&&!(u()||r("iPad")||r("iPod"));function J(a){return(a=a.exec(n))?a[1]:""}var fa=function(){if(ba)return J(/Firefox\/([0-9.]+)/);if(w||x||v)return B;if(ea)return u()||r("iPad")||r("iPod")?J(/CriOS\/([0-9.]+)/):J(/Chrome\/([0-9.]+)/);if(I&&!(u()||r("iPad")||r("iPod")))return J(/Version\/([0-9.]+)/);if(ca||da){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(n);if(a)return a[1]+"."+a[2]}else if(H)return(a=J(/Android\s+([0-9.]+)/))?a:J(/Version\/([0-9.]+)/);return""}();var K,L;function M(a){return N?L(a):H?0<=l(ga,a):0<=l(fa,a)}var N=function(){if(!y)return!1;var a=c.Components;if(!a)return!1;try{if(!a.classes)return!1}catch(g){return!1}var b=a.classes,a=a.interfaces,d=b["@mozilla.org/xpcom/version-comparator;1"].getService(a.nsIVersionComparator),b=b["@mozilla.org/xre/app-info;1"].getService(a.nsIXULAppInfo),f=b.platformVersion,e=b.version;K=function(a){d.compare(f,""+a)};L=function(a){return 0<=d.compare(e,""+a)};return!0}(),O;
if(H){var P=/Android\s+([0-9\.]+)/.exec(n);O=P?P[1]:"0"}else O="0";var ga=O;H&&M(2.3);var ha=H&&!M(4);I&&M(6);function Q(a,b){this.width=a;this.height=b}Q.prototype.toString=function(){return"("+this.width+" x "+this.height+")"};Q.prototype.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};Q.prototype.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};Q.prototype.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
Q.prototype.scale=function(a,b){this.width*=a;this.height*="number"==typeof b?b:a;return this};function R(a,b,d,f){this.f=a;this.b=b;this.c=d;this.a=f}R.prototype.toString=function(){return"("+this.f+"t, "+this.b+"r, "+this.c+"b, "+this.a+"l)"};R.prototype.ceil=function(){this.f=Math.ceil(this.f);this.b=Math.ceil(this.b);this.c=Math.ceil(this.c);this.a=Math.ceil(this.a);return this};R.prototype.floor=function(){this.f=Math.floor(this.f);this.b=Math.floor(this.b);this.c=Math.floor(this.c);this.a=Math.floor(this.a);return this};
R.prototype.round=function(){this.f=Math.round(this.f);this.b=Math.round(this.b);this.c=Math.round(this.c);this.a=Math.round(this.a);return this};R.prototype.scale=function(a,b){b="number"==typeof b?b:a;this.a*=a;this.b*=a;this.f*=b;this.c*=b;return this};function S(a,b){var d=9==a.nodeType?a:a.ownerDocument||a.document;return d.defaultView&&d.defaultView.getComputedStyle&&(a=d.defaultView.getComputedStyle(a,null))?a[b]||a.getPropertyValue(b)||"":""}var T={thin:2,medium:4,thick:6};
function U(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:null))return 0;var d=a.currentStyle?a.currentStyle[b+"Width"]:null;if(d in T)a=T[d];else if(/^\d+px?$/.test(d))a=parseInt(d,10);else{b=a.style.left;var f=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=d;d=a.style.pixelLeft;a.style.left=b;a.runtimeStyle.left=f;a=+d}return a};w&&N&&K(10);H&&M(4);z&&N&&K("533");function V(a){a=a||aa;try{var b=a.frameElement}catch(g){b=null}if(ha){if(b){var d=b;if(!w||9<=Number(F)){var f=S(d,"borderLeftWidth");var e=S(d,"borderRightWidth");a=S(d,"borderTopWidth");d=S(d,"borderBottomWidth");a=new R(parseFloat(a),parseFloat(e),parseFloat(d),parseFloat(f))}else f=U(d,"borderLeft"),e=U(d,"borderRight"),a=U(d,"borderTop"),d=U(d,"borderBottom"),a=new R(a,e,d,f);return new Q(b.clientWidth-a.a-a.b,b.clientHeight)}return new Q(320,240)}if(b)return new Q(b.clientWidth,b.clientHeight);
b=a.document.documentElement;e=a.document.body;return new Q(a.outerWidth||b&&b.clientWidth||e&&e.clientWidth||0,a.outerHeight||b&&b.clientHeight||e&&e.clientHeight||0)}var W=["_"],X=c;W[0]in X||!X.execScript||X.execScript("var "+W[0]);for(var Y;W.length&&(Y=W.shift());){var Z;if(Z=!W.length)Z=void 0!==V;Z?X[Y]=V:X[Y]&&X[Y]!==Object.prototype[Y]?X=X[Y]:X=X[Y]={}};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null,document:typeof window!='undefined'?window.document:null}, arguments);}