torrentpier/styles/js/libs/oldbrowserdetector.min.js
2023-05-24 18:06:25 +07:00

2 lines
2.3 KiB
JavaScript

!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b():"function"==typeof define&&define.amd?define(b):b()}(0,function(){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},b=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),c={i:"Internet Explorer",f:"Firefox",o:"Opera",s:"Apple Safari",n:"Netscape Navigator",c:"Chrome",x:"Other"},d={i:11,f:20,c:20,o:10.6,s:{d:8,m:3},n:10},e=function(){function f(a,b){!function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}(this,f),this.options=a?Object.assign({},d,a):d,this.cb=b||function(a){return console.log("Old Browser Detected: "+a)}}return b(f,[{key:"detect",value:function(){var b=f.getBrowser(),c=0;return c="object"===a(this.options[b.n])?b.isMobile?this.options[b.n].m:this.options[b.n].d:this.options[b.n],("x"===b.n||b.v<=c)&&(this.cb.call(null,b),!0)}}],[{key:"getBrowser",value:function(){var a,b,d=navigator.userAgent,f=/ipad|ipod|iphone|android/i.test(d);if(/bot|googlebot|slurp|mediapartners|adsbot|bingbot|google web preview|like firefox|chromeframe|seamonkey|opera mini|min|meego|netfront|moblin|maemo|arora|camino|flot|k-meleon|fennec|kazehakase|galeon|epiphany|rekonq|symbian|webos/i.test(d))a="x";else if(/Trident.(\d+\.\d+)/i.test(d))a="io";else if(/MSIE.(\d+\.\d+)/i.test(d))a="i";else if(/Chrome.(\d+\.\d+)/i.test(d))a="c";else if(/Firefox.(\d+\.\d+)/i.test(d))a="f";else if(/Version.(\d+.\d+).{0,10}Safari/i.test(d))a="s";else if(/Safari.(\d+)/i.test(d))a="so";else if(/Opera.*Version.(\d+\.?\d+)/i.test(d))a="o";else if(/Opera.(\d+\.?\d+)/i.test(d))a="o";else{if(!/Netscape.(\d+)/i.test(d))return{n:"x",v:0,t:c[a]};a="n"}return"x"==a?{n:"x",v:0,t:c[a]}:(b=new Number(RegExp.$1),"so"==a&&(b=(100>b?1:130>b&&1.2)||320>b&&1.3||520>b&&2||524>b&&3||526>b&&3.2||4,a="s"),"i"==a&&7==b&&window.XDomainRequest&&(b=8),"io"==a&&(a="i",b=5<b?10:4<b?9:3.1<b?8:3<b?7:9),{n:a,v:b,t:c[a]+" "+b,isMobile:f})}}]),f}();window.oldBrowserDetector=e});