jquery.browser.js 1008 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // jQuery.browser from 1.8.x
  2. // Limit scope pollution from any deprecated API
  3. (function() {
  4. var matched, browser;
  5. // Use of jQuery.browser is frowned upon.
  6. // More details: http://api.jquery.com/jQuery.browser
  7. // jQuery.uaMatch maintained for back-compat
  8. jQuery.uaMatch = function( ua ) {
  9. ua = ua.toLowerCase();
  10. var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
  11. /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
  12. /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
  13. /(msie) ([\w.]+)/.exec( ua ) ||
  14. ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
  15. [];
  16. return {
  17. browser: match[ 1 ] || "",
  18. version: match[ 2 ] || "0"
  19. };
  20. };
  21. matched = jQuery.uaMatch( navigator.userAgent );
  22. browser = {};
  23. if ( matched.browser ) {
  24. browser[ matched.browser ] = true;
  25. browser.version = matched.version;
  26. }
  27. // Chrome is Webkit, but Webkit is also Safari.
  28. if ( browser.chrome ) {
  29. browser.webkit = true;
  30. } else if ( browser.webkit ) {
  31. browser.safari = true;
  32. }
  33. jQuery.browser = browser;
  34. })();