-
Notifications
You must be signed in to change notification settings - Fork 556
Expand file tree
/
Copy pathjquery.js
More file actions
77 lines (68 loc) · 1.83 KB
/
jquery.js
File metadata and controls
77 lines (68 loc) · 1.83 KB
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
/**
* The {@link http://learn.jquery.com/plugins/|jQuery Plugins} namespace
* @external "jQuery.fn"
*/
/**
* Instanciates or accesses the {@link QueryBuilder} on an element
* @function
* @memberof external:"jQuery.fn"
* @param {*} option - initial configuration or method name
* @param {...*} args - method arguments
*
* @example
* $('#builder').queryBuilder({ /** configuration object *\/ });
* @example
* $('#builder').queryBuilder('methodName', methodParam1, methodParam2);
*/
$.fn.queryBuilder = function(option) {
if (this.length === 0) {
Utils.error('Config', 'No target defined');
}
if (this.length > 1) {
Utils.error('Config', 'Unable to initialize on multiple target');
}
var data = this.data('queryBuilder');
var options = (typeof option == 'object' && option) || {};
if (!data && option == 'destroy') {
return this;
}
if (!data) {
var builder = new QueryBuilder(this, options);
this.data('queryBuilder', builder);
builder.init(options.rules);
}
if (typeof option == 'string') {
return data[option].apply(data, Array.prototype.slice.call(arguments, 1));
}
return this;
};
/**
* @function
* @memberof external:"jQuery.fn"
* @see QueryBuilder
*/
$.fn.queryBuilder.constructor = QueryBuilder;
/**
* @function
* @memberof external:"jQuery.fn"
* @see QueryBuilder.defaults
*/
$.fn.queryBuilder.defaults = QueryBuilder.defaults;
/**
* @function
* @memberof external:"jQuery.fn"
* @see QueryBuilder.defaults
*/
$.fn.queryBuilder.extend = QueryBuilder.extend;
/**
* @function
* @memberof external:"jQuery.fn"
* @see QueryBuilder.define
*/
$.fn.queryBuilder.define = QueryBuilder.define;
/**
* @function
* @memberof external:"jQuery.fn"
* @see QueryBuilder.regional
*/
$.fn.queryBuilder.regional = QueryBuilder.regional;