trusty-cms 3.1.8 → 3.1.9
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 +13 -9
- data/app/assets/images/admin/move_higher.png +0 -0
- data/app/assets/images/admin/move_lower.png +0 -0
- data/app/assets/images/admin/move_to_bottom.png +0 -0
- data/app/assets/images/admin/move_to_top.png +0 -0
- data/app/assets/images/admin/remove.png +0 -0
- data/app/assets/stylesheets/admin/_multi_site_main.scss +85 -0
- data/app/assets/stylesheets/admin/_site_chooser.scss +76 -0
- data/app/assets/stylesheets/admin/main.scss +3 -0
- data/app/controllers/admin/sites_controller.rb +14 -0
- data/app/helpers/scoped_helper.rb +19 -0
- data/app/helpers/sites_helper.rb +10 -0
- data/app/models/site.rb +86 -0
- data/app/models/snippet.rb +23 -0
- data/app/models/snippet_finder.rb +24 -0
- data/app/models/snippet_tags.rb +80 -0
- data/app/users/_choose_site.html.haml +8 -0
- data/app/views/admin/layouts/_choose_site.html.haml +8 -0
- data/app/views/admin/layouts/_site_chooser.html.haml +11 -0
- data/app/views/admin/sites/_form.haml +50 -0
- data/app/views/admin/sites/edit.haml +7 -0
- data/app/views/admin/sites/index.haml +43 -0
- data/app/views/admin/sites/new.haml +7 -0
- data/app/views/admin/snippets/_choose_site.html.haml +6 -0
- data/app/views/{snippets → admin/snippets}/_form.html.haml +0 -0
- data/app/views/{snippets → admin/snippets}/_popups.html.haml +0 -0
- data/app/views/{snippets → admin/snippets}/edit.html.haml +0 -0
- data/app/views/{snippets → admin/snippets}/index.html.haml +0 -0
- data/app/views/{snippets → admin/snippets}/new.html.haml +0 -0
- data/app/views/{snippets → admin/snippets}/remove.html.haml +0 -0
- data/app/views/admin/users/_choose_site.html.haml +8 -0
- data/config/application.rb +0 -2
- data/config/initializers/trusty_cms_config.rb +6 -0
- data/config/routes.rb +8 -0
- data/coverage/index.html +3837 -2759
- data/db/migrate/006_remove_user_login_index.rb +8 -0
- data/db/migrate/010_create_sites.rb +13 -0
- data/db/migrate/011_add_order_to_sites.rb +9 -0
- data/db/migrate/022_add_admin_fields_to_sites.rb +17 -0
- data/db/migrate/023_add_sites.rb +13 -0
- data/db/migrate/024_site_abbreviation.rb +9 -0
- data/db/migrate/025_recreate_non_unique_index_on_snippets_name.rb +11 -0
- data/db/migrate/026_add_site_id_to_pages.rb +24 -0
- data/db/migrate/027_add_base_domain_to_sites.rb +9 -0
- data/lib/trusty_cms.rb +1 -1
- data/spec/dummy/db/schema.rb +20 -2
- data/spec/dummy/log/test.log +44621 -0
- data/spec/dummy/node_modules/jquery/AUTHORS.txt +301 -0
- data/spec/dummy/node_modules/jquery/LICENSE.txt +36 -0
- data/spec/dummy/node_modules/jquery/README.md +67 -0
- data/spec/dummy/node_modules/jquery/bower.json +14 -0
- data/spec/dummy/node_modules/jquery/dist/core.js +476 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.js +10253 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.min.js +4 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.min.map +1 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.slim.js +8160 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.slim.min.js +4 -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 +2272 -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 +97 -0
- data/spec/dummy/node_modules/jquery/src/ajax/jsonp.js +102 -0
- data/spec/dummy/node_modules/jquery/src/ajax/load.js +76 -0
- data/spec/dummy/node_modules/jquery/src/ajax/parseXML.js +30 -0
- data/spec/dummy/node_modules/jquery/src/ajax/script.js +77 -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 +7 -0
- data/spec/dummy/node_modules/jquery/src/ajax/var/rquery.js +5 -0
- data/spec/dummy/node_modules/jquery/src/ajax/xhr.js +169 -0
- data/spec/dummy/node_modules/jquery/src/ajax.js +855 -0
- data/spec/dummy/node_modules/jquery/src/attributes/attr.js +141 -0
- data/spec/dummy/node_modules/jquery/src/attributes/classes.js +174 -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 +190 -0
- data/spec/dummy/node_modules/jquery/src/attributes.js +13 -0
- data/spec/dummy/node_modules/jquery/src/callbacks.js +234 -0
- data/spec/dummy/node_modules/jquery/src/core/DOMEval.js +16 -0
- data/spec/dummy/node_modules/jquery/src/core/access.js +70 -0
- data/spec/dummy/node_modules/jquery/src/core/init.js +128 -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/ready-no-deferred.js +96 -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/var/rsingleTag.js +6 -0
- data/spec/dummy/node_modules/jquery/src/core.js +476 -0
- data/spec/dummy/node_modules/jquery/src/css/addGetHookIf.js +26 -0
- data/spec/dummy/node_modules/jquery/src/css/adjustCSS.js +71 -0
- data/spec/dummy/node_modules/jquery/src/css/curCSS.js +65 -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 +89 -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/rmargin.js +5 -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/css.js +438 -0
- data/spec/dummy/node_modules/jquery/src/data/Data.js +161 -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/data.js +179 -0
- data/spec/dummy/node_modules/jquery/src/deferred/exceptionHook.js +21 -0
- data/spec/dummy/node_modules/jquery/src/deferred.js +391 -0
- data/spec/dummy/node_modules/jquery/src/deprecated.js +40 -0
- data/spec/dummy/node_modules/jquery/src/dimensions.js +56 -0
- data/spec/dummy/node_modules/jquery/src/effects/Tween.js +123 -0
- data/spec/dummy/node_modules/jquery/src/effects/animatedSelector.js +15 -0
- data/spec/dummy/node_modules/jquery/src/effects.js +699 -0
- data/spec/dummy/node_modules/jquery/src/event/ajax.js +22 -0
- data/spec/dummy/node_modules/jquery/src/event/alias.js +29 -0
- data/spec/dummy/node_modules/jquery/src/event/focusin.js +55 -0
- data/spec/dummy/node_modules/jquery/src/event/support.js +11 -0
- data/spec/dummy/node_modules/jquery/src/event/trigger.js +185 -0
- data/spec/dummy/node_modules/jquery/src/event.js +746 -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/_evalUrl.js +23 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/buildFragment.js +104 -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 +35 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/var/rcheckableType.js +5 -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 +5 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/wrapMap.js +29 -0
- data/spec/dummy/node_modules/jquery/src/manipulation.js +488 -0
- data/spec/dummy/node_modules/jquery/src/offset.js +229 -0
- data/spec/dummy/node_modules/jquery/src/queue/delay.js +24 -0
- data/spec/dummy/node_modules/jquery/src/queue.js +145 -0
- data/spec/dummy/node_modules/jquery/src/selector-native.js +237 -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 +130 -0
- data/spec/dummy/node_modules/jquery/src/traversing/findFilter.js +106 -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/traversing.js +191 -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/concat.js +7 -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/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/pnum.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/push.js +7 -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 +77 -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/tmp/cache/747/A70/TrustyCms%3A%3AConfig +0 -0
- data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +0 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/admin_ui.rb +45 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb +40 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/application_controller_filter_extensions.rb +22 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/engine.rb +10 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/page_extensions.rb +81 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/pages_controller_extensions.rb +55 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/resource_controller_extensions.rb +42 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb +22 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/route_set_extensions.rb +17 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/scoped_model.rb +133 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/scoped_validation.rb +33 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/site_chooser_helper.rb +14 -0
- data/vendor/extensions/multi-site-extension/lib/multi_site/site_controller_extensions.rb +30 -0
- data/vendor/extensions/multi-site-extension/lib/tasks/multi_site_extension_tasks.rake +28 -0
- data/vendor/extensions/multi-site-extension/lib/tasks/scoped_admin_extension_tasks.rake +28 -0
- data/vendor/extensions/multi-site-extension/lib/trusty-multi-site-extension.rb +1 -0
- data/vendor/extensions/multi-site-extension/multi_site_extension.rb +61 -0
- data/vendor/extensions/snippets-extension/lib/trusty-snippets-extension.rb +0 -0
- data/vendor/extensions/snippets-extension/snippets_extension.rb +46 -0
- metadata +347 -8
@@ -0,0 +1,234 @@
|
|
1
|
+
define( [
|
2
|
+
"./core",
|
3
|
+
"./var/rnothtmlwhite"
|
4
|
+
], function( jQuery, rnothtmlwhite ) {
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
// Convert String-formatted options into Object-formatted ones
|
9
|
+
function createOptions( options ) {
|
10
|
+
var object = {};
|
11
|
+
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
|
12
|
+
object[ flag ] = true;
|
13
|
+
} );
|
14
|
+
return object;
|
15
|
+
}
|
16
|
+
|
17
|
+
/*
|
18
|
+
* Create a callback list using the following parameters:
|
19
|
+
*
|
20
|
+
* options: an optional list of space-separated options that will change how
|
21
|
+
* the callback list behaves or a more traditional option object
|
22
|
+
*
|
23
|
+
* By default a callback list will act like an event callback list and can be
|
24
|
+
* "fired" multiple times.
|
25
|
+
*
|
26
|
+
* Possible options:
|
27
|
+
*
|
28
|
+
* once: will ensure the callback list can only be fired once (like a Deferred)
|
29
|
+
*
|
30
|
+
* memory: will keep track of previous values and will call any callback added
|
31
|
+
* after the list has been fired right away with the latest "memorized"
|
32
|
+
* values (like a Deferred)
|
33
|
+
*
|
34
|
+
* unique: will ensure a callback can only be added once (no duplicate in the list)
|
35
|
+
*
|
36
|
+
* stopOnFalse: interrupt callings when a callback returns false
|
37
|
+
*
|
38
|
+
*/
|
39
|
+
jQuery.Callbacks = function( options ) {
|
40
|
+
|
41
|
+
// Convert options from String-formatted to Object-formatted if needed
|
42
|
+
// (we check in cache first)
|
43
|
+
options = typeof options === "string" ?
|
44
|
+
createOptions( options ) :
|
45
|
+
jQuery.extend( {}, options );
|
46
|
+
|
47
|
+
var // Flag to know if list is currently firing
|
48
|
+
firing,
|
49
|
+
|
50
|
+
// Last fire value for non-forgettable lists
|
51
|
+
memory,
|
52
|
+
|
53
|
+
// Flag to know if list was already fired
|
54
|
+
fired,
|
55
|
+
|
56
|
+
// Flag to prevent firing
|
57
|
+
locked,
|
58
|
+
|
59
|
+
// Actual callback list
|
60
|
+
list = [],
|
61
|
+
|
62
|
+
// Queue of execution data for repeatable lists
|
63
|
+
queue = [],
|
64
|
+
|
65
|
+
// Index of currently firing callback (modified by add/remove as needed)
|
66
|
+
firingIndex = -1,
|
67
|
+
|
68
|
+
// Fire callbacks
|
69
|
+
fire = function() {
|
70
|
+
|
71
|
+
// Enforce single-firing
|
72
|
+
locked = locked || options.once;
|
73
|
+
|
74
|
+
// Execute callbacks for all pending executions,
|
75
|
+
// respecting firingIndex overrides and runtime changes
|
76
|
+
fired = firing = true;
|
77
|
+
for ( ; queue.length; firingIndex = -1 ) {
|
78
|
+
memory = queue.shift();
|
79
|
+
while ( ++firingIndex < list.length ) {
|
80
|
+
|
81
|
+
// Run callback and check for early termination
|
82
|
+
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
|
83
|
+
options.stopOnFalse ) {
|
84
|
+
|
85
|
+
// Jump to end and forget the data so .add doesn't re-fire
|
86
|
+
firingIndex = list.length;
|
87
|
+
memory = false;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
// Forget the data if we're done with it
|
93
|
+
if ( !options.memory ) {
|
94
|
+
memory = false;
|
95
|
+
}
|
96
|
+
|
97
|
+
firing = false;
|
98
|
+
|
99
|
+
// Clean up if we're done firing for good
|
100
|
+
if ( locked ) {
|
101
|
+
|
102
|
+
// Keep an empty list if we have data for future add calls
|
103
|
+
if ( memory ) {
|
104
|
+
list = [];
|
105
|
+
|
106
|
+
// Otherwise, this object is spent
|
107
|
+
} else {
|
108
|
+
list = "";
|
109
|
+
}
|
110
|
+
}
|
111
|
+
},
|
112
|
+
|
113
|
+
// Actual Callbacks object
|
114
|
+
self = {
|
115
|
+
|
116
|
+
// Add a callback or a collection of callbacks to the list
|
117
|
+
add: function() {
|
118
|
+
if ( list ) {
|
119
|
+
|
120
|
+
// If we have memory from a past run, we should fire after adding
|
121
|
+
if ( memory && !firing ) {
|
122
|
+
firingIndex = list.length - 1;
|
123
|
+
queue.push( memory );
|
124
|
+
}
|
125
|
+
|
126
|
+
( function add( args ) {
|
127
|
+
jQuery.each( args, function( _, arg ) {
|
128
|
+
if ( jQuery.isFunction( arg ) ) {
|
129
|
+
if ( !options.unique || !self.has( arg ) ) {
|
130
|
+
list.push( arg );
|
131
|
+
}
|
132
|
+
} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
|
133
|
+
|
134
|
+
// Inspect recursively
|
135
|
+
add( arg );
|
136
|
+
}
|
137
|
+
} );
|
138
|
+
} )( arguments );
|
139
|
+
|
140
|
+
if ( memory && !firing ) {
|
141
|
+
fire();
|
142
|
+
}
|
143
|
+
}
|
144
|
+
return this;
|
145
|
+
},
|
146
|
+
|
147
|
+
// Remove a callback from the list
|
148
|
+
remove: function() {
|
149
|
+
jQuery.each( arguments, function( _, arg ) {
|
150
|
+
var index;
|
151
|
+
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
|
152
|
+
list.splice( index, 1 );
|
153
|
+
|
154
|
+
// Handle firing indexes
|
155
|
+
if ( index <= firingIndex ) {
|
156
|
+
firingIndex--;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
} );
|
160
|
+
return this;
|
161
|
+
},
|
162
|
+
|
163
|
+
// Check if a given callback is in the list.
|
164
|
+
// If no argument is given, return whether or not list has callbacks attached.
|
165
|
+
has: function( fn ) {
|
166
|
+
return fn ?
|
167
|
+
jQuery.inArray( fn, list ) > -1 :
|
168
|
+
list.length > 0;
|
169
|
+
},
|
170
|
+
|
171
|
+
// Remove all callbacks from the list
|
172
|
+
empty: function() {
|
173
|
+
if ( list ) {
|
174
|
+
list = [];
|
175
|
+
}
|
176
|
+
return this;
|
177
|
+
},
|
178
|
+
|
179
|
+
// Disable .fire and .add
|
180
|
+
// Abort any current/pending executions
|
181
|
+
// Clear all callbacks and values
|
182
|
+
disable: function() {
|
183
|
+
locked = queue = [];
|
184
|
+
list = memory = "";
|
185
|
+
return this;
|
186
|
+
},
|
187
|
+
disabled: function() {
|
188
|
+
return !list;
|
189
|
+
},
|
190
|
+
|
191
|
+
// Disable .fire
|
192
|
+
// Also disable .add unless we have memory (since it would have no effect)
|
193
|
+
// Abort any pending executions
|
194
|
+
lock: function() {
|
195
|
+
locked = queue = [];
|
196
|
+
if ( !memory && !firing ) {
|
197
|
+
list = memory = "";
|
198
|
+
}
|
199
|
+
return this;
|
200
|
+
},
|
201
|
+
locked: function() {
|
202
|
+
return !!locked;
|
203
|
+
},
|
204
|
+
|
205
|
+
// Call all callbacks with the given context and arguments
|
206
|
+
fireWith: function( context, args ) {
|
207
|
+
if ( !locked ) {
|
208
|
+
args = args || [];
|
209
|
+
args = [ context, args.slice ? args.slice() : args ];
|
210
|
+
queue.push( args );
|
211
|
+
if ( !firing ) {
|
212
|
+
fire();
|
213
|
+
}
|
214
|
+
}
|
215
|
+
return this;
|
216
|
+
},
|
217
|
+
|
218
|
+
// Call all the callbacks with the given arguments
|
219
|
+
fire: function() {
|
220
|
+
self.fireWith( this, arguments );
|
221
|
+
return this;
|
222
|
+
},
|
223
|
+
|
224
|
+
// To know if the callbacks have already been called at least once
|
225
|
+
fired: function() {
|
226
|
+
return !!fired;
|
227
|
+
}
|
228
|
+
};
|
229
|
+
|
230
|
+
return self;
|
231
|
+
};
|
232
|
+
|
233
|
+
return jQuery;
|
234
|
+
} );
|
@@ -0,0 +1,16 @@
|
|
1
|
+
define( [
|
2
|
+
"../var/document"
|
3
|
+
], function( document ) {
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
function DOMEval( code, doc ) {
|
7
|
+
doc = doc || document;
|
8
|
+
|
9
|
+
var script = doc.createElement( "script" );
|
10
|
+
|
11
|
+
script.text = code;
|
12
|
+
doc.head.appendChild( script ).parentNode.removeChild( script );
|
13
|
+
}
|
14
|
+
|
15
|
+
return DOMEval;
|
16
|
+
} );
|
@@ -0,0 +1,70 @@
|
|
1
|
+
define( [
|
2
|
+
"../core"
|
3
|
+
], function( jQuery ) {
|
4
|
+
|
5
|
+
"use strict";
|
6
|
+
|
7
|
+
// Multifunctional method to get and set values of a collection
|
8
|
+
// The value/s can optionally be executed if it's a function
|
9
|
+
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
|
10
|
+
var i = 0,
|
11
|
+
len = elems.length,
|
12
|
+
bulk = key == null;
|
13
|
+
|
14
|
+
// Sets many values
|
15
|
+
if ( jQuery.type( key ) === "object" ) {
|
16
|
+
chainable = true;
|
17
|
+
for ( i in key ) {
|
18
|
+
access( elems, fn, i, key[ i ], true, emptyGet, raw );
|
19
|
+
}
|
20
|
+
|
21
|
+
// Sets one value
|
22
|
+
} else if ( value !== undefined ) {
|
23
|
+
chainable = true;
|
24
|
+
|
25
|
+
if ( !jQuery.isFunction( value ) ) {
|
26
|
+
raw = true;
|
27
|
+
}
|
28
|
+
|
29
|
+
if ( bulk ) {
|
30
|
+
|
31
|
+
// Bulk operations run against the entire set
|
32
|
+
if ( raw ) {
|
33
|
+
fn.call( elems, value );
|
34
|
+
fn = null;
|
35
|
+
|
36
|
+
// ...except when executing function values
|
37
|
+
} else {
|
38
|
+
bulk = fn;
|
39
|
+
fn = function( elem, key, value ) {
|
40
|
+
return bulk.call( jQuery( elem ), value );
|
41
|
+
};
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
if ( fn ) {
|
46
|
+
for ( ; i < len; i++ ) {
|
47
|
+
fn(
|
48
|
+
elems[ i ], key, raw ?
|
49
|
+
value :
|
50
|
+
value.call( elems[ i ], i, fn( elems[ i ], key ) )
|
51
|
+
);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
if ( chainable ) {
|
57
|
+
return elems;
|
58
|
+
}
|
59
|
+
|
60
|
+
// Gets
|
61
|
+
if ( bulk ) {
|
62
|
+
return fn.call( elems );
|
63
|
+
}
|
64
|
+
|
65
|
+
return len ? fn( elems[ 0 ], key ) : emptyGet;
|
66
|
+
};
|
67
|
+
|
68
|
+
return access;
|
69
|
+
|
70
|
+
} );
|
@@ -0,0 +1,128 @@
|
|
1
|
+
// Initialize a jQuery object
|
2
|
+
define( [
|
3
|
+
"../core",
|
4
|
+
"../var/document",
|
5
|
+
"./var/rsingleTag",
|
6
|
+
|
7
|
+
"../traversing/findFilter"
|
8
|
+
], function( jQuery, document, rsingleTag ) {
|
9
|
+
|
10
|
+
"use strict";
|
11
|
+
|
12
|
+
// A central reference to the root jQuery(document)
|
13
|
+
var rootjQuery,
|
14
|
+
|
15
|
+
// A simple way to check for HTML strings
|
16
|
+
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
17
|
+
// Strict HTML recognition (#11290: must start with <)
|
18
|
+
// Shortcut simple #id case for speed
|
19
|
+
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
|
20
|
+
|
21
|
+
init = jQuery.fn.init = function( selector, context, root ) {
|
22
|
+
var match, elem;
|
23
|
+
|
24
|
+
// HANDLE: $(""), $(null), $(undefined), $(false)
|
25
|
+
if ( !selector ) {
|
26
|
+
return this;
|
27
|
+
}
|
28
|
+
|
29
|
+
// Method init() accepts an alternate rootjQuery
|
30
|
+
// so migrate can support jQuery.sub (gh-2101)
|
31
|
+
root = root || rootjQuery;
|
32
|
+
|
33
|
+
// Handle HTML strings
|
34
|
+
if ( typeof selector === "string" ) {
|
35
|
+
if ( selector[ 0 ] === "<" &&
|
36
|
+
selector[ selector.length - 1 ] === ">" &&
|
37
|
+
selector.length >= 3 ) {
|
38
|
+
|
39
|
+
// Assume that strings that start and end with <> are HTML and skip the regex check
|
40
|
+
match = [ null, selector, null ];
|
41
|
+
|
42
|
+
} else {
|
43
|
+
match = rquickExpr.exec( selector );
|
44
|
+
}
|
45
|
+
|
46
|
+
// Match html or make sure no context is specified for #id
|
47
|
+
if ( match && ( match[ 1 ] || !context ) ) {
|
48
|
+
|
49
|
+
// HANDLE: $(html) -> $(array)
|
50
|
+
if ( match[ 1 ] ) {
|
51
|
+
context = context instanceof jQuery ? context[ 0 ] : context;
|
52
|
+
|
53
|
+
// Option to run scripts is true for back-compat
|
54
|
+
// Intentionally let the error be thrown if parseHTML is not present
|
55
|
+
jQuery.merge( this, jQuery.parseHTML(
|
56
|
+
match[ 1 ],
|
57
|
+
context && context.nodeType ? context.ownerDocument || context : document,
|
58
|
+
true
|
59
|
+
) );
|
60
|
+
|
61
|
+
// HANDLE: $(html, props)
|
62
|
+
if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
|
63
|
+
for ( match in context ) {
|
64
|
+
|
65
|
+
// Properties of context are called as methods if possible
|
66
|
+
if ( jQuery.isFunction( this[ match ] ) ) {
|
67
|
+
this[ match ]( context[ match ] );
|
68
|
+
|
69
|
+
// ...and otherwise set as attributes
|
70
|
+
} else {
|
71
|
+
this.attr( match, context[ match ] );
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
return this;
|
77
|
+
|
78
|
+
// HANDLE: $(#id)
|
79
|
+
} else {
|
80
|
+
elem = document.getElementById( match[ 2 ] );
|
81
|
+
|
82
|
+
if ( elem ) {
|
83
|
+
|
84
|
+
// Inject the element directly into the jQuery object
|
85
|
+
this[ 0 ] = elem;
|
86
|
+
this.length = 1;
|
87
|
+
}
|
88
|
+
return this;
|
89
|
+
}
|
90
|
+
|
91
|
+
// HANDLE: $(expr, $(...))
|
92
|
+
} else if ( !context || context.jquery ) {
|
93
|
+
return ( context || root ).find( selector );
|
94
|
+
|
95
|
+
// HANDLE: $(expr, context)
|
96
|
+
// (which is just equivalent to: $(context).find(expr)
|
97
|
+
} else {
|
98
|
+
return this.constructor( context ).find( selector );
|
99
|
+
}
|
100
|
+
|
101
|
+
// HANDLE: $(DOMElement)
|
102
|
+
} else if ( selector.nodeType ) {
|
103
|
+
this[ 0 ] = selector;
|
104
|
+
this.length = 1;
|
105
|
+
return this;
|
106
|
+
|
107
|
+
// HANDLE: $(function)
|
108
|
+
// Shortcut for document ready
|
109
|
+
} else if ( jQuery.isFunction( selector ) ) {
|
110
|
+
return root.ready !== undefined ?
|
111
|
+
root.ready( selector ) :
|
112
|
+
|
113
|
+
// Execute immediately if ready is not present
|
114
|
+
selector( jQuery );
|
115
|
+
}
|
116
|
+
|
117
|
+
return jQuery.makeArray( selector, this );
|
118
|
+
};
|
119
|
+
|
120
|
+
// Give the init function the jQuery prototype for later instantiation
|
121
|
+
init.prototype = jQuery.fn;
|
122
|
+
|
123
|
+
// Initialize central reference
|
124
|
+
rootjQuery = jQuery( document );
|
125
|
+
|
126
|
+
return init;
|
127
|
+
|
128
|
+
} );
|
@@ -0,0 +1,65 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../var/document",
|
4
|
+
"./var/rsingleTag",
|
5
|
+
"../manipulation/buildFragment",
|
6
|
+
|
7
|
+
// This is the only module that needs core/support
|
8
|
+
"./support"
|
9
|
+
], function( jQuery, document, rsingleTag, buildFragment, support ) {
|
10
|
+
|
11
|
+
"use strict";
|
12
|
+
|
13
|
+
// Argument "data" should be string of html
|
14
|
+
// context (optional): If specified, the fragment will be created in this context,
|
15
|
+
// defaults to document
|
16
|
+
// keepScripts (optional): If true, will include scripts passed in the html string
|
17
|
+
jQuery.parseHTML = function( data, context, keepScripts ) {
|
18
|
+
if ( typeof data !== "string" ) {
|
19
|
+
return [];
|
20
|
+
}
|
21
|
+
if ( typeof context === "boolean" ) {
|
22
|
+
keepScripts = context;
|
23
|
+
context = false;
|
24
|
+
}
|
25
|
+
|
26
|
+
var base, parsed, scripts;
|
27
|
+
|
28
|
+
if ( !context ) {
|
29
|
+
|
30
|
+
// Stop scripts or inline event handlers from being executed immediately
|
31
|
+
// by using document.implementation
|
32
|
+
if ( support.createHTMLDocument ) {
|
33
|
+
context = document.implementation.createHTMLDocument( "" );
|
34
|
+
|
35
|
+
// Set the base href for the created document
|
36
|
+
// so any parsed elements with URLs
|
37
|
+
// are based on the document's URL (gh-2965)
|
38
|
+
base = context.createElement( "base" );
|
39
|
+
base.href = document.location.href;
|
40
|
+
context.head.appendChild( base );
|
41
|
+
} else {
|
42
|
+
context = document;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
parsed = rsingleTag.exec( data );
|
47
|
+
scripts = !keepScripts && [];
|
48
|
+
|
49
|
+
// Single tag
|
50
|
+
if ( parsed ) {
|
51
|
+
return [ context.createElement( parsed[ 1 ] ) ];
|
52
|
+
}
|
53
|
+
|
54
|
+
parsed = buildFragment( [ data ], context, scripts );
|
55
|
+
|
56
|
+
if ( scripts && scripts.length ) {
|
57
|
+
jQuery( scripts ).remove();
|
58
|
+
}
|
59
|
+
|
60
|
+
return jQuery.merge( [], parsed.childNodes );
|
61
|
+
};
|
62
|
+
|
63
|
+
return jQuery.parseHTML;
|
64
|
+
|
65
|
+
} );
|
@@ -0,0 +1,96 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../var/document"
|
4
|
+
], function( jQuery, document ) {
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
var readyCallbacks = [],
|
9
|
+
whenReady = function( fn ) {
|
10
|
+
readyCallbacks.push( fn );
|
11
|
+
},
|
12
|
+
executeReady = function( fn ) {
|
13
|
+
|
14
|
+
// Prevent errors from freezing future callback execution (gh-1823)
|
15
|
+
// Not backwards-compatible as this does not execute sync
|
16
|
+
window.setTimeout( function() {
|
17
|
+
fn.call( document, jQuery );
|
18
|
+
} );
|
19
|
+
};
|
20
|
+
|
21
|
+
jQuery.fn.ready = function( fn ) {
|
22
|
+
whenReady( fn );
|
23
|
+
return this;
|
24
|
+
};
|
25
|
+
|
26
|
+
jQuery.extend( {
|
27
|
+
|
28
|
+
// Is the DOM ready to be used? Set to true once it occurs.
|
29
|
+
isReady: false,
|
30
|
+
|
31
|
+
// A counter to track how many items to wait for before
|
32
|
+
// the ready event fires. See #6781
|
33
|
+
readyWait: 1,
|
34
|
+
|
35
|
+
ready: function( wait ) {
|
36
|
+
|
37
|
+
// Abort if there are pending holds or we're already ready
|
38
|
+
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
|
42
|
+
// Remember that the DOM is ready
|
43
|
+
jQuery.isReady = true;
|
44
|
+
|
45
|
+
// If a normal DOM Ready event fired, decrement, and wait if need be
|
46
|
+
if ( wait !== true && --jQuery.readyWait > 0 ) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
|
50
|
+
whenReady = function( fn ) {
|
51
|
+
readyCallbacks.push( fn );
|
52
|
+
|
53
|
+
while ( readyCallbacks.length ) {
|
54
|
+
fn = readyCallbacks.shift();
|
55
|
+
if ( jQuery.isFunction( fn ) ) {
|
56
|
+
executeReady( fn );
|
57
|
+
}
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
whenReady();
|
62
|
+
}
|
63
|
+
} );
|
64
|
+
|
65
|
+
// Make jQuery.ready Promise consumable (gh-1778)
|
66
|
+
jQuery.ready.then = jQuery.fn.ready;
|
67
|
+
|
68
|
+
/**
|
69
|
+
* The ready event handler and self cleanup method
|
70
|
+
*/
|
71
|
+
function completed() {
|
72
|
+
document.removeEventListener( "DOMContentLoaded", completed );
|
73
|
+
window.removeEventListener( "load", completed );
|
74
|
+
jQuery.ready();
|
75
|
+
}
|
76
|
+
|
77
|
+
// Catch cases where $(document).ready() is called
|
78
|
+
// after the browser event has already occurred.
|
79
|
+
// Support: IE9-10 only
|
80
|
+
// Older IE sometimes signals "interactive" too soon
|
81
|
+
if ( document.readyState === "complete" ||
|
82
|
+
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
|
83
|
+
|
84
|
+
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
85
|
+
window.setTimeout( jQuery.ready );
|
86
|
+
|
87
|
+
} else {
|
88
|
+
|
89
|
+
// Use the handy event callback
|
90
|
+
document.addEventListener( "DOMContentLoaded", completed );
|
91
|
+
|
92
|
+
// A fallback to window.onload, that will always work
|
93
|
+
window.addEventListener( "load", completed );
|
94
|
+
}
|
95
|
+
|
96
|
+
} );
|
@@ -0,0 +1,86 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../var/document",
|
4
|
+
"../core/readyException",
|
5
|
+
"../deferred"
|
6
|
+
], function( jQuery, document ) {
|
7
|
+
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
// The deferred used on DOM ready
|
11
|
+
var readyList = jQuery.Deferred();
|
12
|
+
|
13
|
+
jQuery.fn.ready = function( fn ) {
|
14
|
+
|
15
|
+
readyList
|
16
|
+
.then( fn )
|
17
|
+
|
18
|
+
// Wrap jQuery.readyException in a function so that the lookup
|
19
|
+
// happens at the time of error handling instead of callback
|
20
|
+
// registration.
|
21
|
+
.catch( function( error ) {
|
22
|
+
jQuery.readyException( error );
|
23
|
+
} );
|
24
|
+
|
25
|
+
return this;
|
26
|
+
};
|
27
|
+
|
28
|
+
jQuery.extend( {
|
29
|
+
|
30
|
+
// Is the DOM ready to be used? Set to true once it occurs.
|
31
|
+
isReady: false,
|
32
|
+
|
33
|
+
// A counter to track how many items to wait for before
|
34
|
+
// the ready event fires. See #6781
|
35
|
+
readyWait: 1,
|
36
|
+
|
37
|
+
// Handle when the DOM is ready
|
38
|
+
ready: function( wait ) {
|
39
|
+
|
40
|
+
// Abort if there are pending holds or we're already ready
|
41
|
+
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
|
45
|
+
// Remember that the DOM is ready
|
46
|
+
jQuery.isReady = true;
|
47
|
+
|
48
|
+
// If a normal DOM Ready event fired, decrement, and wait if need be
|
49
|
+
if ( wait !== true && --jQuery.readyWait > 0 ) {
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
|
53
|
+
// If there are functions bound, to execute
|
54
|
+
readyList.resolveWith( document, [ jQuery ] );
|
55
|
+
}
|
56
|
+
} );
|
57
|
+
|
58
|
+
jQuery.ready.then = readyList.then;
|
59
|
+
|
60
|
+
// The ready event handler and self cleanup method
|
61
|
+
function completed() {
|
62
|
+
document.removeEventListener( "DOMContentLoaded", completed );
|
63
|
+
window.removeEventListener( "load", completed );
|
64
|
+
jQuery.ready();
|
65
|
+
}
|
66
|
+
|
67
|
+
// Catch cases where $(document).ready() is called
|
68
|
+
// after the browser event has already occurred.
|
69
|
+
// Support: IE <=9 - 10 only
|
70
|
+
// Older IE sometimes signals "interactive" too soon
|
71
|
+
if ( document.readyState === "complete" ||
|
72
|
+
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
|
73
|
+
|
74
|
+
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
75
|
+
window.setTimeout( jQuery.ready );
|
76
|
+
|
77
|
+
} else {
|
78
|
+
|
79
|
+
// Use the handy event callback
|
80
|
+
document.addEventListener( "DOMContentLoaded", completed );
|
81
|
+
|
82
|
+
// A fallback to window.onload, that will always work
|
83
|
+
window.addEventListener( "load", completed );
|
84
|
+
}
|
85
|
+
|
86
|
+
} );
|