-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbbi.bbnc.js
91 lines (70 loc) · 2.91 KB
/
bbi.bbnc.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
/*! BBI BBNC (c) Blackbaud, Inc. */
(function(_win, bbi) {
"use strict";
var alias = "bbnc";
bbi.on("init", function() {
bbi.extension({
alias: alias,
defaults: {
partTitleKeyword: 'Customization'
},
directive: function(ext, bbi, $) {
var settings = ext.settings();
var _prm;
var _usesMicrosoftAjax = false;
var methods = {
attach: function (fn, args, context) {
$(function() {
$.proxy(fn, context)(args);
});
if (_usesMicrosoftAjax === true) {
_prm.add_endRequest(function() {
$.proxy(fn, context)(args);
});
}
},
getPageRequestManager: function() {
var prm = {};
if (typeof _prm === "object") {
return _prm;
}
try {
prm = Sys.WebForms.PageRequestManager.getInstance();
_usesMicrosoftAjax = true;
} catch (e) {
if (bbi.isDebugMode() === true) {
bbi.log(e.message, false);
}
}
return prm;
},
showPartTitle: function() {
methods.attach(function() {
var body = $('#BodyId');
if (body.find('.js-part-label').length === 0) {
body.find('[id*="_tdPartName"]:contains("' + settings.partTitleKeyword + '")').each(function() {
var popup = $(this);
$('#' + popup.attr('id').replace('tdPartName', 'pnlPart')).prepend('<div class="js-part-label">' + popup.text() + ' <em>(click to modify)</em></div>');
});
}
});
}
};
var __construct = (function() {
_prm = methods.getPageRequestManager();
if (bbi("debug").getInstance(0).isPageEditor()) {
methods.showPartTitle();
}
}());
return {
attach: methods.attach,
usesMicrosoftAjax: function () {
return _usesMicrosoftAjax;
}
};
}
});
var instance = bbi.instantiate(alias);
bbi.map("attach", instance.attach);
});
}.call({}, window, bbiGetInstance()));