-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathbrowser.min.js
6 lines (6 loc) · 3.27 KB
/
browser.min.js
1
2
3
4
5
6
/** ! browser.js
* https://github.com/gucong3000/browser.js#readme
*/
!function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.$?e.$.browser=t():e.browser=t()}(this,function(){"use strict";var e,i=window,t=i.navigator,n=i.document,r=/-\w+$/,o=n.documentMode,c=n.compatMode,a=t.appVersion,s=t.userAgent,u="languages",f="language",l=i.opera,p={},d=function(){
/* @cc_on return @_jscript_version;@ */
if(o&&w())return Math.max(11,o)}();function w(){for(var e in t)if(/^ms[A-Z]\w+/.test(e))return!0}if(s=/\)$/.test(a)?s.replace(/^Mozilla\/\d[\w.]+\s*/,""):a,d)e=8<d?d:c?"XMLHttpRequest"in i?o?8:7:6:5,p={MSIE:o||("CSS1Compat"===c?e:5),rv:e},t[f]||(t[f]=t.userLanguage);else if(l)p={Opera:l.version()};else{var g={Safari:"Version\\/",Gecko:"rv:",Version:0,rv:0,Webkit:"\\w+WebKit\\/"},m="20030107"===t.productSub,h=i.chrome||/^Google\b/.test(t.vendor),b=i.netscape,C=w()?{Edge:1,Chrome:0,Gecko:0,Webkit:0}:m?{Chrome:h,Safari:!h,Webkit:m,Gecko:0,Edge:0}:{Khtml:!b,Gecko:b,Webkit:0,Edge:0};for(var S in C)C[S]&&(p[S]=new RegExp("\\b"+(g[S]?g[S]:S+"\\/")+"(\\d+[\\w.]+)").test(s)?RegExp.$1:!!C[S]);s.replace(/(\w+)\/(\d+[\w.]+)/g,function(e,t,n){/^\w+WebKit$/.test(t)||t in g||t in C||(p[t]=n)})}function v(e){return!e||e.replace(/_/g,".")}try{t[f]=t[f].replace(r,function(e){return e.toUpperCase()})}catch(e){}function y(){return t[u][t[u].length-1]}if(!t[u])for(t[u]=[t[f]];r.test(y());)t[u].push(y().replace(r,""));p[u]=t[u],s=s.replace(/^.*?\((.*?)\).*$/,"$1").replace(/\bWin(?:dows(?:\sNT)?)?\s(\d+[\w.]+)/g,function(e,t){p.Windows=t}),p.Windows||s.replace(/;\s*(\w+)\s(\d+[\w.]+)/g,function(e,t,n){p[t]=n}).replace(/\b(\w+);(?: \w+;)* (CPU|PPC|Intel)(?:(?:(?: iPhone)? OS (\d+\w+))? like)?(?: Mac OS(?: X)?(?: (\d+\w+))?)?\b/g,function(e,t,n,r,o){o&&!r||"Macintosh"===t?("CPU"!==n&&(p.CPU=n),p[t]=v(o)):(p[t]=!0,p.IOS=v(r))});var A,$,k=/([a-z]+[A-Z][a-z]+)[A-Z][a-z]*$/,x={offlineAudioContext:"OfflineAudioContext",audioContext:"AudioContext",enterFullscreen:"requestFullscreen",exitFullscreen:"cancelFullscreen",matchesSelector:"matches"},M=i.Object,O={};function P(e,t,n){var r,o=t.replace(/^(?:[A-Z]?[a-z]+|Ms|O)([A-Z])(\w)/,function(e,t,n){return/[a-z]/.test(n)&&(t=t.toLowerCase()),t+n}).replace(/(F|f)ullScreen/,"$1ullscreen");if(n=n||e,!((o=x[o]||o)in n||n[o]||o[0].toUpperCase()+o.slice(1)in n)){if(!(r=e.constructor.name))try{r=String(e).replace(/.*\[\w+\s+(\w+?)(?:Prototype)?\].*/,"$1")}catch(e){r="Window"}return i[r]&&(e=i[r].prototype||e),(O[r]=O[r]||{})[t]=o,M.defineProperty(e,o,{get:function(){return this[t]},set:function(e){this[t]=e},enumerable:!0}),e}}function W(e){return(l?/^(?:o[A-Z]|O[A-Z][a-z])/:/^(?:[Ww]ebkit|[Kk]html|[Mm]oz|[Mm]s)[A-Z]/).test(e)}function z(e){if(/^-[a-z]+-\w/.test(e))e=e.replace(/-([a-z])/g,function(e,t){return t.toUpperCase()});else if(!W(e))return;!function e(t){P(i.CSSStyleDeclaration.prototype,t,A)&&k.test(t)&&e(t.replace(k,"$1"))}(e)}function E(e,t){var n=M.getPrototypeOf(e);return t in n&&(E(n,t)||P(n,t),!0)}if(M.getPrototypeOf){if(0<(A=i.getComputedStyle(n.createElement("div"),null)).length)[].slice.call(A,0).forEach(z);else for($ in A)z($);M.getOwnPropertyNames(i).forEach(function(e){try{if(W(e))P(i,e);else if(i[e]&&/^[A-Z]/.test(e))for(var t in e=i[e].prototype)W(t)&&(E(e,t)||P(e,t))}catch(e){}}),p.prefix=O}return p});