trusty-cms 4.2.2 → 4.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +98 -89
- data/app/assets/config/trusty-cms/manifest.js +7 -0
- data/app/assets/javascripts/admin/custom_file_upload.js +7 -0
- data/app/controllers/admin/assets_controller.rb +1 -1
- data/app/models/page.rb +2 -2
- data/app/views/admin/assets/new.html.haml +2 -0
- data/config/database.yml +4 -0
- data/config/initializers/assets.rb +0 -4
- data/coverage/index.html +155 -155
- data/lib/trusty_cms.rb +1 -1
- data/node_modules/hosted-git-info/CHANGELOG.md +10 -0
- data/node_modules/hosted-git-info/index.js +2 -2
- data/node_modules/hosted-git-info/package.json +1 -1
- data/node_modules/lodash/README.md +2 -2
- data/node_modules/lodash/_baseClone.js +2 -1
- data/node_modules/lodash/_baseOrderBy.js +17 -2
- data/node_modules/lodash/_baseSet.js +4 -0
- data/node_modules/lodash/_baseSortedIndexBy.js +7 -4
- data/node_modules/lodash/_baseTrim.js +19 -0
- data/node_modules/lodash/_equalArrays.js +5 -4
- data/node_modules/lodash/_equalObjects.js +5 -4
- data/node_modules/lodash/_trimmedEndIndex.js +19 -0
- data/node_modules/lodash/core.js +48 -6
- data/node_modules/lodash/core.min.js +9 -9
- data/node_modules/lodash/filter.js +4 -0
- data/node_modules/lodash/flake.lock +40 -0
- data/node_modules/lodash/flake.nix +20 -0
- data/node_modules/lodash/lodash.js +59 -11
- data/node_modules/lodash/lodash.min.js +126 -125
- data/node_modules/lodash/matches.js +7 -0
- data/node_modules/lodash/matchesProperty.js +7 -0
- data/node_modules/lodash/overEvery.js +4 -0
- data/node_modules/lodash/overSome.js +7 -0
- data/node_modules/lodash/package.json +1 -1
- data/node_modules/lodash/parseInt.js +1 -1
- data/node_modules/lodash/release.md +48 -0
- data/node_modules/lodash/sortBy.js +3 -3
- data/node_modules/lodash/template.js +24 -5
- data/node_modules/lodash/toNumber.js +3 -5
- data/node_modules/lodash/trim.js +2 -4
- data/node_modules/lodash/trimEnd.js +3 -5
- data/node_modules/lodash/trimStart.js +1 -1
- data/spec/dummy/log/development.log +9 -163
- data/spec/dummy/log/test.log +536 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/AUTHORS.txt +333 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/LICENSE.txt +43 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/external/jquery/jquery.js +11008 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_444444_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_555555_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_777620_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_777777_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_cc0000_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_ffffff_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/index.html +559 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.css +1312 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.js +18706 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.min.css +7 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.min.js +13 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.structure.css +886 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.structure.min.css +5 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.theme.css +443 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.theme.min.css +5 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/package.json +33 -0
- data/spec/dummy/node_modules/jquery-ujs/CONTRIBUTING.md +109 -0
- data/spec/dummy/node_modules/jquery-ujs/MIT-LICENSE +20 -0
- data/spec/dummy/node_modules/jquery-ujs/README.md +86 -0
- data/spec/dummy/node_modules/jquery-ujs/RELEASE.md +23 -0
- data/spec/dummy/node_modules/jquery-ujs/bower.json +19 -0
- data/spec/dummy/node_modules/jquery-ujs/package.json +26 -0
- data/spec/dummy/node_modules/jquery-ujs/src/rails.js +555 -0
- data/spec/dummy/node_modules/jquery/AUTHORS.txt +327 -0
- data/spec/dummy/node_modules/jquery/LICENSE.txt +20 -0
- data/spec/dummy/node_modules/jquery/README.md +62 -0
- data/spec/dummy/node_modules/jquery/bower.json +14 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.js +10872 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.min.js +2 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.min.map +1 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.slim.js +8777 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.slim.min.js +2 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.slim.min.map +1 -0
- data/spec/dummy/node_modules/jquery/external/sizzle/LICENSE.txt +36 -0
- data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.js +2478 -0
- data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/spec/dummy/node_modules/jquery/package.json +117 -0
- data/spec/dummy/node_modules/jquery/src/ajax.js +873 -0
- data/spec/dummy/node_modules/jquery/src/ajax/jsonp.js +103 -0
- data/spec/dummy/node_modules/jquery/src/ajax/load.js +77 -0
- data/spec/dummy/node_modules/jquery/src/ajax/script.js +74 -0
- data/spec/dummy/node_modules/jquery/src/ajax/var/location.js +5 -0
- data/spec/dummy/node_modules/jquery/src/ajax/var/nonce.js +5 -0
- data/spec/dummy/node_modules/jquery/src/ajax/var/rquery.js +5 -0
- data/spec/dummy/node_modules/jquery/src/ajax/xhr.js +170 -0
- data/spec/dummy/node_modules/jquery/src/attributes.js +13 -0
- data/spec/dummy/node_modules/jquery/src/attributes/attr.js +141 -0
- data/spec/dummy/node_modules/jquery/src/attributes/classes.js +186 -0
- data/spec/dummy/node_modules/jquery/src/attributes/prop.js +143 -0
- data/spec/dummy/node_modules/jquery/src/attributes/support.js +33 -0
- data/spec/dummy/node_modules/jquery/src/attributes/val.js +191 -0
- data/spec/dummy/node_modules/jquery/src/callbacks.js +236 -0
- data/spec/dummy/node_modules/jquery/src/core.js +400 -0
- data/spec/dummy/node_modules/jquery/src/core/DOMEval.js +43 -0
- data/spec/dummy/node_modules/jquery/src/core/access.js +72 -0
- data/spec/dummy/node_modules/jquery/src/core/camelCase.js +23 -0
- data/spec/dummy/node_modules/jquery/src/core/init.js +129 -0
- data/spec/dummy/node_modules/jquery/src/core/isAttached.js +26 -0
- data/spec/dummy/node_modules/jquery/src/core/nodeName.js +13 -0
- data/spec/dummy/node_modules/jquery/src/core/parseHTML.js +65 -0
- data/spec/dummy/node_modules/jquery/src/core/parseXML.js +30 -0
- data/spec/dummy/node_modules/jquery/src/core/ready-no-deferred.js +97 -0
- data/spec/dummy/node_modules/jquery/src/core/ready.js +86 -0
- data/spec/dummy/node_modules/jquery/src/core/readyException.js +13 -0
- data/spec/dummy/node_modules/jquery/src/core/stripAndCollapse.js +14 -0
- data/spec/dummy/node_modules/jquery/src/core/support.js +20 -0
- data/spec/dummy/node_modules/jquery/src/core/toType.js +20 -0
- data/spec/dummy/node_modules/jquery/src/core/var/rsingleTag.js +7 -0
- data/spec/dummy/node_modules/jquery/src/css.js +494 -0
- data/spec/dummy/node_modules/jquery/src/css/addGetHookIf.js +26 -0
- data/spec/dummy/node_modules/jquery/src/css/adjustCSS.js +74 -0
- data/spec/dummy/node_modules/jquery/src/css/curCSS.js +65 -0
- data/spec/dummy/node_modules/jquery/src/css/finalPropName.js +42 -0
- data/spec/dummy/node_modules/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/spec/dummy/node_modules/jquery/src/css/showHide.js +105 -0
- data/spec/dummy/node_modules/jquery/src/css/support.js +133 -0
- data/spec/dummy/node_modules/jquery/src/css/var/cssExpand.js +5 -0
- data/spec/dummy/node_modules/jquery/src/css/var/getStyles.js +17 -0
- data/spec/dummy/node_modules/jquery/src/css/var/isHiddenWithinTree.js +34 -0
- data/spec/dummy/node_modules/jquery/src/css/var/rboxStyle.js +7 -0
- data/spec/dummy/node_modules/jquery/src/css/var/rnumnonpx.js +7 -0
- data/spec/dummy/node_modules/jquery/src/css/var/swap.js +26 -0
- data/spec/dummy/node_modules/jquery/src/data.js +180 -0
- data/spec/dummy/node_modules/jquery/src/data/Data.js +162 -0
- data/spec/dummy/node_modules/jquery/src/data/var/acceptData.js +19 -0
- data/spec/dummy/node_modules/jquery/src/data/var/dataPriv.js +7 -0
- data/spec/dummy/node_modules/jquery/src/data/var/dataUser.js +7 -0
- data/spec/dummy/node_modules/jquery/src/deferred.js +399 -0
- data/spec/dummy/node_modules/jquery/src/deferred/exceptionHook.js +21 -0
- data/spec/dummy/node_modules/jquery/src/deprecated.js +87 -0
- data/spec/dummy/node_modules/jquery/src/deprecated/ajax-event-alias.js +22 -0
- data/spec/dummy/node_modules/jquery/src/deprecated/event.js +48 -0
- data/spec/dummy/node_modules/jquery/src/dimensions.js +57 -0
- data/spec/dummy/node_modules/jquery/src/effects.js +701 -0
- data/spec/dummy/node_modules/jquery/src/effects/Tween.js +125 -0
- data/spec/dummy/node_modules/jquery/src/effects/animatedSelector.js +15 -0
- data/spec/dummy/node_modules/jquery/src/event.js +892 -0
- data/spec/dummy/node_modules/jquery/src/event/focusin.js +58 -0
- data/spec/dummy/node_modules/jquery/src/event/support.js +11 -0
- data/spec/dummy/node_modules/jquery/src/event/trigger.js +201 -0
- data/spec/dummy/node_modules/jquery/src/exports/amd.js +26 -0
- data/spec/dummy/node_modules/jquery/src/exports/global.js +34 -0
- data/spec/dummy/node_modules/jquery/src/jquery.js +41 -0
- data/spec/dummy/node_modules/jquery/src/manipulation.js +480 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/_evalUrl.js +32 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/buildFragment.js +106 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/getAll.js +32 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/setGlobalEval.js +22 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/support.js +41 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/var/rscriptType.js +5 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/var/rtagName.js +8 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/wrapMap.js +30 -0
- data/spec/dummy/node_modules/jquery/src/offset.js +238 -0
- data/spec/dummy/node_modules/jquery/src/queue.js +145 -0
- data/spec/dummy/node_modules/jquery/src/queue/delay.js +24 -0
- data/spec/dummy/node_modules/jquery/src/selector-native.js +241 -0
- data/spec/dummy/node_modules/jquery/src/selector-sizzle.js +19 -0
- data/spec/dummy/node_modules/jquery/src/selector.js +3 -0
- data/spec/dummy/node_modules/jquery/src/serialize.js +136 -0
- data/spec/dummy/node_modules/jquery/src/traversing.js +198 -0
- data/spec/dummy/node_modules/jquery/src/traversing/findFilter.js +97 -0
- data/spec/dummy/node_modules/jquery/src/traversing/var/dir.js +22 -0
- data/spec/dummy/node_modules/jquery/src/traversing/var/rneedsContext.js +8 -0
- data/spec/dummy/node_modules/jquery/src/traversing/var/siblings.js +17 -0
- data/spec/dummy/node_modules/jquery/src/var/ObjectFunctionString.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/arr.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/class2type.js +6 -0
- data/spec/dummy/node_modules/jquery/src/var/document.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/documentElement.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/flat.js +16 -0
- data/spec/dummy/node_modules/jquery/src/var/fnToString.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/getProto.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/hasOwn.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/indexOf.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/isFunction.js +13 -0
- data/spec/dummy/node_modules/jquery/src/var/isWindow.js +8 -0
- data/spec/dummy/node_modules/jquery/src/var/pnum.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/push.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/rcheckableType.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/rcssNum.js +9 -0
- data/spec/dummy/node_modules/jquery/src/var/rnothtmlwhite.js +8 -0
- data/spec/dummy/node_modules/jquery/src/var/slice.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/support.js +6 -0
- data/spec/dummy/node_modules/jquery/src/var/toString.js +7 -0
- data/spec/dummy/node_modules/jquery/src/wrap.js +78 -0
- data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +5 -0
- data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +1 -0
- data/trusty_cms.gemspec +3 -2
- data/yarn.lock +9 -9
- metadata +354 -50
@@ -0,0 +1,33 @@
|
|
1
|
+
define( [
|
2
|
+
"../var/document",
|
3
|
+
"../var/support"
|
4
|
+
], function( document, support ) {
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
( function() {
|
9
|
+
var input = document.createElement( "input" ),
|
10
|
+
select = document.createElement( "select" ),
|
11
|
+
opt = select.appendChild( document.createElement( "option" ) );
|
12
|
+
|
13
|
+
input.type = "checkbox";
|
14
|
+
|
15
|
+
// Support: Android <=4.3 only
|
16
|
+
// Default value for a checkbox should be "on"
|
17
|
+
support.checkOn = input.value !== "";
|
18
|
+
|
19
|
+
// Support: IE <=11 only
|
20
|
+
// Must access selectedIndex to make default options select
|
21
|
+
support.optSelected = opt.selected;
|
22
|
+
|
23
|
+
// Support: IE <=11 only
|
24
|
+
// An input loses its value after becoming a radio
|
25
|
+
input = document.createElement( "input" );
|
26
|
+
input.value = "t";
|
27
|
+
input.type = "radio";
|
28
|
+
support.radioValue = input.value === "t";
|
29
|
+
} )();
|
30
|
+
|
31
|
+
return support;
|
32
|
+
|
33
|
+
} );
|
@@ -0,0 +1,191 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../core/stripAndCollapse",
|
4
|
+
"./support",
|
5
|
+
"../core/nodeName",
|
6
|
+
"../var/isFunction",
|
7
|
+
|
8
|
+
"../core/init"
|
9
|
+
], function( jQuery, stripAndCollapse, support, nodeName, isFunction ) {
|
10
|
+
|
11
|
+
"use strict";
|
12
|
+
|
13
|
+
var rreturn = /\r/g;
|
14
|
+
|
15
|
+
jQuery.fn.extend( {
|
16
|
+
val: function( value ) {
|
17
|
+
var hooks, ret, valueIsFunction,
|
18
|
+
elem = this[ 0 ];
|
19
|
+
|
20
|
+
if ( !arguments.length ) {
|
21
|
+
if ( elem ) {
|
22
|
+
hooks = jQuery.valHooks[ elem.type ] ||
|
23
|
+
jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
24
|
+
|
25
|
+
if ( hooks &&
|
26
|
+
"get" in hooks &&
|
27
|
+
( ret = hooks.get( elem, "value" ) ) !== undefined
|
28
|
+
) {
|
29
|
+
return ret;
|
30
|
+
}
|
31
|
+
|
32
|
+
ret = elem.value;
|
33
|
+
|
34
|
+
// Handle most common string cases
|
35
|
+
if ( typeof ret === "string" ) {
|
36
|
+
return ret.replace( rreturn, "" );
|
37
|
+
}
|
38
|
+
|
39
|
+
// Handle cases where value is null/undef or number
|
40
|
+
return ret == null ? "" : ret;
|
41
|
+
}
|
42
|
+
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
|
46
|
+
valueIsFunction = isFunction( value );
|
47
|
+
|
48
|
+
return this.each( function( i ) {
|
49
|
+
var val;
|
50
|
+
|
51
|
+
if ( this.nodeType !== 1 ) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
|
55
|
+
if ( valueIsFunction ) {
|
56
|
+
val = value.call( this, i, jQuery( this ).val() );
|
57
|
+
} else {
|
58
|
+
val = value;
|
59
|
+
}
|
60
|
+
|
61
|
+
// Treat null/undefined as ""; convert numbers to string
|
62
|
+
if ( val == null ) {
|
63
|
+
val = "";
|
64
|
+
|
65
|
+
} else if ( typeof val === "number" ) {
|
66
|
+
val += "";
|
67
|
+
|
68
|
+
} else if ( Array.isArray( val ) ) {
|
69
|
+
val = jQuery.map( val, function( value ) {
|
70
|
+
return value == null ? "" : value + "";
|
71
|
+
} );
|
72
|
+
}
|
73
|
+
|
74
|
+
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
75
|
+
|
76
|
+
// If set returns undefined, fall back to normal setting
|
77
|
+
if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
|
78
|
+
this.value = val;
|
79
|
+
}
|
80
|
+
} );
|
81
|
+
}
|
82
|
+
} );
|
83
|
+
|
84
|
+
jQuery.extend( {
|
85
|
+
valHooks: {
|
86
|
+
option: {
|
87
|
+
get: function( elem ) {
|
88
|
+
|
89
|
+
var val = jQuery.find.attr( elem, "value" );
|
90
|
+
return val != null ?
|
91
|
+
val :
|
92
|
+
|
93
|
+
// Support: IE <=10 - 11 only
|
94
|
+
// option.text throws exceptions (#14686, #14858)
|
95
|
+
// Strip and collapse whitespace
|
96
|
+
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
|
97
|
+
stripAndCollapse( jQuery.text( elem ) );
|
98
|
+
}
|
99
|
+
},
|
100
|
+
select: {
|
101
|
+
get: function( elem ) {
|
102
|
+
var value, option, i,
|
103
|
+
options = elem.options,
|
104
|
+
index = elem.selectedIndex,
|
105
|
+
one = elem.type === "select-one",
|
106
|
+
values = one ? null : [],
|
107
|
+
max = one ? index + 1 : options.length;
|
108
|
+
|
109
|
+
if ( index < 0 ) {
|
110
|
+
i = max;
|
111
|
+
|
112
|
+
} else {
|
113
|
+
i = one ? index : 0;
|
114
|
+
}
|
115
|
+
|
116
|
+
// Loop through all the selected options
|
117
|
+
for ( ; i < max; i++ ) {
|
118
|
+
option = options[ i ];
|
119
|
+
|
120
|
+
// Support: IE <=9 only
|
121
|
+
// IE8-9 doesn't update selected after form reset (#2551)
|
122
|
+
if ( ( option.selected || i === index ) &&
|
123
|
+
|
124
|
+
// Don't return options that are disabled or in a disabled optgroup
|
125
|
+
!option.disabled &&
|
126
|
+
( !option.parentNode.disabled ||
|
127
|
+
!nodeName( option.parentNode, "optgroup" ) ) ) {
|
128
|
+
|
129
|
+
// Get the specific value for the option
|
130
|
+
value = jQuery( option ).val();
|
131
|
+
|
132
|
+
// We don't need an array for one selects
|
133
|
+
if ( one ) {
|
134
|
+
return value;
|
135
|
+
}
|
136
|
+
|
137
|
+
// Multi-Selects return an array
|
138
|
+
values.push( value );
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
return values;
|
143
|
+
},
|
144
|
+
|
145
|
+
set: function( elem, value ) {
|
146
|
+
var optionSet, option,
|
147
|
+
options = elem.options,
|
148
|
+
values = jQuery.makeArray( value ),
|
149
|
+
i = options.length;
|
150
|
+
|
151
|
+
while ( i-- ) {
|
152
|
+
option = options[ i ];
|
153
|
+
|
154
|
+
/* eslint-disable no-cond-assign */
|
155
|
+
|
156
|
+
if ( option.selected =
|
157
|
+
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
|
158
|
+
) {
|
159
|
+
optionSet = true;
|
160
|
+
}
|
161
|
+
|
162
|
+
/* eslint-enable no-cond-assign */
|
163
|
+
}
|
164
|
+
|
165
|
+
// Force browsers to behave consistently when non-matching value is set
|
166
|
+
if ( !optionSet ) {
|
167
|
+
elem.selectedIndex = -1;
|
168
|
+
}
|
169
|
+
return values;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
} );
|
174
|
+
|
175
|
+
// Radios and checkboxes getter/setter
|
176
|
+
jQuery.each( [ "radio", "checkbox" ], function() {
|
177
|
+
jQuery.valHooks[ this ] = {
|
178
|
+
set: function( elem, value ) {
|
179
|
+
if ( Array.isArray( value ) ) {
|
180
|
+
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
|
181
|
+
}
|
182
|
+
}
|
183
|
+
};
|
184
|
+
if ( !support.checkOn ) {
|
185
|
+
jQuery.valHooks[ this ].get = function( elem ) {
|
186
|
+
return elem.getAttribute( "value" ) === null ? "on" : elem.value;
|
187
|
+
};
|
188
|
+
}
|
189
|
+
} );
|
190
|
+
|
191
|
+
} );
|
@@ -0,0 +1,236 @@
|
|
1
|
+
define( [
|
2
|
+
"./core",
|
3
|
+
"./core/toType",
|
4
|
+
"./var/isFunction",
|
5
|
+
"./var/rnothtmlwhite"
|
6
|
+
], function( jQuery, toType, isFunction, rnothtmlwhite ) {
|
7
|
+
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
// Convert String-formatted options into Object-formatted ones
|
11
|
+
function createOptions( options ) {
|
12
|
+
var object = {};
|
13
|
+
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
|
14
|
+
object[ flag ] = true;
|
15
|
+
} );
|
16
|
+
return object;
|
17
|
+
}
|
18
|
+
|
19
|
+
/*
|
20
|
+
* Create a callback list using the following parameters:
|
21
|
+
*
|
22
|
+
* options: an optional list of space-separated options that will change how
|
23
|
+
* the callback list behaves or a more traditional option object
|
24
|
+
*
|
25
|
+
* By default a callback list will act like an event callback list and can be
|
26
|
+
* "fired" multiple times.
|
27
|
+
*
|
28
|
+
* Possible options:
|
29
|
+
*
|
30
|
+
* once: will ensure the callback list can only be fired once (like a Deferred)
|
31
|
+
*
|
32
|
+
* memory: will keep track of previous values and will call any callback added
|
33
|
+
* after the list has been fired right away with the latest "memorized"
|
34
|
+
* values (like a Deferred)
|
35
|
+
*
|
36
|
+
* unique: will ensure a callback can only be added once (no duplicate in the list)
|
37
|
+
*
|
38
|
+
* stopOnFalse: interrupt callings when a callback returns false
|
39
|
+
*
|
40
|
+
*/
|
41
|
+
jQuery.Callbacks = function( options ) {
|
42
|
+
|
43
|
+
// Convert options from String-formatted to Object-formatted if needed
|
44
|
+
// (we check in cache first)
|
45
|
+
options = typeof options === "string" ?
|
46
|
+
createOptions( options ) :
|
47
|
+
jQuery.extend( {}, options );
|
48
|
+
|
49
|
+
var // Flag to know if list is currently firing
|
50
|
+
firing,
|
51
|
+
|
52
|
+
// Last fire value for non-forgettable lists
|
53
|
+
memory,
|
54
|
+
|
55
|
+
// Flag to know if list was already fired
|
56
|
+
fired,
|
57
|
+
|
58
|
+
// Flag to prevent firing
|
59
|
+
locked,
|
60
|
+
|
61
|
+
// Actual callback list
|
62
|
+
list = [],
|
63
|
+
|
64
|
+
// Queue of execution data for repeatable lists
|
65
|
+
queue = [],
|
66
|
+
|
67
|
+
// Index of currently firing callback (modified by add/remove as needed)
|
68
|
+
firingIndex = -1,
|
69
|
+
|
70
|
+
// Fire callbacks
|
71
|
+
fire = function() {
|
72
|
+
|
73
|
+
// Enforce single-firing
|
74
|
+
locked = locked || options.once;
|
75
|
+
|
76
|
+
// Execute callbacks for all pending executions,
|
77
|
+
// respecting firingIndex overrides and runtime changes
|
78
|
+
fired = firing = true;
|
79
|
+
for ( ; queue.length; firingIndex = -1 ) {
|
80
|
+
memory = queue.shift();
|
81
|
+
while ( ++firingIndex < list.length ) {
|
82
|
+
|
83
|
+
// Run callback and check for early termination
|
84
|
+
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
|
85
|
+
options.stopOnFalse ) {
|
86
|
+
|
87
|
+
// Jump to end and forget the data so .add doesn't re-fire
|
88
|
+
firingIndex = list.length;
|
89
|
+
memory = false;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
// Forget the data if we're done with it
|
95
|
+
if ( !options.memory ) {
|
96
|
+
memory = false;
|
97
|
+
}
|
98
|
+
|
99
|
+
firing = false;
|
100
|
+
|
101
|
+
// Clean up if we're done firing for good
|
102
|
+
if ( locked ) {
|
103
|
+
|
104
|
+
// Keep an empty list if we have data for future add calls
|
105
|
+
if ( memory ) {
|
106
|
+
list = [];
|
107
|
+
|
108
|
+
// Otherwise, this object is spent
|
109
|
+
} else {
|
110
|
+
list = "";
|
111
|
+
}
|
112
|
+
}
|
113
|
+
},
|
114
|
+
|
115
|
+
// Actual Callbacks object
|
116
|
+
self = {
|
117
|
+
|
118
|
+
// Add a callback or a collection of callbacks to the list
|
119
|
+
add: function() {
|
120
|
+
if ( list ) {
|
121
|
+
|
122
|
+
// If we have memory from a past run, we should fire after adding
|
123
|
+
if ( memory && !firing ) {
|
124
|
+
firingIndex = list.length - 1;
|
125
|
+
queue.push( memory );
|
126
|
+
}
|
127
|
+
|
128
|
+
( function add( args ) {
|
129
|
+
jQuery.each( args, function( _, arg ) {
|
130
|
+
if ( isFunction( arg ) ) {
|
131
|
+
if ( !options.unique || !self.has( arg ) ) {
|
132
|
+
list.push( arg );
|
133
|
+
}
|
134
|
+
} else if ( arg && arg.length && toType( arg ) !== "string" ) {
|
135
|
+
|
136
|
+
// Inspect recursively
|
137
|
+
add( arg );
|
138
|
+
}
|
139
|
+
} );
|
140
|
+
} )( arguments );
|
141
|
+
|
142
|
+
if ( memory && !firing ) {
|
143
|
+
fire();
|
144
|
+
}
|
145
|
+
}
|
146
|
+
return this;
|
147
|
+
},
|
148
|
+
|
149
|
+
// Remove a callback from the list
|
150
|
+
remove: function() {
|
151
|
+
jQuery.each( arguments, function( _, arg ) {
|
152
|
+
var index;
|
153
|
+
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
|
154
|
+
list.splice( index, 1 );
|
155
|
+
|
156
|
+
// Handle firing indexes
|
157
|
+
if ( index <= firingIndex ) {
|
158
|
+
firingIndex--;
|
159
|
+
}
|
160
|
+
}
|
161
|
+
} );
|
162
|
+
return this;
|
163
|
+
},
|
164
|
+
|
165
|
+
// Check if a given callback is in the list.
|
166
|
+
// If no argument is given, return whether or not list has callbacks attached.
|
167
|
+
has: function( fn ) {
|
168
|
+
return fn ?
|
169
|
+
jQuery.inArray( fn, list ) > -1 :
|
170
|
+
list.length > 0;
|
171
|
+
},
|
172
|
+
|
173
|
+
// Remove all callbacks from the list
|
174
|
+
empty: function() {
|
175
|
+
if ( list ) {
|
176
|
+
list = [];
|
177
|
+
}
|
178
|
+
return this;
|
179
|
+
},
|
180
|
+
|
181
|
+
// Disable .fire and .add
|
182
|
+
// Abort any current/pending executions
|
183
|
+
// Clear all callbacks and values
|
184
|
+
disable: function() {
|
185
|
+
locked = queue = [];
|
186
|
+
list = memory = "";
|
187
|
+
return this;
|
188
|
+
},
|
189
|
+
disabled: function() {
|
190
|
+
return !list;
|
191
|
+
},
|
192
|
+
|
193
|
+
// Disable .fire
|
194
|
+
// Also disable .add unless we have memory (since it would have no effect)
|
195
|
+
// Abort any pending executions
|
196
|
+
lock: function() {
|
197
|
+
locked = queue = [];
|
198
|
+
if ( !memory && !firing ) {
|
199
|
+
list = memory = "";
|
200
|
+
}
|
201
|
+
return this;
|
202
|
+
},
|
203
|
+
locked: function() {
|
204
|
+
return !!locked;
|
205
|
+
},
|
206
|
+
|
207
|
+
// Call all callbacks with the given context and arguments
|
208
|
+
fireWith: function( context, args ) {
|
209
|
+
if ( !locked ) {
|
210
|
+
args = args || [];
|
211
|
+
args = [ context, args.slice ? args.slice() : args ];
|
212
|
+
queue.push( args );
|
213
|
+
if ( !firing ) {
|
214
|
+
fire();
|
215
|
+
}
|
216
|
+
}
|
217
|
+
return this;
|
218
|
+
},
|
219
|
+
|
220
|
+
// Call all the callbacks with the given arguments
|
221
|
+
fire: function() {
|
222
|
+
self.fireWith( this, arguments );
|
223
|
+
return this;
|
224
|
+
},
|
225
|
+
|
226
|
+
// To know if the callbacks have already been called at least once
|
227
|
+
fired: function() {
|
228
|
+
return !!fired;
|
229
|
+
}
|
230
|
+
};
|
231
|
+
|
232
|
+
return self;
|
233
|
+
};
|
234
|
+
|
235
|
+
return jQuery;
|
236
|
+
} );
|