UNPKG

selenium-atoms

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