@atlassian/aui 9.11.0 → 9.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aui/aui-prototyping-design-tokens-api-full.js +1 -1
- package/dist/aui/aui-prototyping-design-tokens-api.js +1 -1
- package/dist/aui/aui-prototyping-design-tokens-base-themes-css.css +1 -1
- package/dist/aui/aui-prototyping-design-tokens-base-themes-css.js +1 -1
- package/dist/aui/aui-prototyping-design-tokens-base-themes.js +1 -1
- package/dist/aui/aui-prototyping.css +6 -6
- package/dist/aui/aui-prototyping.css.map +1 -1
- package/dist/aui/aui-prototyping.js +24 -21
- package/dist/aui/aui-prototyping.js.map +1 -1
- package/dist/aui/aui-prototyping.nodeps.css +6 -6
- package/dist/aui/aui-prototyping.nodeps.css.map +1 -1
- package/dist/aui/aui-prototyping.nodeps.js +24 -21
- package/dist/aui/aui-prototyping.nodeps.js.map +1 -1
- package/entry/aui.component.form.select2.js +1 -1
- package/entry/deprecated/aui.behaviour.jquery-form.js +1 -1
- package/package.json +79 -73
- package/src/js/aui/inline-dialog.js +3 -0
- package/src/js/aui/select2.js +24 -7
- package/src/js/aui/tables-sortable.js +2 -1
- package/src/js/aui/when-i-type.js +1 -1
- package/src/js-vendor/jquery-aop/LICENSE +21 -0
- package/src/js-vendor/jquery-aop/README.md +54 -0
- package/src/js-vendor/jquery-aop/aop.js +404 -0
- package/src/js-vendor/jquery-aop/jquery-aop.txt +5 -0
- package/src/js-vendor/jquery-aop/package.json +16 -0
- package/src/js-vendor/jquery-form/jquery.form.js +813 -0
- package/src/js-vendor/jquery-form/package.json +15 -0
- package/src/js-vendor/jquery.hotkeys/jquery.hotkeys.js +99 -0
- package/src/js-vendor/jquery.hotkeys/package.json +14 -0
- package/src/js-vendor/select2/CONTRIBUTING.md +107 -0
- package/src/js-vendor/select2/LICENSE +18 -0
- package/src/js-vendor/select2/README.md +115 -0
- package/src/js-vendor/select2/bower.json +8 -0
- package/src/js-vendor/select2/component.json +66 -0
- package/src/js-vendor/select2/composer.json +29 -0
- package/src/js-vendor/select2/package.json +20 -0
- package/src/js-vendor/select2/release.sh +79 -0
- package/src/js-vendor/select2/select2-bootstrap.css +87 -0
- package/src/{css-vendor/jquery/plugins → js-vendor/select2}/select2-spinner.gif +0 -0
- package/src/js-vendor/select2/select2.jquery.json +36 -0
- package/src/js-vendor/select2/select2.min.js +23 -0
- package/src/js-vendor/select2/select2.png +0 -0
- package/src/js-vendor/select2/select2_locale_ar.js +19 -0
- package/src/js-vendor/select2/select2_locale_az.js +20 -0
- package/src/js-vendor/select2/select2_locale_bg.js +20 -0
- package/src/js-vendor/select2/select2_locale_ca.js +19 -0
- package/src/js-vendor/select2/select2_locale_cs.js +51 -0
- package/src/js-vendor/select2/select2_locale_da.js +19 -0
- package/src/js-vendor/select2/select2_locale_de.js +18 -0
- package/src/js-vendor/select2/select2_locale_el.js +19 -0
- package/src/js-vendor/select2/select2_locale_en.js.template +20 -0
- package/src/js-vendor/select2/select2_locale_es.js +19 -0
- package/src/js-vendor/select2/select2_locale_et.js +19 -0
- package/src/js-vendor/select2/select2_locale_eu.js +45 -0
- package/src/js-vendor/select2/select2_locale_fa.js +21 -0
- package/src/js-vendor/select2/select2_locale_fi.js +30 -0
- package/src/js-vendor/select2/select2_locale_fr.js +18 -0
- package/src/js-vendor/select2/select2_locale_gl.js +45 -0
- package/src/js-vendor/select2/select2_locale_he.js +19 -0
- package/src/js-vendor/select2/select2_locale_hr.js +24 -0
- package/src/js-vendor/select2/select2_locale_hu.js +17 -0
- package/src/js-vendor/select2/select2_locale_id.js +21 -0
- package/src/js-vendor/select2/select2_locale_is.js +17 -0
- package/src/js-vendor/select2/select2_locale_it.js +17 -0
- package/src/js-vendor/select2/select2_locale_ja.js +17 -0
- package/src/js-vendor/select2/select2_locale_ka.js +19 -0
- package/src/js-vendor/select2/select2_locale_ko.js +19 -0
- package/src/js-vendor/select2/select2_locale_lt.js +26 -0
- package/src/js-vendor/select2/select2_locale_lv.js +19 -0
- package/src/js-vendor/select2/select2_locale_mk.js +19 -0
- package/src/js-vendor/select2/select2_locale_ms.js +21 -0
- package/src/js-vendor/select2/select2_locale_nb.js +22 -0
- package/src/js-vendor/select2/select2_locale_nl.js +17 -0
- package/src/js-vendor/select2/select2_locale_pl.js +54 -0
- package/src/js-vendor/select2/select2_locale_pt-BR.js +18 -0
- package/src/js-vendor/select2/select2_locale_pt-PT.js +17 -0
- package/src/js-vendor/select2/select2_locale_ro.js +17 -0
- package/src/js-vendor/select2/select2_locale_rs.js +19 -0
- package/src/js-vendor/select2/select2_locale_ru.js +23 -0
- package/src/js-vendor/select2/select2_locale_sk.js +50 -0
- package/src/js-vendor/select2/select2_locale_sv.js +19 -0
- package/src/js-vendor/select2/select2_locale_th.js +19 -0
- package/src/js-vendor/select2/select2_locale_tr.js +20 -0
- package/src/js-vendor/select2/select2_locale_ug-CN.js +16 -0
- package/src/js-vendor/select2/select2_locale_uk.js +25 -0
- package/src/js-vendor/select2/select2_locale_vi.js +20 -0
- package/src/js-vendor/select2/select2_locale_zh-CN.js +16 -0
- package/src/js-vendor/select2/select2_locale_zh-TW.js +16 -0
- package/src/js-vendor/select2/select2x2.png +0 -0
- package/src/js-vendor/tablesorter/README.md +158 -0
- package/src/js-vendor/tablesorter/jquery.tablesorter.js +1901 -0
- package/src/js-vendor/tablesorter/package.json +43 -0
- package/src/less/adg-header-quicksearch.less +2 -2
- package/src/less/aui-appheader.less +3 -3
- package/src/less/aui-buttons.less +2 -2
- package/src/less/aui-experimental-tooltip.less +1 -1
- package/src/less/aui-navigation.less +4 -4
- package/src/less/aui-page-layout.less +2 -2
- package/src/less/aui-page-typography.less +1 -1
- package/src/less/aui-select2.less +1 -1
- package/src/less/aui-sidebar-config.less +1 -1
- package/src/less/aui-sidebar-grouping.less +2 -2
- package/src/less/aui-sidebar-navigation.less +2 -2
- package/src/less/aui-toggle.less +2 -2
- package/src/less/dropdown2.less +2 -4
- package/src/less/forms-current.less +1 -1
- package/src/less/forms-legacy.less +2 -2
- package/src/less/forms-radios-and-checkboxes.less +2 -2
- package/src/less/forms.less +2 -2
- package/src/less/imports/aui-theme/components/buttons.less +2 -2
- package/src/less/imports/aui-theme/components/forms.less +1 -1
- package/src/less/imports/aui-theme/components/navigation.less +1 -1
- package/src/less/imports/aui-theme/components/toggle.less +2 -2
- package/src/less/imports/mixins/typography.less +8 -8
- package/src/less/imports/mixins.less +1 -1
- package/src/less/single-select.less +1 -1
- package/src/css-vendor/jquery/plugins/select2.png +0 -0
- package/src/css-vendor/jquery/plugins/select2x2.png +0 -0
- package/src/js/jquery/jquery.hotkeys.js +0 -176
- package/src/js-vendor/jquery/jquery.tablesorter.js +0 -1896
- package/src/js-vendor/jquery/plugins/jquery.form.js +0 -819
- /package/src/{css-vendor/jquery/plugins/jquery.select2.css → js-vendor/select2/select2.css} +0 -0
- /package/src/js-vendor/{jquery/plugins/jquery.select2.js → select2/select2.js} +0 -0
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jQuery AOP - jQuery plugin to add features of aspect-oriented programming (AOP) to jQuery.
|
|
3
|
+
* https://github.com/gonzalocasas/jquery-aop
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the MIT license:
|
|
6
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
7
|
+
*
|
|
8
|
+
* Version: 1.3
|
|
9
|
+
*
|
|
10
|
+
* Cross-frame type detection based on Daniel Steigerwald's code (http://daniel.steigerwald.cz)
|
|
11
|
+
* http://gist.github.com/204554
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
(function() {
|
|
16
|
+
|
|
17
|
+
var _after = 1;
|
|
18
|
+
var _afterThrow = 2;
|
|
19
|
+
var _afterFinally = 3;
|
|
20
|
+
var _before = 4;
|
|
21
|
+
var _around = 5;
|
|
22
|
+
var _intro = 6;
|
|
23
|
+
var _regexEnabled = true;
|
|
24
|
+
var _arguments = 'arguments';
|
|
25
|
+
var _undef = 'undefined';
|
|
26
|
+
|
|
27
|
+
var getType = (function() {
|
|
28
|
+
|
|
29
|
+
var toString = Object.prototype.toString,
|
|
30
|
+
toStrings = {},
|
|
31
|
+
nodeTypes = { 1: 'element', 3: 'textnode', 9: 'document', 11: 'fragment' },
|
|
32
|
+
types = 'Arguments Array Boolean Date Document Element Error Fragment Function NodeList Null Number Object RegExp String TextNode Undefined Window'.split(' ');
|
|
33
|
+
|
|
34
|
+
for (var i = types.length; i--; ) {
|
|
35
|
+
var type = types[i], constructor = window[type];
|
|
36
|
+
if (constructor) {
|
|
37
|
+
try { toStrings[toString.call(new constructor)] = type.toLowerCase(); }
|
|
38
|
+
catch (e) { }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return function(item) {
|
|
43
|
+
return item == null && (item === undefined ? _undef : 'null') ||
|
|
44
|
+
item.nodeType && nodeTypes[item.nodeType] ||
|
|
45
|
+
typeof item.length == 'number' && (
|
|
46
|
+
item.callee && _arguments ||
|
|
47
|
+
item.alert && 'window' ||
|
|
48
|
+
item.item && 'nodelist') ||
|
|
49
|
+
toStrings[toString.call(item)];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
var isFunc = function(obj) { return getType(obj) == 'function'; };
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Private weaving function.
|
|
58
|
+
*/
|
|
59
|
+
var weaveOne = function(source, method, advice) {
|
|
60
|
+
|
|
61
|
+
var old = source[method];
|
|
62
|
+
|
|
63
|
+
// Work-around IE6/7 behavior on some native method that return object instances
|
|
64
|
+
if (advice.type != _intro && !isFunc(old)) {
|
|
65
|
+
var oldObject = old;
|
|
66
|
+
old = function() {
|
|
67
|
+
var code = arguments.length > 0 ? _arguments + '[0]' : '';
|
|
68
|
+
|
|
69
|
+
for (var i=1;i<arguments.length;i++) {
|
|
70
|
+
code += ',' + _arguments + '[' + i + ']';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return eval('oldObject(' + code + ');');
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var aspect;
|
|
78
|
+
if (advice.type == _after || advice.type == _afterThrow || advice.type == _afterFinally)
|
|
79
|
+
aspect = function() {
|
|
80
|
+
var returnValue, exceptionThrown = null;
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
returnValue = old.apply(this, arguments);
|
|
84
|
+
} catch (e) {
|
|
85
|
+
exceptionThrown = e;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (advice.type == _after)
|
|
89
|
+
if (exceptionThrown == null)
|
|
90
|
+
returnValue = advice.value.apply(this, [returnValue, method]);
|
|
91
|
+
else
|
|
92
|
+
throw exceptionThrown;
|
|
93
|
+
else if (advice.type == _afterThrow && exceptionThrown != null)
|
|
94
|
+
returnValue = advice.value.apply(this, [exceptionThrown, method]);
|
|
95
|
+
else if (advice.type == _afterFinally)
|
|
96
|
+
returnValue = advice.value.apply(this, [returnValue, exceptionThrown, method]);
|
|
97
|
+
|
|
98
|
+
return returnValue;
|
|
99
|
+
};
|
|
100
|
+
else if (advice.type == _before)
|
|
101
|
+
aspect = function() {
|
|
102
|
+
advice.value.apply(this, [arguments, method]);
|
|
103
|
+
return old.apply(this, arguments);
|
|
104
|
+
};
|
|
105
|
+
else if (advice.type == _intro)
|
|
106
|
+
aspect = function() {
|
|
107
|
+
return advice.value.apply(this, arguments);
|
|
108
|
+
};
|
|
109
|
+
else if (advice.type == _around) {
|
|
110
|
+
aspect = function() {
|
|
111
|
+
var invocation = { object: this, args: Array.prototype.slice.call(arguments) };
|
|
112
|
+
return advice.value.apply(invocation.object, [{ arguments: invocation.args, method: method, proceed :
|
|
113
|
+
function() {
|
|
114
|
+
return old.apply(invocation.object, invocation.args);
|
|
115
|
+
}
|
|
116
|
+
}] );
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
aspect.unweave = function() {
|
|
121
|
+
source[method] = old;
|
|
122
|
+
pointcut = source = aspect = old = null;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
source[method] = aspect;
|
|
126
|
+
|
|
127
|
+
return aspect;
|
|
128
|
+
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Private method search
|
|
133
|
+
*/
|
|
134
|
+
var search = function(source, pointcut, advice) {
|
|
135
|
+
|
|
136
|
+
var methods = [];
|
|
137
|
+
|
|
138
|
+
for (var method in source) {
|
|
139
|
+
|
|
140
|
+
var item = null;
|
|
141
|
+
|
|
142
|
+
// Ignore exceptions during method retrival
|
|
143
|
+
try {
|
|
144
|
+
item = source[method];
|
|
145
|
+
}
|
|
146
|
+
catch (e) { }
|
|
147
|
+
|
|
148
|
+
if (item != null && method.match(pointcut.method) && isFunc(item))
|
|
149
|
+
methods[methods.length] = { source: source, method: method, advice: advice };
|
|
150
|
+
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return methods;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Private weaver and pointcut parser.
|
|
158
|
+
*/
|
|
159
|
+
var weave = function(pointcut, advice) {
|
|
160
|
+
|
|
161
|
+
var source = typeof(pointcut.target.prototype) != _undef ? pointcut.target.prototype : pointcut.target;
|
|
162
|
+
var advices = [];
|
|
163
|
+
|
|
164
|
+
// If it's not an introduction and no method was found, try with regex...
|
|
165
|
+
if (advice.type != _intro && typeof(source[pointcut.method]) == _undef) {
|
|
166
|
+
|
|
167
|
+
// First try directly on target
|
|
168
|
+
var methods = search(pointcut.target, pointcut, advice);
|
|
169
|
+
|
|
170
|
+
// No method found, re-try directly on prototype
|
|
171
|
+
if (methods.length == 0)
|
|
172
|
+
methods = search(source, pointcut, advice);
|
|
173
|
+
|
|
174
|
+
for (var i in methods)
|
|
175
|
+
advices[advices.length] = weaveOne(methods[i].source, methods[i].method, methods[i].advice);
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
else
|
|
179
|
+
{
|
|
180
|
+
// Return as an array of one element
|
|
181
|
+
advices[0] = weaveOne(source, pointcut.method, advice);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return _regexEnabled ? advices : advices[0];
|
|
185
|
+
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
jQuery.aop =
|
|
189
|
+
{
|
|
190
|
+
/**
|
|
191
|
+
* Creates an advice after the defined point-cut. The advice will be executed after the point-cut method
|
|
192
|
+
* has completed execution successfully, and will receive one parameter with the result of the execution.
|
|
193
|
+
* This function returns an array of weaved aspects (Function).
|
|
194
|
+
*
|
|
195
|
+
* @example jQuery.aop.after( {target: window, method: 'MyGlobalMethod'}, function(result) {
|
|
196
|
+
* alert('Returned: ' + result);
|
|
197
|
+
* return result;
|
|
198
|
+
* } );
|
|
199
|
+
* @result Array<Function>
|
|
200
|
+
*
|
|
201
|
+
* @example jQuery.aop.after( {target: String, method: 'indexOf'}, function(index) {
|
|
202
|
+
* alert('Result found at: ' + index + ' on:' + this);
|
|
203
|
+
* return index;
|
|
204
|
+
* } );
|
|
205
|
+
* @result Array<Function>
|
|
206
|
+
*
|
|
207
|
+
* @name after
|
|
208
|
+
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
|
|
209
|
+
* @option Object target Target object to be weaved.
|
|
210
|
+
* @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
|
|
211
|
+
* @param Function advice Function containing the code that will get called after the execution of the point-cut. It receives one parameter
|
|
212
|
+
* with the result of the point-cut's execution. The function can choose to return this same value or a different one.
|
|
213
|
+
*
|
|
214
|
+
* @type Array<Function>
|
|
215
|
+
* @cat Plugins/General
|
|
216
|
+
*/
|
|
217
|
+
after : function(pointcut, advice)
|
|
218
|
+
{
|
|
219
|
+
return weave( pointcut, { type: _after, value: advice } );
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Creates an advice after the defined point-cut only for unhandled exceptions. The advice will be executed
|
|
224
|
+
* after the point-cut method only if the execution failed and an exception has been thrown. It will receive one
|
|
225
|
+
* parameter with the exception thrown by the point-cut method.
|
|
226
|
+
* This function returns an array of weaved aspects (Function).
|
|
227
|
+
*
|
|
228
|
+
* @example jQuery.aop.afterThrow( {target: String, method: 'indexOf'}, function(exception) {
|
|
229
|
+
* alert('Unhandled exception: ' + exception);
|
|
230
|
+
* return -1;
|
|
231
|
+
* } );
|
|
232
|
+
* @result Array<Function>
|
|
233
|
+
*
|
|
234
|
+
* @example jQuery.aop.afterThrow( {target: calculator, method: 'Calculate'}, function(exception) {
|
|
235
|
+
* console.log('Unhandled exception: ' + exception);
|
|
236
|
+
* throw exception;
|
|
237
|
+
* } );
|
|
238
|
+
* @result Array<Function>
|
|
239
|
+
*
|
|
240
|
+
* @name afterThrow
|
|
241
|
+
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
|
|
242
|
+
* @option Object target Target object to be weaved.
|
|
243
|
+
* @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
|
|
244
|
+
* @param Function advice Function containing the code that will get called after the execution of the point-cut. It receives one parameter
|
|
245
|
+
* with the exception thrown by the point-cut method.
|
|
246
|
+
*
|
|
247
|
+
* @type Array<Function>
|
|
248
|
+
* @cat Plugins/General
|
|
249
|
+
*/
|
|
250
|
+
afterThrow : function(pointcut, advice)
|
|
251
|
+
{
|
|
252
|
+
return weave( pointcut, { type: _afterThrow, value: advice } );
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Creates an advice after the defined point-cut. The advice will be executed after the point-cut method
|
|
257
|
+
* regardless of its success or failure, and it will receive two parameters: one with the
|
|
258
|
+
* result of a successful execution or null, and another one with the exception thrown or null.
|
|
259
|
+
* This function returns an array of weaved aspects (Function).
|
|
260
|
+
*
|
|
261
|
+
* @example jQuery.aop.afterFinally( {target: window, method: 'MyGlobalMethod'}, function(result, exception) {
|
|
262
|
+
* if (exception == null)
|
|
263
|
+
* return 'Returned: ' + result;
|
|
264
|
+
* else
|
|
265
|
+
* return 'Unhandled exception: ' + exception;
|
|
266
|
+
* } );
|
|
267
|
+
* @result Array<Function>
|
|
268
|
+
*
|
|
269
|
+
* @name afterFinally
|
|
270
|
+
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
|
|
271
|
+
* @option Object target Target object to be weaved.
|
|
272
|
+
* @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
|
|
273
|
+
* @param Function advice Function containing the code that will get called after the execution of the point-cut regardless of its success or failure.
|
|
274
|
+
* It receives two parameters, the first one with the result of a successful execution or null, and the second one with the
|
|
275
|
+
* exception or null.
|
|
276
|
+
*
|
|
277
|
+
* @type Array<Function>
|
|
278
|
+
* @cat Plugins/General
|
|
279
|
+
*/
|
|
280
|
+
afterFinally : function(pointcut, advice)
|
|
281
|
+
{
|
|
282
|
+
return weave( pointcut, { type: _afterFinally, value: advice } );
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Creates an advice before the defined point-cut. The advice will be executed before the point-cut method
|
|
288
|
+
* but cannot modify the behavior of the method, or prevent its execution.
|
|
289
|
+
* This function returns an array of weaved aspects (Function).
|
|
290
|
+
*
|
|
291
|
+
* @example jQuery.aop.before( {target: window, method: 'MyGlobalMethod'}, function() {
|
|
292
|
+
* alert('About to execute MyGlobalMethod');
|
|
293
|
+
* } );
|
|
294
|
+
* @result Array<Function>
|
|
295
|
+
*
|
|
296
|
+
* @example jQuery.aop.before( {target: String, method: 'indexOf'}, function(index) {
|
|
297
|
+
* alert('About to execute String.indexOf on: ' + this);
|
|
298
|
+
* } );
|
|
299
|
+
* @result Array<Function>
|
|
300
|
+
*
|
|
301
|
+
* @name before
|
|
302
|
+
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
|
|
303
|
+
* @option Object target Target object to be weaved.
|
|
304
|
+
* @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
|
|
305
|
+
* @param Function advice Function containing the code that will get called before the execution of the point-cut.
|
|
306
|
+
*
|
|
307
|
+
* @type Array<Function>
|
|
308
|
+
* @cat Plugins/General
|
|
309
|
+
*/
|
|
310
|
+
before : function(pointcut, advice)
|
|
311
|
+
{
|
|
312
|
+
return weave( pointcut, { type: _before, value: advice } );
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Creates an advice 'around' the defined point-cut. This type of advice can control the point-cut method execution by calling
|
|
318
|
+
* the functions '.proceed()' on the 'invocation' object, and also, can modify the arguments collection before sending them to the function call.
|
|
319
|
+
* This function returns an array of weaved aspects (Function).
|
|
320
|
+
*
|
|
321
|
+
* @example jQuery.aop.around( {target: window, method: 'MyGlobalMethod'}, function(invocation) {
|
|
322
|
+
* alert('# of Arguments: ' + invocation.arguments.length);
|
|
323
|
+
* return invocation.proceed();
|
|
324
|
+
* } );
|
|
325
|
+
* @result Array<Function>
|
|
326
|
+
*
|
|
327
|
+
* @example jQuery.aop.around( {target: String, method: 'indexOf'}, function(invocation) {
|
|
328
|
+
* alert('Searching: ' + invocation.arguments[0] + ' on: ' + this);
|
|
329
|
+
* return invocation.proceed();
|
|
330
|
+
* } );
|
|
331
|
+
* @result Array<Function>
|
|
332
|
+
*
|
|
333
|
+
* @example jQuery.aop.around( {target: window, method: /Get(\d+)/}, function(invocation) {
|
|
334
|
+
* alert('Executing ' + invocation.method);
|
|
335
|
+
* return invocation.proceed();
|
|
336
|
+
* } );
|
|
337
|
+
* @desc Matches all global methods starting with 'Get' and followed by a number.
|
|
338
|
+
* @result Array<Function>
|
|
339
|
+
*
|
|
340
|
+
*
|
|
341
|
+
* @name around
|
|
342
|
+
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
|
|
343
|
+
* @option Object target Target object to be weaved.
|
|
344
|
+
* @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
|
|
345
|
+
* @param Function advice Function containing the code that will get called around the execution of the point-cut. This advice will be called with one
|
|
346
|
+
* argument containing one function '.proceed()', the collection of arguments '.arguments', and the matched method name '.method'.
|
|
347
|
+
*
|
|
348
|
+
* @type Array<Function>
|
|
349
|
+
* @cat Plugins/General
|
|
350
|
+
*/
|
|
351
|
+
around : function(pointcut, advice)
|
|
352
|
+
{
|
|
353
|
+
return weave( pointcut, { type: _around, value: advice } );
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Creates an introduction on the defined point-cut. This type of advice replaces any existing methods with the same
|
|
358
|
+
* name. To restore them, just unweave it.
|
|
359
|
+
* This function returns an array with only one weaved aspect (Function).
|
|
360
|
+
*
|
|
361
|
+
* @example jQuery.aop.introduction( {target: window, method: 'MyGlobalMethod'}, function(result) {
|
|
362
|
+
* alert('Returned: ' + result);
|
|
363
|
+
* } );
|
|
364
|
+
* @result Array<Function>
|
|
365
|
+
*
|
|
366
|
+
* @example jQuery.aop.introduction( {target: String, method: 'log'}, function() {
|
|
367
|
+
* alert('Console: ' + this);
|
|
368
|
+
* } );
|
|
369
|
+
* @result Array<Function>
|
|
370
|
+
*
|
|
371
|
+
* @name introduction
|
|
372
|
+
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
|
|
373
|
+
* @option Object target Target object to be weaved.
|
|
374
|
+
* @option String method Name of the function to be weaved.
|
|
375
|
+
* @param Function advice Function containing the code that will be executed on the point-cut.
|
|
376
|
+
*
|
|
377
|
+
* @type Array<Function>
|
|
378
|
+
* @cat Plugins/General
|
|
379
|
+
*/
|
|
380
|
+
introduction : function(pointcut, advice)
|
|
381
|
+
{
|
|
382
|
+
return weave( pointcut, { type: _intro, value: advice } );
|
|
383
|
+
},
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Configures global options.
|
|
387
|
+
*
|
|
388
|
+
* @name setup
|
|
389
|
+
* @param Map settings Configuration options.
|
|
390
|
+
* @option Boolean regexMatch Enables/disables regex matching of method names.
|
|
391
|
+
*
|
|
392
|
+
* @example jQuery.aop.setup( { regexMatch: false } );
|
|
393
|
+
* @desc Disable regex matching.
|
|
394
|
+
*
|
|
395
|
+
* @type Void
|
|
396
|
+
* @cat Plugins/General
|
|
397
|
+
*/
|
|
398
|
+
setup: function(settings)
|
|
399
|
+
{
|
|
400
|
+
_regexEnabled = settings.regexMatch;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
})();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jquery-aop",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Add features of aspect-oriented programming (AOP) to jQuery.",
|
|
5
|
+
"main": "aop.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/gonzalocasas/jquery-aop.git"
|
|
9
|
+
},
|
|
10
|
+
"author": "Gonzalo Casas <gonzalocasas@gmail.com>",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/gonzalocasas/jquery-aop/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/gonzalocasas/jquery-aop"
|
|
16
|
+
}
|