Sha256: 193e83688cb164f4e6fb73a55a177aa0315eaa1d3320558a09f8474ead68b753

Contents?: true

Size: 1.4 KB

Versions: 18

Compression:

Stored size: 1.4 KB

Contents

$.browser = {
  init: function () {
    this.name = this.searchString(this.dataBrowser) || "Other";
    this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown";
  },
  searchString: function (data) {
    for (var i = 0; i < data.length; i++) {
      var dataString = data[i].string;
      this.versionSearchString = data[i].subString;

      if (dataString.indexOf(data[i].subString) !== -1) {
        return data[i].identity;
      }
    }
  },
  searchVersion: function (dataString) {
    var index = dataString.indexOf(this.versionSearchString);
    if (index === -1) {
      return;
    }

    var rv = dataString.indexOf("rv:");
    if (this.versionSearchString === "Trident" && rv !== -1) {
      return parseFloat(dataString.substring(rv + 3));
    } else {
      return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
    }
  },

  dataBrowser: [
    {string: navigator.userAgent, subString: "Chrome", identity: "Chrome"},
    {string: navigator.userAgent, subString: "MSIE", identity: "Explorer"},
    {string: navigator.userAgent, subString: "Trident", identity: "Explorer"},
    {string: navigator.userAgent, subString: "Firefox", identity: "Firefox"},
    {string: navigator.userAgent, subString: "Safari", identity: "Safari"},
    {string: navigator.userAgent, subString: "Opera", identity: "Opera"}
  ]
};
$.browser.init();    

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cpee-2.0.30 tools/test/js_libs/jquery.browser.js
cpee-2.0.28 tools/test/js_libs/jquery.browser.js
cpee-2.0.27 tools/test/js_libs/jquery.browser.js
cpee-2.0.26 tools/test/js_libs/jquery.browser.js
cpee-2.0.25 tools/test/js_libs/jquery.browser.js
cpee-2.0.24 tools/test/js_libs/jquery.browser.js
cpee-2.0.23 tools/test/js_libs/jquery.browser.js
cpee-2.0.22 tools/test/js_libs/jquery.browser.js
cpee-2.0.21 tools/test/js_libs/jquery.browser.js
cpee-2.0.20 tools/test/js_libs/jquery.browser.js
cpee-1.4.27 cockpit/js_libs/jquery.browser.js
cpee-1.3.177 cockpit/lib/jquery.browser.js
cpee-1.3.176 cockpit/lib/jquery.browser.js
cpee-1.3.175 cockpit/lib/jquery.browser.js
cpee-1.3.174 cockpit/lib/jquery.browser.js
cpee-1.3.173 cockpit/lib/jquery.browser.js
cpee-1.3.172 cockpit/lib/jquery.browser.js
cpee-1.3.171 cockpit/lib/jquery.browser.js