Permalink
Browse files

Remove $.browser call to work with jQuery 1.9. fix #209

  • Loading branch information...
1 parent 5f67fde commit 1d6f4f5ed33e6d91cf102e3fb93cb9d2d6f37355 @nyroDev committed Jan 16, 2013
Showing with 30 additions and 1 deletion.
  1. +30 −1 js/jquery.nyroModal.js
@@ -5,6 +5,35 @@
*/
jQuery(function($, undefined) {
+ var uaMatch = function(ua) {
+ ua = ua.toLowerCase();
+ var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
+ /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
+ /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
+ /(msie) ([\w.]+)/.exec( ua ) ||
+ ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
+ [];
+
+ return {
+ browser: match[ 1 ] || "",
+ version: match[ 2 ] || "0"
+ };
+ },
+ matched = uaMatch(navigator.userAgent),
+ browser = {};
+
+ if (matched.browser) {
+ browser[matched.browser] = true;
+ browser.version = matched.version;
+ }
+
+ // Chrome is Webkit, but Webkit is also Safari.
+ if (browser.chrome) {
+ browser.webkit = true;
+ } else if (browser.webkit) {
+ browser.safari = true;
+ }
+
var $w = $(window),
$d = $(document),
$b = $('body'),
@@ -710,7 +739,7 @@ jQuery(function($, undefined) {
},
_getSpaceReposition: function() {
var outer = this._getOuter($b),
- ie7 = $.browser.msie && $.browser.version < 8 && !(screen.height <= $w.height()+23);
+ ie7 = browser.msie && browser.version < 8 && !(screen.height <= $w.height()+23);
return {
top: $w.scrollTop() - (!ie7 ? outer.h.border / 2 : 0),
left: $w.scrollLeft() - (!ie7 ? outer.w.border / 2 : 0)

0 comments on commit 1d6f4f5

Please sign in to comment.