Skip to content

Commit 1d6f4f5

Browse files
committed
Remove $.browser call to work with jQuery 1.9. fix #209
1 parent 5f67fde commit 1d6f4f5

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

js/jquery.nyroModal.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,35 @@
55
*/
66
jQuery(function($, undefined) {
77

8+
var 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+
17+
return {
18+
browser: match[ 1 ] || "",
19+
version: match[ 2 ] || "0"
20+
};
21+
},
22+
matched = uaMatch(navigator.userAgent),
23+
browser = {};
24+
25+
if (matched.browser) {
26+
browser[matched.browser] = true;
27+
browser.version = matched.version;
28+
}
29+
30+
// Chrome is Webkit, but Webkit is also Safari.
31+
if (browser.chrome) {
32+
browser.webkit = true;
33+
} else if (browser.webkit) {
34+
browser.safari = true;
35+
}
36+
837
var $w = $(window),
938
$d = $(document),
1039
$b = $('body'),
@@ -710,7 +739,7 @@ jQuery(function($, undefined) {
710739
},
711740
_getSpaceReposition: function() {
712741
var outer = this._getOuter($b),
713-
ie7 = $.browser.msie && $.browser.version < 8 && !(screen.height <= $w.height()+23);
742+
ie7 = browser.msie && browser.version < 8 && !(screen.height <= $w.height()+23);
714743
return {
715744
top: $w.scrollTop() - (!ie7 ? outer.h.border / 2 : 0),
716745
left: $w.scrollLeft() - (!ie7 ? outer.w.border / 2 : 0)

0 commit comments

Comments
 (0)