Skip to content

Commit

Permalink
Remove $.browser call to work with jQuery 1.9. fix #209
Browse files Browse the repository at this point in the history
  • Loading branch information
nyroDev committed Jan 16, 2013
1 parent 5f67fde commit 1d6f4f5
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion js/jquery.nyroModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1d6f4f5

Please sign in to comment.