-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbbi.jquery.js
116 lines (80 loc) · 3.35 KB
/
bbi.jquery.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*! BBI jQuery (c) Blackbaud, Inc. */
(function(_win, bbi) {
"use strict";
var alias = "jQuery";
bbi.on("preload", function() {
bbi.extension({
alias: alias,
defaults: {
jQuery: null
},
directive: function(ext, bbi) {
var settings = ext.settings();
var _$;
var _window$;
var _locations = {
namespace: null,
window: null
};
var methods = {
check: function() {
var settingsOkay = methods.check.settings();
var windowOkay = methods.check.window();
// The user didn't use noConflict, which is fine.
// Just use the window's version of jQuery.
if (!settingsOkay && windowOkay) {
_$ = _window$;
_locations.namespace = _$;
_locations.window = _window$;
}
// jQuery not defined!
if (typeof _$ !== "function") {
throw new Error("[BBI.jQuery.Check] The BBI namespace requires jQuery 1.7.2 (or greater) to operate.");
}
delete this["check"];
},
instance: function (label) {
if (typeof _locations[label] === "function") {
return _locations[label];
} else if (typeof _$ === "function") {
return _$;
} else {
return _window$;
}
},
set: function (label, fn) {
_locations[label] = fn;
}
};
methods.check.settings = function () {
if (typeof settings.jQuery === "function") {
_locations.namespace = _$ = settings.jQuery;
if (settings.debug && typeof _win.console === "object") {
console.log("[BBI.jQuery.Check] BBI using jQuery.noConflict() v." + _$.fn.jquery);
}
return true;
}
return false;
};
methods.check.window = function () {
if (typeof _win.jQuery === "function") {
_locations.window = _window$ = _win.jQuery;
if (settings.debug && typeof _win.console === "object") {
console.log("[BBI.jQuery.Check] Window using jQuery v.", _window$.fn.jquery);
}
return true;
}
return false;
};
return {
setLocation: methods.set,
check: methods.check,
jQuery: methods.instance
};
}
});
var instance = bbi.instantiate(alias, bbi.options());
instance.check();
bbi.map("jQuery", instance.jQuery);
});
}.call({}, window, bbiGetInstance()));