Revision 38675
Added by Sandro La Bruzzo almost 9 years ago
modules/dli-service-portal/trunk/static/bower_components/jquery/src/callbacks.js | ||
---|---|---|
1 |
define([ |
|
2 |
"./core", |
|
3 |
"./var/rnotwhite" |
|
4 |
], function( jQuery, rnotwhite ) { |
|
5 |
|
|
6 |
// String to Object options format cache |
|
7 |
var optionsCache = {}; |
|
8 |
|
|
9 |
// Convert String-formatted options into Object-formatted ones and store in cache |
|
10 |
function createOptions( options ) { |
|
11 |
var object = optionsCache[ options ] = {}; |
|
12 |
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { |
|
13 |
object[ flag ] = true; |
|
14 |
}); |
|
15 |
return object; |
|
16 |
} |
|
17 |
|
|
18 |
/* |
|
19 |
* Create a callback list using the following parameters: |
|
20 |
* |
|
21 |
* options: an optional list of space-separated options that will change how |
|
22 |
* the callback list behaves or a more traditional option object |
|
23 |
* |
|
24 |
* By default a callback list will act like an event callback list and can be |
|
25 |
* "fired" multiple times. |
|
26 |
* |
|
27 |
* Possible options: |
|
28 |
* |
|
29 |
* once: will ensure the callback list can only be fired once (like a Deferred) |
|
30 |
* |
|
31 |
* memory: will keep track of previous values and will call any callback added |
|
32 |
* after the list has been fired right away with the latest "memorized" |
|
33 |
* values (like a Deferred) |
|
34 |
* |
|
35 |
* unique: will ensure a callback can only be added once (no duplicate in the list) |
|
36 |
* |
|
37 |
* stopOnFalse: interrupt callings when a callback returns false |
|
38 |
* |
|
39 |
*/ |
|
40 |
jQuery.Callbacks = function( options ) { |
|
41 |
|
|
42 |
// Convert options from String-formatted to Object-formatted if needed |
|
43 |
// (we check in cache first) |
|
44 |
options = typeof options === "string" ? |
|
45 |
( optionsCache[ options ] || createOptions( options ) ) : |
|
46 |
jQuery.extend( {}, options ); |
|
47 |
|
|
48 |
var // Last fire value (for non-forgettable lists) |
|
49 |
memory, |
|
50 |
// Flag to know if list was already fired |
|
51 |
fired, |
|
52 |
// Flag to know if list is currently firing |
|
53 |
firing, |
|
54 |
// First callback to fire (used internally by add and fireWith) |
|
55 |
firingStart, |
|
56 |
// End of the loop when firing |
|
57 |
firingLength, |
|
58 |
// Index of currently firing callback (modified by remove if needed) |
|
59 |
firingIndex, |
|
60 |
// Actual callback list |
|
61 |
list = [], |
|
62 |
// Stack of fire calls for repeatable lists |
|
63 |
stack = !options.once && [], |
|
64 |
// Fire callbacks |
|
65 |
fire = function( data ) { |
|
66 |
memory = options.memory && data; |
|
67 |
fired = true; |
|
68 |
firingIndex = firingStart || 0; |
|
69 |
firingStart = 0; |
|
70 |
firingLength = list.length; |
|
71 |
firing = true; |
|
72 |
for ( ; list && firingIndex < firingLength; firingIndex++ ) { |
|
73 |
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { |
|
74 |
memory = false; // To prevent further calls using add |
|
75 |
break; |
|
76 |
} |
|
77 |
} |
|
78 |
firing = false; |
|
79 |
if ( list ) { |
|
80 |
if ( stack ) { |
|
81 |
if ( stack.length ) { |
|
82 |
fire( stack.shift() ); |
|
83 |
} |
|
84 |
} else if ( memory ) { |
|
85 |
list = []; |
|
86 |
} else { |
|
87 |
self.disable(); |
|
88 |
} |
|
89 |
} |
|
90 |
}, |
|
91 |
// Actual Callbacks object |
|
92 |
self = { |
|
93 |
// Add a callback or a collection of callbacks to the list |
|
94 |
add: function() { |
|
95 |
if ( list ) { |
|
96 |
// First, we save the current length |
|
97 |
var start = list.length; |
|
98 |
(function add( args ) { |
|
99 |
jQuery.each( args, function( _, arg ) { |
|
100 |
var type = jQuery.type( arg ); |
|
101 |
if ( type === "function" ) { |
|
102 |
if ( !options.unique || !self.has( arg ) ) { |
|
103 |
list.push( arg ); |
|
104 |
} |
|
105 |
} else if ( arg && arg.length && type !== "string" ) { |
|
106 |
// Inspect recursively |
|
107 |
add( arg ); |
|
108 |
} |
|
109 |
}); |
|
110 |
})( arguments ); |
|
111 |
// Do we need to add the callbacks to the |
|
112 |
// current firing batch? |
|
113 |
if ( firing ) { |
|
114 |
firingLength = list.length; |
|
115 |
// With memory, if we're not firing then |
|
116 |
// we should call right away |
|
117 |
} else if ( memory ) { |
|
118 |
firingStart = start; |
|
119 |
fire( memory ); |
|
120 |
} |
|
121 |
} |
|
122 |
return this; |
|
123 |
}, |
|
124 |
// Remove a callback from the list |
|
125 |
remove: function() { |
|
126 |
if ( list ) { |
|
127 |
jQuery.each( arguments, function( _, arg ) { |
|
128 |
var index; |
|
129 |
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { |
|
130 |
list.splice( index, 1 ); |
|
131 |
// Handle firing indexes |
|
132 |
if ( firing ) { |
|
133 |
if ( index <= firingLength ) { |
|
134 |
firingLength--; |
|
135 |
} |
|
136 |
if ( index <= firingIndex ) { |
|
137 |
firingIndex--; |
|
138 |
} |
|
139 |
} |
|
140 |
} |
|
141 |
}); |
|
142 |
} |
|
143 |
return this; |
|
144 |
}, |
|
145 |
// Check if a given callback is in the list. |
|
146 |
// If no argument is given, return whether or not list has callbacks attached. |
|
147 |
has: function( fn ) { |
|
148 |
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); |
|
149 |
}, |
|
150 |
// Remove all callbacks from the list |
|
151 |
empty: function() { |
|
152 |
list = []; |
|
153 |
firingLength = 0; |
|
154 |
return this; |
|
155 |
}, |
|
156 |
// Have the list do nothing anymore |
|
157 |
disable: function() { |
|
158 |
list = stack = memory = undefined; |
|
159 |
return this; |
|
160 |
}, |
|
161 |
// Is it disabled? |
|
162 |
disabled: function() { |
|
163 |
return !list; |
|
164 |
}, |
|
165 |
// Lock the list in its current state |
|
166 |
lock: function() { |
|
167 |
stack = undefined; |
|
168 |
if ( !memory ) { |
|
169 |
self.disable(); |
|
170 |
} |
|
171 |
return this; |
|
172 |
}, |
|
173 |
// Is it locked? |
|
174 |
locked: function() { |
|
175 |
return !stack; |
|
176 |
}, |
|
177 |
// Call all callbacks with the given context and arguments |
|
178 |
fireWith: function( context, args ) { |
|
179 |
if ( list && ( !fired || stack ) ) { |
|
180 |
args = args || []; |
|
181 |
args = [ context, args.slice ? args.slice() : args ]; |
|
182 |
if ( firing ) { |
|
183 |
stack.push( args ); |
|
184 |
} else { |
|
185 |
fire( args ); |
|
186 |
} |
|
187 |
} |
|
188 |
return this; |
|
189 |
}, |
|
190 |
// Call all the callbacks with the given arguments |
|
191 |
fire: function() { |
|
192 |
self.fireWith( this, arguments ); |
|
193 |
return this; |
|
194 |
}, |
|
195 |
// To know if the callbacks have already been called at least once |
|
196 |
fired: function() { |
|
197 |
return !!fired; |
|
198 |
} |
|
199 |
}; |
|
200 |
|
|
201 |
return self; |
|
202 |
}; |
|
203 |
|
|
204 |
return jQuery; |
|
205 |
}); |
modules/dli-service-portal/trunk/static/bower_components/jquery/src/attributes/classes.js | ||
---|---|---|
1 |
define([ |
|
2 |
"../core", |
|
3 |
"../var/rnotwhite", |
|
4 |
"../var/strundefined", |
|
5 |
"../data/var/data_priv", |
|
6 |
"../core/init" |
|
7 |
], function( jQuery, rnotwhite, strundefined, data_priv ) { |
|
8 |
|
|
9 |
var rclass = /[\t\r\n\f]/g; |
|
10 |
|
|
11 |
jQuery.fn.extend({ |
|
12 |
addClass: function( value ) { |
|
13 |
var classes, elem, cur, clazz, j, finalValue, |
|
14 |
proceed = typeof value === "string" && value, |
|
15 |
i = 0, |
|
16 |
len = this.length; |
|
17 |
|
|
18 |
if ( jQuery.isFunction( value ) ) { |
|
19 |
return this.each(function( j ) { |
|
20 |
jQuery( this ).addClass( value.call( this, j, this.className ) ); |
|
21 |
}); |
|
22 |
} |
|
23 |
|
|
24 |
if ( proceed ) { |
|
25 |
// The disjunction here is for better compressibility (see removeClass) |
|
26 |
classes = ( value || "" ).match( rnotwhite ) || []; |
|
27 |
|
|
28 |
for ( ; i < len; i++ ) { |
|
29 |
elem = this[ i ]; |
|
30 |
cur = elem.nodeType === 1 && ( elem.className ? |
|
31 |
( " " + elem.className + " " ).replace( rclass, " " ) : |
|
32 |
" " |
|
33 |
); |
|
34 |
|
|
35 |
if ( cur ) { |
|
36 |
j = 0; |
|
37 |
while ( (clazz = classes[j++]) ) { |
|
38 |
if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
|
39 |
cur += clazz + " "; |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
// only assign if different to avoid unneeded rendering. |
|
44 |
finalValue = jQuery.trim( cur ); |
|
45 |
if ( elem.className !== finalValue ) { |
|
46 |
elem.className = finalValue; |
|
47 |
} |
|
48 |
} |
|
49 |
} |
|
50 |
} |
|
51 |
|
|
52 |
return this; |
|
53 |
}, |
|
54 |
|
|
55 |
removeClass: function( value ) { |
|
56 |
var classes, elem, cur, clazz, j, finalValue, |
|
57 |
proceed = arguments.length === 0 || typeof value === "string" && value, |
|
58 |
i = 0, |
|
59 |
len = this.length; |
|
60 |
|
|
61 |
if ( jQuery.isFunction( value ) ) { |
|
62 |
return this.each(function( j ) { |
|
63 |
jQuery( this ).removeClass( value.call( this, j, this.className ) ); |
|
64 |
}); |
|
65 |
} |
|
66 |
if ( proceed ) { |
|
67 |
classes = ( value || "" ).match( rnotwhite ) || []; |
|
68 |
|
|
69 |
for ( ; i < len; i++ ) { |
|
70 |
elem = this[ i ]; |
|
71 |
// This expression is here for better compressibility (see addClass) |
|
72 |
cur = elem.nodeType === 1 && ( elem.className ? |
|
73 |
( " " + elem.className + " " ).replace( rclass, " " ) : |
|
74 |
"" |
|
75 |
); |
|
76 |
|
|
77 |
if ( cur ) { |
|
78 |
j = 0; |
|
79 |
while ( (clazz = classes[j++]) ) { |
|
80 |
// Remove *all* instances |
|
81 |
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { |
|
82 |
cur = cur.replace( " " + clazz + " ", " " ); |
|
83 |
} |
|
84 |
} |
|
85 |
|
|
86 |
// Only assign if different to avoid unneeded rendering. |
|
87 |
finalValue = value ? jQuery.trim( cur ) : ""; |
|
88 |
if ( elem.className !== finalValue ) { |
|
89 |
elem.className = finalValue; |
|
90 |
} |
|
91 |
} |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
return this; |
|
96 |
}, |
|
97 |
|
|
98 |
toggleClass: function( value, stateVal ) { |
|
99 |
var type = typeof value; |
|
100 |
|
|
101 |
if ( typeof stateVal === "boolean" && type === "string" ) { |
|
102 |
return stateVal ? this.addClass( value ) : this.removeClass( value ); |
|
103 |
} |
|
104 |
|
|
105 |
if ( jQuery.isFunction( value ) ) { |
|
106 |
return this.each(function( i ) { |
|
107 |
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); |
|
108 |
}); |
|
109 |
} |
|
110 |
|
|
111 |
return this.each(function() { |
|
112 |
if ( type === "string" ) { |
|
113 |
// Toggle individual class names |
|
114 |
var className, |
|
115 |
i = 0, |
|
116 |
self = jQuery( this ), |
|
117 |
classNames = value.match( rnotwhite ) || []; |
|
118 |
|
|
119 |
while ( (className = classNames[ i++ ]) ) { |
|
120 |
// Check each className given, space separated list |
|
121 |
if ( self.hasClass( className ) ) { |
|
122 |
self.removeClass( className ); |
|
123 |
} else { |
|
124 |
self.addClass( className ); |
|
125 |
} |
|
126 |
} |
|
127 |
|
|
128 |
// Toggle whole class name |
|
129 |
} else if ( type === strundefined || type === "boolean" ) { |
|
130 |
if ( this.className ) { |
|
131 |
// store className if set |
|
132 |
data_priv.set( this, "__className__", this.className ); |
|
133 |
} |
|
134 |
|
|
135 |
// If the element has a class name or if we're passed `false`, |
|
136 |
// then remove the whole classname (if there was one, the above saved it). |
|
137 |
// Otherwise bring back whatever was previously saved (if anything), |
|
138 |
// falling back to the empty string if nothing was stored. |
|
139 |
this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || ""; |
|
140 |
} |
|
141 |
}); |
|
142 |
}, |
|
143 |
|
|
144 |
hasClass: function( selector ) { |
|
145 |
var className = " " + selector + " ", |
|
146 |
i = 0, |
|
147 |
l = this.length; |
|
148 |
for ( ; i < l; i++ ) { |
|
149 |
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { |
|
150 |
return true; |
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
return false; |
|
155 |
} |
|
156 |
}); |
|
157 |
|
|
158 |
}); |
modules/dli-service-portal/trunk/static/bower_components/jquery/src/traversing.js | ||
---|---|---|
1 |
define([ |
|
2 |
"./core", |
|
3 |
"./var/indexOf", |
|
4 |
"./traversing/var/rneedsContext", |
|
5 |
"./core/init", |
|
6 |
"./traversing/findFilter", |
|
7 |
"./selector" |
|
8 |
], function( jQuery, indexOf, rneedsContext ) { |
|
9 |
|
|
10 |
var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
|
11 |
// Methods guaranteed to produce a unique set when starting from a unique set |
|
12 |
guaranteedUnique = { |
|
13 |
children: true, |
|
14 |
contents: true, |
|
15 |
next: true, |
|
16 |
prev: true |
|
17 |
}; |
|
18 |
|
|
19 |
jQuery.extend({ |
|
20 |
dir: function( elem, dir, until ) { |
|
21 |
var matched = [], |
|
22 |
truncate = until !== undefined; |
|
23 |
|
|
24 |
while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { |
|
25 |
if ( elem.nodeType === 1 ) { |
|
26 |
if ( truncate && jQuery( elem ).is( until ) ) { |
|
27 |
break; |
|
28 |
} |
|
29 |
matched.push( elem ); |
|
30 |
} |
|
31 |
} |
|
32 |
return matched; |
|
33 |
}, |
|
34 |
|
|
35 |
sibling: function( n, elem ) { |
|
36 |
var matched = []; |
|
37 |
|
|
38 |
for ( ; n; n = n.nextSibling ) { |
|
39 |
if ( n.nodeType === 1 && n !== elem ) { |
|
40 |
matched.push( n ); |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
return matched; |
|
45 |
} |
|
46 |
}); |
|
47 |
|
|
48 |
jQuery.fn.extend({ |
|
49 |
has: function( target ) { |
|
50 |
var targets = jQuery( target, this ), |
|
51 |
l = targets.length; |
|
52 |
|
|
53 |
return this.filter(function() { |
|
54 |
var i = 0; |
|
55 |
for ( ; i < l; i++ ) { |
|
56 |
if ( jQuery.contains( this, targets[i] ) ) { |
|
57 |
return true; |
|
58 |
} |
|
59 |
} |
|
60 |
}); |
|
61 |
}, |
|
62 |
|
|
63 |
closest: function( selectors, context ) { |
|
64 |
var cur, |
|
65 |
i = 0, |
|
66 |
l = this.length, |
|
67 |
matched = [], |
|
68 |
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? |
|
69 |
jQuery( selectors, context || this.context ) : |
|
70 |
0; |
|
71 |
|
|
72 |
for ( ; i < l; i++ ) { |
|
73 |
for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { |
|
74 |
// Always skip document fragments |
|
75 |
if ( cur.nodeType < 11 && (pos ? |
|
76 |
pos.index(cur) > -1 : |
|
77 |
|
|
78 |
// Don't pass non-elements to Sizzle |
|
79 |
cur.nodeType === 1 && |
|
80 |
jQuery.find.matchesSelector(cur, selectors)) ) { |
|
81 |
|
|
82 |
matched.push( cur ); |
|
83 |
break; |
|
84 |
} |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
88 |
return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); |
|
89 |
}, |
|
90 |
|
|
91 |
// Determine the position of an element within the set |
|
92 |
index: function( elem ) { |
|
93 |
|
|
94 |
// No argument, return index in parent |
|
95 |
if ( !elem ) { |
|
96 |
return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; |
|
97 |
} |
|
98 |
|
|
99 |
// Index in selector |
|
100 |
if ( typeof elem === "string" ) { |
|
101 |
return indexOf.call( jQuery( elem ), this[ 0 ] ); |
|
102 |
} |
|
103 |
|
|
104 |
// Locate the position of the desired element |
|
105 |
return indexOf.call( this, |
|
106 |
|
|
107 |
// If it receives a jQuery object, the first element is used |
|
108 |
elem.jquery ? elem[ 0 ] : elem |
|
109 |
); |
|
110 |
}, |
|
111 |
|
|
112 |
add: function( selector, context ) { |
|
113 |
return this.pushStack( |
|
114 |
jQuery.unique( |
|
115 |
jQuery.merge( this.get(), jQuery( selector, context ) ) |
|
116 |
) |
|
117 |
); |
|
118 |
}, |
|
119 |
|
|
120 |
addBack: function( selector ) { |
|
121 |
return this.add( selector == null ? |
|
122 |
this.prevObject : this.prevObject.filter(selector) |
|
123 |
); |
|
124 |
} |
|
125 |
}); |
|
126 |
|
|
127 |
function sibling( cur, dir ) { |
|
128 |
while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} |
|
129 |
return cur; |
|
130 |
} |
|
131 |
|
|
132 |
jQuery.each({ |
|
133 |
parent: function( elem ) { |
|
134 |
var parent = elem.parentNode; |
|
135 |
return parent && parent.nodeType !== 11 ? parent : null; |
|
136 |
}, |
|
137 |
parents: function( elem ) { |
|
138 |
return jQuery.dir( elem, "parentNode" ); |
|
139 |
}, |
|
140 |
parentsUntil: function( elem, i, until ) { |
|
141 |
return jQuery.dir( elem, "parentNode", until ); |
|
142 |
}, |
|
143 |
next: function( elem ) { |
|
144 |
return sibling( elem, "nextSibling" ); |
|
145 |
}, |
|
146 |
prev: function( elem ) { |
|
147 |
return sibling( elem, "previousSibling" ); |
|
148 |
}, |
|
149 |
nextAll: function( elem ) { |
|
150 |
return jQuery.dir( elem, "nextSibling" ); |
|
151 |
}, |
|
152 |
prevAll: function( elem ) { |
|
153 |
return jQuery.dir( elem, "previousSibling" ); |
|
154 |
}, |
|
155 |
nextUntil: function( elem, i, until ) { |
|
156 |
return jQuery.dir( elem, "nextSibling", until ); |
|
157 |
}, |
|
158 |
prevUntil: function( elem, i, until ) { |
|
159 |
return jQuery.dir( elem, "previousSibling", until ); |
|
160 |
}, |
|
161 |
siblings: function( elem ) { |
|
162 |
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); |
|
163 |
}, |
|
164 |
children: function( elem ) { |
|
165 |
return jQuery.sibling( elem.firstChild ); |
|
166 |
}, |
|
167 |
contents: function( elem ) { |
|
168 |
return elem.contentDocument || jQuery.merge( [], elem.childNodes ); |
|
169 |
} |
|
170 |
}, function( name, fn ) { |
|
171 |
jQuery.fn[ name ] = function( until, selector ) { |
|
172 |
var matched = jQuery.map( this, fn, until ); |
|
173 |
|
|
174 |
if ( name.slice( -5 ) !== "Until" ) { |
|
175 |
selector = until; |
|
176 |
} |
|
177 |
|
|
178 |
if ( selector && typeof selector === "string" ) { |
|
179 |
matched = jQuery.filter( selector, matched ); |
|
180 |
} |
|
181 |
|
|
182 |
if ( this.length > 1 ) { |
|
183 |
// Remove duplicates |
|
184 |
if ( !guaranteedUnique[ name ] ) { |
|
185 |
jQuery.unique( matched ); |
|
186 |
} |
|
187 |
|
|
188 |
// Reverse order for parents* and prev-derivatives |
|
189 |
if ( rparentsprev.test( name ) ) { |
|
190 |
matched.reverse(); |
|
191 |
} |
|
192 |
} |
|
193 |
|
|
194 |
return this.pushStack( matched ); |
|
195 |
}; |
|
196 |
}); |
|
197 |
|
|
198 |
return jQuery; |
|
199 |
}); |
modules/dli-service-portal/trunk/static/bower_components/jquery/src/manipulation/support.js | ||
---|---|---|
1 |
define([ |
|
2 |
"../var/support" |
|
3 |
], function( support ) { |
|
4 |
|
|
5 |
(function() { |
|
6 |
var fragment = document.createDocumentFragment(), |
|
7 |
div = fragment.appendChild( document.createElement( "div" ) ), |
|
8 |
input = document.createElement( "input" ); |
|
9 |
|
|
10 |
// Support: Safari<=5.1 |
|
11 |
// Check state lost if the name is set (#11217) |
|
12 |
// Support: Windows Web Apps (WWA) |
|
13 |
// `name` and `type` must use .setAttribute for WWA (#14901) |
|
14 |
input.setAttribute( "type", "radio" ); |
|
15 |
input.setAttribute( "checked", "checked" ); |
|
16 |
input.setAttribute( "name", "t" ); |
|
17 |
|
|
18 |
div.appendChild( input ); |
|
19 |
|
|
20 |
// Support: Safari<=5.1, Android<4.2 |
|
21 |
// Older WebKit doesn't clone checked state correctly in fragments |
|
22 |
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; |
|
23 |
|
|
24 |
// Support: IE<=11+ |
|
25 |
// Make sure textarea (and checkbox) defaultValue is properly cloned |
|
26 |
div.innerHTML = "<textarea>x</textarea>"; |
|
27 |
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; |
|
28 |
})(); |
|
29 |
|
|
30 |
return support; |
|
31 |
|
|
32 |
}); |
modules/dli-service-portal/trunk/static/bower_components/jquery/src/attributes/val.js | ||
---|---|---|
1 |
define([ |
|
2 |
"../core", |
|
3 |
"./support", |
|
4 |
"../core/init" |
|
5 |
], function( jQuery, support ) { |
|
6 |
|
|
7 |
var rreturn = /\r/g; |
|
8 |
|
|
9 |
jQuery.fn.extend({ |
|
10 |
val: function( value ) { |
|
11 |
var hooks, ret, isFunction, |
|
12 |
elem = this[0]; |
|
13 |
|
|
14 |
if ( !arguments.length ) { |
|
15 |
if ( elem ) { |
|
16 |
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; |
|
17 |
|
|
18 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { |
|
19 |
return ret; |
|
20 |
} |
|
21 |
|
|
22 |
ret = elem.value; |
|
23 |
|
|
24 |
return typeof ret === "string" ? |
|
25 |
// Handle most common string cases |
|
26 |
ret.replace(rreturn, "") : |
|
27 |
// Handle cases where value is null/undef or number |
|
28 |
ret == null ? "" : ret; |
|
29 |
} |
|
30 |
|
|
31 |
return; |
|
32 |
} |
|
33 |
|
|
34 |
isFunction = jQuery.isFunction( value ); |
|
35 |
|
|
36 |
return this.each(function( i ) { |
|
37 |
var val; |
|
38 |
|
|
39 |
if ( this.nodeType !== 1 ) { |
|
40 |
return; |
|
41 |
} |
|
42 |
|
|
43 |
if ( isFunction ) { |
|
44 |
val = value.call( this, i, jQuery( this ).val() ); |
|
45 |
} else { |
|
46 |
val = value; |
|
47 |
} |
|
48 |
|
|
49 |
// Treat null/undefined as ""; convert numbers to string |
|
50 |
if ( val == null ) { |
|
51 |
val = ""; |
|
52 |
|
|
53 |
} else if ( typeof val === "number" ) { |
|
54 |
val += ""; |
|
55 |
|
|
56 |
} else if ( jQuery.isArray( val ) ) { |
|
57 |
val = jQuery.map( val, function( value ) { |
|
58 |
return value == null ? "" : value + ""; |
|
59 |
}); |
|
60 |
} |
|
61 |
|
|
62 |
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; |
|
63 |
|
|
64 |
// If set returns undefined, fall back to normal setting |
|
65 |
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { |
|
66 |
this.value = val; |
|
67 |
} |
|
68 |
}); |
|
69 |
} |
|
70 |
}); |
|
71 |
|
|
72 |
jQuery.extend({ |
|
73 |
valHooks: { |
|
74 |
option: { |
|
75 |
get: function( elem ) { |
|
76 |
var val = jQuery.find.attr( elem, "value" ); |
|
77 |
return val != null ? |
|
78 |
val : |
|
79 |
// Support: IE10-11+ |
|
80 |
// option.text throws exceptions (#14686, #14858) |
|
81 |
jQuery.trim( jQuery.text( elem ) ); |
|
82 |
} |
|
83 |
}, |
|
84 |
select: { |
|
85 |
get: function( elem ) { |
|
86 |
var value, option, |
|
87 |
options = elem.options, |
|
88 |
index = elem.selectedIndex, |
|
89 |
one = elem.type === "select-one" || index < 0, |
|
90 |
values = one ? null : [], |
|
91 |
max = one ? index + 1 : options.length, |
|
92 |
i = index < 0 ? |
|
93 |
max : |
|
94 |
one ? index : 0; |
|
95 |
|
|
96 |
// Loop through all the selected options |
|
97 |
for ( ; i < max; i++ ) { |
|
98 |
option = options[ i ]; |
|
99 |
|
|
100 |
// IE6-9 doesn't update selected after form reset (#2551) |
|
101 |
if ( ( option.selected || i === index ) && |
|
102 |
// Don't return options that are disabled or in a disabled optgroup |
|
103 |
( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) && |
|
104 |
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { |
|
105 |
|
|
106 |
// Get the specific value for the option |
|
107 |
value = jQuery( option ).val(); |
|
108 |
|
|
109 |
// We don't need an array for one selects |
|
110 |
if ( one ) { |
|
111 |
return value; |
|
112 |
} |
|
113 |
|
|
114 |
// Multi-Selects return an array |
|
115 |
values.push( value ); |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
return values; |
|
120 |
}, |
|
121 |
|
|
122 |
set: function( elem, value ) { |
|
123 |
var optionSet, option, |
|
124 |
options = elem.options, |
|
125 |
values = jQuery.makeArray( value ), |
|
126 |
i = options.length; |
|
127 |
|
|
128 |
while ( i-- ) { |
|
129 |
option = options[ i ]; |
|
130 |
if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) { |
|
131 |
optionSet = true; |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
// Force browsers to behave consistently when non-matching value is set |
|
136 |
if ( !optionSet ) { |
|
137 |
elem.selectedIndex = -1; |
|
138 |
} |
|
139 |
return values; |
|
140 |
} |
|
141 |
} |
|
142 |
} |
|
143 |
}); |
|
144 |
|
|
145 |
// Radios and checkboxes getter/setter |
|
146 |
jQuery.each([ "radio", "checkbox" ], function() { |
|
147 |
jQuery.valHooks[ this ] = { |
|
148 |
set: function( elem, value ) { |
|
149 |
if ( jQuery.isArray( value ) ) { |
|
150 |
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); |
|
151 |
} |
|
152 |
} |
|
153 |
}; |
|
154 |
if ( !support.checkOn ) { |
|
155 |
jQuery.valHooks[ this ].get = function( elem ) { |
|
156 |
return elem.getAttribute("value") === null ? "on" : elem.value; |
|
157 |
}; |
|
158 |
} |
|
159 |
}); |
|
160 |
|
|
161 |
}); |
modules/dli-service-portal/trunk/static/bower_components/jquery/src/css.js | ||
---|---|---|
1 |
define([ |
|
2 |
"./core", |
|
3 |
"./var/pnum", |
|
4 |
"./core/access", |
|
5 |
"./css/var/rmargin", |
|
6 |
"./css/var/rnumnonpx", |
|
7 |
"./css/var/cssExpand", |
|
8 |
"./css/var/isHidden", |
|
9 |
"./css/var/getStyles", |
|
10 |
"./css/curCSS", |
|
11 |
"./css/defaultDisplay", |
|
12 |
"./css/addGetHookIf", |
|
13 |
"./css/support", |
|
14 |
"./data/var/data_priv", |
|
15 |
|
|
16 |
"./core/init", |
|
17 |
"./css/swap", |
|
18 |
"./core/ready", |
|
19 |
"./selector" // contains |
|
20 |
], function( jQuery, pnum, access, rmargin, rnumnonpx, cssExpand, isHidden, |
|
21 |
getStyles, curCSS, defaultDisplay, addGetHookIf, support, data_priv ) { |
|
22 |
|
|
23 |
var |
|
24 |
// Swappable if display is none or starts with table except "table", "table-cell", or "table-caption" |
|
25 |
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
|
26 |
rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
|
27 |
rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), |
|
28 |
rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), |
|
29 |
|
|
30 |
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
|
31 |
cssNormalTransform = { |
|
32 |
letterSpacing: "0", |
|
33 |
fontWeight: "400" |
|
34 |
}, |
|
35 |
|
|
36 |
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; |
|
37 |
|
|
38 |
// Return a css property mapped to a potentially vendor prefixed property |
|
39 |
function vendorPropName( style, name ) { |
|
40 |
|
|
41 |
// Shortcut for names that are not vendor prefixed |
|
42 |
if ( name in style ) { |
|
43 |
return name; |
|
44 |
} |
|
45 |
|
|
46 |
// Check for vendor prefixed names |
|
47 |
var capName = name[0].toUpperCase() + name.slice(1), |
|
48 |
origName = name, |
|
49 |
i = cssPrefixes.length; |
|
50 |
|
|
51 |
while ( i-- ) { |
|
52 |
name = cssPrefixes[ i ] + capName; |
|
53 |
if ( name in style ) { |
|
54 |
return name; |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
return origName; |
|
59 |
} |
|
60 |
|
|
61 |
function setPositiveNumber( elem, value, subtract ) { |
|
62 |
var matches = rnumsplit.exec( value ); |
|
63 |
return matches ? |
|
64 |
// Guard against undefined "subtract", e.g., when used as in cssHooks |
|
65 |
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : |
|
66 |
value; |
|
67 |
} |
|
68 |
|
|
69 |
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { |
|
70 |
var i = extra === ( isBorderBox ? "border" : "content" ) ? |
|
71 |
// If we already have the right measurement, avoid augmentation |
|
72 |
4 : |
|
73 |
// Otherwise initialize for horizontal or vertical properties |
|
74 |
name === "width" ? 1 : 0, |
|
75 |
|
|
76 |
val = 0; |
|
77 |
|
|
78 |
for ( ; i < 4; i += 2 ) { |
|
79 |
// Both box models exclude margin, so add it if we want it |
|
80 |
if ( extra === "margin" ) { |
|
81 |
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); |
|
82 |
} |
|
83 |
|
|
84 |
if ( isBorderBox ) { |
|
85 |
// border-box includes padding, so remove it if we want content |
|
86 |
if ( extra === "content" ) { |
|
87 |
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
|
88 |
} |
|
89 |
|
|
90 |
// At this point, extra isn't border nor margin, so remove border |
|
91 |
if ( extra !== "margin" ) { |
|
92 |
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
93 |
} |
|
94 |
} else { |
|
95 |
// At this point, extra isn't content, so add padding |
|
96 |
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
|
97 |
|
|
98 |
// At this point, extra isn't content nor padding, so add border |
|
99 |
if ( extra !== "padding" ) { |
|
100 |
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
101 |
} |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
return val; |
|
106 |
} |
|
107 |
|
|
108 |
function getWidthOrHeight( elem, name, extra ) { |
|
109 |
|
|
110 |
// Start with offset property, which is equivalent to the border-box value |
|
111 |
var valueIsBorderBox = true, |
|
112 |
val = name === "width" ? elem.offsetWidth : elem.offsetHeight, |
|
113 |
styles = getStyles( elem ), |
|
114 |
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; |
|
115 |
|
|
116 |
// Some non-html elements return undefined for offsetWidth, so check for null/undefined |
|
117 |
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 |
|
118 |
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 |
|
119 |
if ( val <= 0 || val == null ) { |
|
120 |
// Fall back to computed then uncomputed css if necessary |
|
121 |
val = curCSS( elem, name, styles ); |
|
122 |
if ( val < 0 || val == null ) { |
|
123 |
val = elem.style[ name ]; |
|
124 |
} |
|
125 |
|
|
126 |
// Computed unit is not pixels. Stop here and return. |
|
127 |
if ( rnumnonpx.test(val) ) { |
|
128 |
return val; |
|
129 |
} |
|
130 |
|
|
131 |
// Check for style in case a browser which returns unreliable values |
|
132 |
// for getComputedStyle silently falls back to the reliable elem.style |
|
133 |
valueIsBorderBox = isBorderBox && |
|
134 |
( support.boxSizingReliable() || val === elem.style[ name ] ); |
|
135 |
|
|
136 |
// Normalize "", auto, and prepare for extra |
|
137 |
val = parseFloat( val ) || 0; |
|
138 |
} |
|
139 |
|
|
140 |
// Use the active box-sizing model to add/subtract irrelevant styles |
|
141 |
return ( val + |
|
142 |
augmentWidthOrHeight( |
|
143 |
elem, |
|
144 |
name, |
|
145 |
extra || ( isBorderBox ? "border" : "content" ), |
|
146 |
valueIsBorderBox, |
|
147 |
styles |
|
148 |
) |
|
149 |
) + "px"; |
|
150 |
} |
|
151 |
|
|
152 |
function showHide( elements, show ) { |
|
153 |
var display, elem, hidden, |
|
154 |
values = [], |
|
155 |
index = 0, |
|
156 |
length = elements.length; |
|
157 |
|
|
158 |
for ( ; index < length; index++ ) { |
|
159 |
elem = elements[ index ]; |
|
160 |
if ( !elem.style ) { |
|
161 |
continue; |
|
162 |
} |
|
163 |
|
|
164 |
values[ index ] = data_priv.get( elem, "olddisplay" ); |
|
165 |
display = elem.style.display; |
|
166 |
if ( show ) { |
|
167 |
// Reset the inline display of this element to learn if it is |
|
168 |
// being hidden by cascaded rules or not |
|
169 |
if ( !values[ index ] && display === "none" ) { |
|
170 |
elem.style.display = ""; |
|
171 |
} |
|
172 |
|
|
173 |
// Set elements which have been overridden with display: none |
|
174 |
// in a stylesheet to whatever the default browser style is |
|
175 |
// for such an element |
|
176 |
if ( elem.style.display === "" && isHidden( elem ) ) { |
|
177 |
values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) ); |
|
178 |
} |
|
179 |
} else { |
|
180 |
hidden = isHidden( elem ); |
|
181 |
|
|
182 |
if ( display !== "none" || !hidden ) { |
|
183 |
data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); |
|
184 |
} |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
// Set the display of most of the elements in a second loop |
|
189 |
// to avoid the constant reflow |
|
190 |
for ( index = 0; index < length; index++ ) { |
|
191 |
elem = elements[ index ]; |
|
192 |
if ( !elem.style ) { |
|
193 |
continue; |
|
194 |
} |
|
195 |
if ( !show || elem.style.display === "none" || elem.style.display === "" ) { |
|
196 |
elem.style.display = show ? values[ index ] || "" : "none"; |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
200 |
return elements; |
|
201 |
} |
|
202 |
|
|
203 |
jQuery.extend({ |
|
204 |
|
|
205 |
// Add in style property hooks for overriding the default |
|
206 |
// behavior of getting and setting a style property |
|
207 |
cssHooks: { |
|
208 |
opacity: { |
|
209 |
get: function( elem, computed ) { |
|
210 |
if ( computed ) { |
|
211 |
|
|
212 |
// We should always get a number back from opacity |
|
213 |
var ret = curCSS( elem, "opacity" ); |
|
214 |
return ret === "" ? "1" : ret; |
|
215 |
} |
|
216 |
} |
|
217 |
} |
|
218 |
}, |
|
219 |
|
|
220 |
// Don't automatically add "px" to these possibly-unitless properties |
|
221 |
cssNumber: { |
|
222 |
"columnCount": true, |
|
223 |
"fillOpacity": true, |
|
224 |
"flexGrow": true, |
|
225 |
"flexShrink": true, |
|
226 |
"fontWeight": true, |
|
227 |
"lineHeight": true, |
|
228 |
"opacity": true, |
|
229 |
"order": true, |
|
230 |
"orphans": true, |
|
231 |
"widows": true, |
|
232 |
"zIndex": true, |
|
233 |
"zoom": true |
|
234 |
}, |
|
235 |
|
|
236 |
// Add in properties whose names you wish to fix before |
|
237 |
// setting or getting the value |
|
238 |
cssProps: { |
|
239 |
"float": "cssFloat" |
|
240 |
}, |
|
241 |
|
|
242 |
// Get and set the style property on a DOM Node |
|
243 |
style: function( elem, name, value, extra ) { |
|
244 |
|
|
245 |
// Don't set styles on text and comment nodes |
|
246 |
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { |
|
247 |
return; |
|
248 |
} |
|
249 |
|
|
250 |
// Make sure that we're working with the right name |
|
251 |
var ret, type, hooks, |
|
252 |
origName = jQuery.camelCase( name ), |
|
253 |
style = elem.style; |
|
254 |
|
|
255 |
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); |
|
256 |
|
|
257 |
// Gets hook for the prefixed version, then unprefixed version |
|
258 |
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
|
259 |
|
|
260 |
// Check if we're setting a value |
|
261 |
if ( value !== undefined ) { |
|
262 |
type = typeof value; |
|
263 |
|
|
264 |
// Convert "+=" or "-=" to relative numbers (#7345) |
|
265 |
if ( type === "string" && (ret = rrelNum.exec( value )) ) { |
|
266 |
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); |
|
267 |
// Fixes bug #9237 |
|
268 |
type = "number"; |
|
269 |
} |
|
270 |
|
|
271 |
// Make sure that null and NaN values aren't set (#7116) |
|
272 |
if ( value == null || value !== value ) { |
|
273 |
return; |
|
274 |
} |
|
275 |
|
|
276 |
// If a number, add 'px' to the (except for certain CSS properties) |
|
277 |
if ( type === "number" && !jQuery.cssNumber[ origName ] ) { |
|
278 |
value += "px"; |
|
279 |
} |
|
280 |
|
|
281 |
// Support: IE9-11+ |
|
282 |
// background-* props affect original clone's values |
|
283 |
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { |
|
284 |
style[ name ] = "inherit"; |
|
285 |
} |
|
286 |
|
|
287 |
// If a hook was provided, use that value, otherwise just set the specified value |
|
288 |
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { |
|
289 |
style[ name ] = value; |
|
290 |
} |
|
291 |
|
|
292 |
} else { |
|
293 |
// If a hook was provided get the non-computed value from there |
|
294 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { |
|
295 |
return ret; |
|
296 |
} |
|
297 |
|
|
298 |
// Otherwise just get the value from the style object |
|
299 |
return style[ name ]; |
|
300 |
} |
|
301 |
}, |
|
302 |
|
|
303 |
css: function( elem, name, extra, styles ) { |
|
304 |
var val, num, hooks, |
|
305 |
origName = jQuery.camelCase( name ); |
|
306 |
|
|
307 |
// Make sure that we're working with the right name |
|
308 |
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); |
|
309 |
|
|
310 |
// Try prefixed name followed by the unprefixed name |
|
311 |
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
|
312 |
|
|
313 |
// If a hook was provided get the computed value from there |
|
314 |
if ( hooks && "get" in hooks ) { |
|
315 |
val = hooks.get( elem, true, extra ); |
|
316 |
} |
|
317 |
|
|
318 |
// Otherwise, if a way to get the computed value exists, use that |
|
319 |
if ( val === undefined ) { |
|
320 |
val = curCSS( elem, name, styles ); |
|
321 |
} |
|
322 |
|
|
323 |
// Convert "normal" to computed value |
|
324 |
if ( val === "normal" && name in cssNormalTransform ) { |
|
325 |
val = cssNormalTransform[ name ]; |
|
326 |
} |
|
327 |
|
|
328 |
// Make numeric if forced or a qualifier was provided and val looks numeric |
|
329 |
if ( extra === "" || extra ) { |
|
330 |
num = parseFloat( val ); |
|
331 |
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; |
|
332 |
} |
|
333 |
return val; |
|
334 |
} |
|
335 |
}); |
|
336 |
|
|
337 |
jQuery.each([ "height", "width" ], function( i, name ) { |
|
338 |
jQuery.cssHooks[ name ] = { |
|
339 |
get: function( elem, computed, extra ) { |
|
340 |
if ( computed ) { |
|
341 |
|
|
342 |
// Certain elements can have dimension info if we invisibly show them |
|
343 |
// but it must have a current display style that would benefit |
|
344 |
return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? |
|
345 |
jQuery.swap( elem, cssShow, function() { |
|
346 |
return getWidthOrHeight( elem, name, extra ); |
|
347 |
}) : |
|
348 |
getWidthOrHeight( elem, name, extra ); |
|
349 |
} |
|
350 |
}, |
|
351 |
|
|
352 |
set: function( elem, value, extra ) { |
|
353 |
var styles = extra && getStyles( elem ); |
|
354 |
return setPositiveNumber( elem, value, extra ? |
|
355 |
augmentWidthOrHeight( |
|
356 |
elem, |
|
357 |
name, |
|
358 |
extra, |
|
359 |
jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
|
360 |
styles |
|
361 |
) : 0 |
|
362 |
); |
|
363 |
} |
|
364 |
}; |
|
365 |
}); |
|
366 |
|
|
367 |
// Support: Android 2.3 |
|
368 |
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, |
|
369 |
function( elem, computed ) { |
|
370 |
if ( computed ) { |
|
371 |
return jQuery.swap( elem, { "display": "inline-block" }, |
|
372 |
curCSS, [ elem, "marginRight" ] ); |
|
373 |
} |
|
374 |
} |
|
375 |
); |
|
376 |
|
|
377 |
// These hooks are used by animate to expand properties |
|
378 |
jQuery.each({ |
|
379 |
margin: "", |
|
380 |
padding: "", |
|
381 |
border: "Width" |
|
382 |
}, function( prefix, suffix ) { |
|
383 |
jQuery.cssHooks[ prefix + suffix ] = { |
|
384 |
expand: function( value ) { |
|
385 |
var i = 0, |
|
386 |
expanded = {}, |
|
387 |
|
|
388 |
// Assumes a single number if not a string |
|
389 |
parts = typeof value === "string" ? value.split(" ") : [ value ]; |
|
390 |
|
|
391 |
for ( ; i < 4; i++ ) { |
|
392 |
expanded[ prefix + cssExpand[ i ] + suffix ] = |
|
393 |
parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; |
|
394 |
} |
|
395 |
|
|
396 |
return expanded; |
|
397 |
} |
|
398 |
}; |
|
399 |
|
|
400 |
if ( !rmargin.test( prefix ) ) { |
|
401 |
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; |
|
402 |
} |
|
403 |
}); |
|
404 |
|
|
405 |
jQuery.fn.extend({ |
|
406 |
css: function( name, value ) { |
|
407 |
return access( this, function( elem, name, value ) { |
|
408 |
var styles, len, |
|
409 |
map = {}, |
|
410 |
i = 0; |
|
411 |
|
|
412 |
if ( jQuery.isArray( name ) ) { |
|
413 |
styles = getStyles( elem ); |
|
414 |
len = name.length; |
|
415 |
|
|
416 |
for ( ; i < len; i++ ) { |
|
417 |
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); |
|
418 |
} |
|
419 |
|
|
420 |
return map; |
|
421 |
} |
|
422 |
|
|
423 |
return value !== undefined ? |
|
424 |
jQuery.style( elem, name, value ) : |
|
425 |
jQuery.css( elem, name ); |
|
426 |
}, name, value, arguments.length > 1 ); |
|
427 |
}, |
|
428 |
show: function() { |
|
429 |
return showHide( this, true ); |
|
430 |
}, |
|
431 |
hide: function() { |
|
432 |
return showHide( this ); |
|
433 |
}, |
|
434 |
toggle: function( state ) { |
|
435 |
if ( typeof state === "boolean" ) { |
|
436 |
return state ? this.show() : this.hide(); |
|
437 |
} |
|
438 |
|
|
439 |
return this.each(function() { |
|
440 |
if ( isHidden( this ) ) { |
|
441 |
jQuery( this ).show(); |
|
442 |
} else { |
|
443 |
jQuery( this ).hide(); |
|
444 |
} |
|
445 |
}); |
|
446 |
} |
|
447 |
}); |
|
448 |
|
|
449 |
return jQuery; |
|
450 |
}); |
modules/dli-service-portal/trunk/static/bower_components/jquery/src/core/var/rsingleTag.js | ||
---|---|---|
1 |
define(function() { |
|
2 |
// Match a standalone tag |
|
3 |
return (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); |
|
4 |
}); |
modules/dli-service-portal/trunk/static/bower_components/jquery/src/core/access.js | ||
---|---|---|
1 |
define([ |
|
2 |
"../core" |
|
3 |
], function( jQuery ) { |
|
4 |
|
|
5 |
// Multifunctional method to get and set values of a collection |
|
6 |
// The value/s can optionally be executed if it's a function |
|
7 |
var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { |
|
8 |
var i = 0, |
|
9 |
len = elems.length, |
|
10 |
bulk = key == null; |
|
11 |
|
|
12 |
// Sets many values |
|
13 |
if ( jQuery.type( key ) === "object" ) { |
|
14 |
chainable = true; |
|
15 |
for ( i in key ) { |
|
16 |
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); |
|
17 |
} |
|
18 |
|
|
19 |
// Sets one value |
|
20 |
} else if ( value !== undefined ) { |
|
21 |
chainable = true; |
|
22 |
|
|
23 |
if ( !jQuery.isFunction( value ) ) { |
|
24 |
raw = true; |
|
25 |
} |
|
26 |
|
|
27 |
if ( bulk ) { |
|
28 |
// Bulk operations run against the entire set |
|
29 |
if ( raw ) { |
|
30 |
fn.call( elems, value ); |
|
31 |
fn = null; |
|
32 |
|
|
33 |
// ...except when executing function values |
|
34 |
} else { |
|
35 |
bulk = fn; |
|
36 |
fn = function( elem, key, value ) { |
|
37 |
return bulk.call( jQuery( elem ), value ); |
|
38 |
}; |
|
39 |
} |
|
40 |
} |
|
41 |
|
|
42 |
if ( fn ) { |
|
43 |
for ( ; i < len; i++ ) { |
|
44 |
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); |
|
45 |
} |
|
46 |
} |
|
47 |
} |
|
48 |
|
|
49 |
return chainable ? |
|
50 |
elems : |
|
51 |
|
|
52 |
// Gets |
|
53 |
bulk ? |
|
54 |
fn.call( elems ) : |
|
55 |
len ? fn( elems[0], key ) : emptyGet; |
|
56 |
}; |
|
57 |
|
|
58 |
return access; |
|
59 |
|
|
60 |
}); |
modules/dli-service-portal/trunk/DLI.py | ||
---|---|---|
1 |
#!/usr/bin/python |
|
2 |
# |
|
3 |
# Flask server, woo! |
|
4 |
# |
|
5 |
import json |
|
6 |
|
|
7 |
from flask import Flask, jsonify, request |
|
8 |
from flask.json import JSONEncoder |
|
9 |
from DLIObject import DLIObject, DLIRelation |
|
10 |
import logging |
|
11 |
|
|
12 |
from DLIQueryResolver import QueryResolver |
|
13 |
|
|
14 |
|
|
15 |
class MyJSONEncoder(JSONEncoder): |
|
16 |
def default(self, obj): |
|
17 |
if isinstance(obj, DLIObject): |
|
18 |
return obj.__dict__ |
|
19 |
if isinstance(obj, DLIRelation): |
|
20 |
return obj.__dict__ |
|
21 |
return super(MyJSONEncoder, self).default(obj) |
|
22 |
|
|
23 |
|
|
24 |
app = Flask(__name__) |
|
25 |
app.debug = True |
|
26 |
app.json_encoder = MyJSONEncoder |
|
27 |
|
|
28 |
host = "http://node0.d.dli.research-infrastructures.eu:8983/solr/DLIF-index-cleaned_shard1_replica1" |
|
29 |
|
|
30 |
|
|
31 |
# q = QueryResolver("http://localhost:8983/solr/DLIF-index-cleaned_shard1_replica1") |
|
32 |
|
|
33 |
class InvalidUsage(Exception): |
|
34 |
status_code = 400 |
|
35 |
|
|
36 |
def __init__(self, message, status_code=None, payload=None): |
|
37 |
Exception.__init__(self) |
|
38 |
self.message = message |
|
39 |
if status_code is not None: |
|
40 |
self.status_code = status_code |
|
41 |
self.payload = payload |
|
42 |
|
|
43 |
def to_dict(self): |
|
44 |
rv = dict(self.payload or ()) |
|
45 |
rv['message'] = self.message |
|
46 |
return rv |
|
47 |
|
|
48 |
|
|
49 |
# Routes |
|
50 |
@app.route('/') |
|
51 |
def root(): |
|
52 |
return app.send_static_file('index.html') |
|
53 |
|
|
54 |
|
|
55 |
@app.route('/<path:path>') |
|
56 |
def static_proxy(path): |
|
57 |
# send_static_file will guess the correct MIME type |
|
58 |
return app.send_static_file(path) |
|
59 |
|
|
60 |
|
|
61 |
@app.route('/api/item/<path:identifier>', methods=['post', 'get']) |
|
62 |
def getItem(identifier): |
|
63 |
if identifier: |
|
64 |
q = QueryResolver(host) |
|
65 |
return jsonify(result=q.get_item(identifier)) |
|
66 |
else: |
|
67 |
raise InvalidUsage('This view is gone', status_code=410) |
|
68 |
|
|
69 |
|
|
70 |
@app.route('/api/stats/', methods=['post', 'get']) |
|
71 |
def stats(): |
|
72 |
q = QueryResolver(host) |
|
73 |
return jsonify(stats=q.get_stats()) |
|
74 |
|
|
75 |
@app.route('/api/stats_detail/', methods=['post', 'get']) |
|
76 |
def stats_detail(): |
|
77 |
q = QueryResolver(host) |
|
78 |
return jsonify(stats=q.get_stats_detail()) |
|
79 |
|
|
80 |
|
|
81 |
@app.route('/api/post/', methods=['post', 'get']) |
|
82 |
def query_post(): |
|
83 |
action = None |
|
84 |
query = None |
|
85 |
only_result = False |
|
86 |
filter_query = None |
|
87 |
start = 0 |
|
88 |
if 'action' in request.form: |
|
89 |
action = request.form['action'] |
|
90 |
if 'query' in request.form: |
|
91 |
query = request.form['query'] |
|
92 |
if 'only_result' in request.form: |
|
93 |
only_result = True |
|
94 |
|
|
95 |
if 'browse_field' in request.form: |
|
96 |
try: |
|
97 |
filter_query = json.loads(request.form['browse_field']) |
|
98 |
print filter_query |
|
99 |
except: |
|
100 |
logging.error("Unable to parse browse_field, current value %s" % request.form['browse_field']) |
|
101 |
|
|
102 |
print type(filter_query) |
|
103 |
|
|
104 |
if 'start' in request.form: |
|
105 |
start = int(request.form['start']) |
|
106 |
|
|
107 |
if action == 'query' and query is not None: |
|
108 |
q = QueryResolver(host) |
|
109 |
result = q.query(q=query, browse_fields=["entitytype", "provenance"], start=start, only_result=only_result, |
|
110 |
filter_query=filter_query) |
|
111 |
return jsonify(result=result) |
|
112 |
else: |
|
113 |
return jsonify(error={'error_code': 'an error occur during query on server'}) |
|
114 |
|
|
115 |
|
|
116 |
if __name__ == '__main__': |
|
117 |
app.run(debug=True, host='0.0.0.0', processes=5) |
modules/dli-service-portal/trunk/static/bower_components/jquery/src/data/var/data_priv.js | ||
---|---|---|
1 |
define([ |
|
2 |
"../Data" |
|
3 |
], function( Data ) { |
|
4 |
return new Data(); |
|
5 |
}); |
modules/dli-service-portal/trunk/static/bower_components/jquery/src/event/support.js | ||
---|---|---|
1 |
define([ |
|
2 |
"../var/support" |
|
3 |
], function( support ) { |
|
4 |
|
|
5 |
support.focusinBubbles = "onfocusin" in window; |
|
6 |
|
|
7 |
return support; |
|
8 |
|
|
9 |
}); |
modules/dli-service-portal/trunk/DLIObject.py | ||
---|---|---|
1 |
|
|
2 |
from xml.dom.minidom import parseString |
|
3 |
import logging |
|
4 |
|
|
5 |
|
|
6 |
import re |
|
7 |
p = re.compile("((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)") |
|
8 |
|
|
9 |
def get_single_node(node, nodeName, nodeNamespace): |
|
10 |
results = node.getElementsByTagNameNS(nodeNamespace, nodeName) |
|
11 |
if len(results) > 0: |
|
12 |
return results[0] |
|
13 |
return None |
|
14 |
|
|
15 |
|
|
16 |
def get_children_nodes(node, nodeName, nodeNamespace): |
|
17 |
results = node.getElementsByTagNameNS(nodeNamespace, nodeName) |
|
18 |
if len(results) > 0: |
|
19 |
return results |
|
20 |
return None |
|
21 |
|
|
22 |
|
|
23 |
def get_text_value(node): |
|
24 |
children = node.childNodes |
|
25 |
if len(children)>0: |
|
26 |
return children[0].data |
|
27 |
return "" |
|
28 |
|
|
29 |
|
|
30 |
class DLIRelation(object): |
|
31 |
|
|
32 |
def __init__(self, rel_node=None, dli_namespace=None): |
|
33 |
if dli_namespace is None: |
|
34 |
self.namespace = "http://www.dli.eu" |
|
35 |
else: |
|
36 |
self.namespace = dli_namespace |
|
37 |
if rel_node is not None: |
|
38 |
self._initialize_with_rel_node(rel_node) |
|
39 |
|
|
40 |
def _associate_identifier(self, rel_node): |
|
41 |
dnet_id_node = get_single_node(rel_node, "dnetIdentifier", self.namespace) |
Also available in: Unified diff
added first version of dli portal