原名JSPackager
源代码在线查看: browser-info.js
$JSI.addCacheScript('js/html/browser-info.js',function(){this.hook = function(s){return eval(s);};eval(this.varText);var notChecker = function (minVersion, maxVersion) {return false;};var BrowserInfo = {version:null, isIE:notChecker, isOpera:notChecker, isGecko:notChecker, isNetscape:notChecker, isMozilla:notChecker, isFirefox:notChecker, isKHTML:notChecker, isSafari:notChecker, isKonqueror:notChecker, isQuirks:function () {return document["compatMode"] == "BackCompat" || document["compatMode"] == "QuirksMode";}};function Version(version) {var vs = version.match(/([\d\.]*)(.*)?/);this.flag = vs[2] ? vs[2].replace(/^\s+(.*[^\s])\s+$/, "$1") || "" : "";vs = vs[1].match(/(\d+(\.\d+)?)/g);for (var i = vs.length - 1; i >= 0; i--) {vs[i] = parseFloat(vs[i]);}this.version = version;this.value = vs[0];this.values = vs;}Version.prototype.compare = function (v) {if (typeof v == "number") {if (v == this.value) {for (var i = 1; i < this.values.length; i++) { if (this.values[i]) {return 1;}}return 0;} else {return v - this.value;}} else {if (typeof v == "string") {if (v == this.version) {return 0;}v = new Version(v);}if (v.value == this.value) {var l = Math.min(this.values.length, v.values.length);for (var i = 1; i < l; i++) {if (this.values[i]) {return 1;}}l = v.values.length - this.value.length;if (l > 0) {return 1;} else {if (l < 0) {return -1;}}if (v.flag == this.flag) {return 0;} else {if (!v.flag) {return 1;} else {if (!this.flag) {return -1; } else {return v.flag > this.flag ? 1 : -1;}}}} else {return v.value - this.value;}}};Version.prototype.before = function (v) {return this.compare(v) >= 0;};Version.prototype.after = function (v) {return this.compare(v) } else {return v.after(min) && v.before(max) ? version : false;}}};}var ua = window.navigator.userAgent;if (ua.indexOf("Opera") > 0) {var version = ua.replace(/.*Opera\s+([^; ]+).*/, "$1");BrowserInfo.isOpera = buildBrowserChecker(version);} else {if (ua.indexOf(" MSIE ") > 0) {var version = ua.replace(/.*MSIE\s+([^; ]+).*/, "$1");BrowserInfo.isIE = buildBrowserChecker(version);if (BrowserInfo.isIE(null, 5.9)) {BrowserInfo.isQuirks = function () {return true;};}} else {if (ua.indexOf("Gecko/") > 0) {var version = ua.replace(/.*Gecko[\s\/]*([^;\/\) ]+).*/, "$1");BrowserInfo.isGecko = buildBrowserChecker(version);if (ua.indexOf("Firefox") > 0) {var version = ua.replace(/.*Firefox[\s\/]*([^;\/\) ]+).*/, "$1");BrowserInfo.isFirefox = buildBrowserChecker(version);} else {if (ua.indexOf("Netscape") > 0) {var version = ua.replace(/.*Netscape[\s\/]*([^;\/\) ]+).*/, "$1"); BrowserInfo.isNetscape = buildBrowserChecker(version);} else {if (ua.indexOf("Mozilla") > 0) {var version = ua.replace(/.*rv:([^;\/\) ]+).*/, "$1");BrowserInfo.isMozilla = buildBrowserChecker(version);}}}} else {if (ua.indexOf("KHTML") > 0) {if (ua.indexOf("Konqueror") > 0) {BrowserInfo.isKHTML = function () {return true;};version = ua.replace(/.*Konqueror\/([^;\/ ]+).*/, "$1");BrowserInfo.isKonqueror = buildBrowserChecker(version);}} else {if (ua.indexOf("Safari") > 0) {BrowserInfo.isKHTML = function () {return true;};version = ua.replace(/.*Safari\/([^;\/ ]+).*/, "$1");BrowserInfo.isSafari = buildBrowserChecker(version);} else {}}}}}for (var n in BrowserInfo) {window.navigator[n] = BrowserInfo[n];}});