mes 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/middleman_ember_scaffold/cli.rb +14 -2
- data/lib/middleman_ember_scaffold/cli/generators.rb +55 -19
- data/lib/middleman_ember_scaffold/generator_templates/controller.coffee +0 -0
- data/lib/middleman_ember_scaffold/generator_templates/model.coffee +0 -0
- data/lib/middleman_ember_scaffold/generator_templates/template.emblem +0 -0
- data/lib/middleman_ember_scaffold/generator_templates/view.coffee +0 -0
- data/lib/middleman_ember_scaffold/generators/generate.rb +53 -0
- data/lib/middleman_ember_scaffold/generators/scaffold.rb +46 -16
- data/lib/middleman_ember_scaffold/generators/types/controller.rb +9 -0
- data/lib/middleman_ember_scaffold/generators/types/model.rb +7 -0
- data/lib/middleman_ember_scaffold/generators/types/template.rb +7 -0
- data/lib/middleman_ember_scaffold/generators/types/view.rb +7 -0
- data/lib/middleman_ember_scaffold/template/Gemfile +6 -1
- data/lib/middleman_ember_scaffold/template/config.rb +13 -1
- data/lib/middleman_ember_scaffold/template/source/app/application.coffee +1 -2
- data/lib/middleman_ember_scaffold/template/vendor/javascripts/jquery.js +9243 -9033
- data/lib/middleman_ember_scaffold/version.rb +1 -1
- data/mes.gemspec +1 -0
- metadata +92 -89
- data/lib/middleman_ember_scaffold/template/component.json +0 -14
- data/lib/middleman_ember_scaffold/template/components/ember-data/README.md +0 -4
- data/lib/middleman_ember_scaffold/template/components/ember-data/component.json +0 -22
- data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data-spade.js +0 -1
- data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data.amd.js +0 -7819
- data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data.js +0 -8769
- data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data.min.js +0 -12
- data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data.prod.js +0 -7802
- data/lib/middleman_ember_scaffold/template/components/ember/component.json +0 -20
- data/lib/middleman_ember_scaffold/template/components/ember/ember.js +0 -27755
- data/lib/middleman_ember_scaffold/template/components/ember/ember.min.js +0 -20
- data/lib/middleman_ember_scaffold/template/components/handlebars/component.json +0 -17
- data/lib/middleman_ember_scaffold/template/components/handlebars/handlebars.js +0 -2201
- data/lib/middleman_ember_scaffold/template/components/handlebars/handlebars.runtime.js +0 -321
- data/lib/middleman_ember_scaffold/template/components/jquery/component.json +0 -14
- data/lib/middleman_ember_scaffold/template/components/jquery/composer.json +0 -26
- data/lib/middleman_ember_scaffold/template/components/jquery/jquery-migrate.js +0 -496
- data/lib/middleman_ember_scaffold/template/components/jquery/jquery-migrate.min.js +0 -3
- data/lib/middleman_ember_scaffold/template/components/jquery/jquery.js +0 -9597
- data/lib/middleman_ember_scaffold/template/components/jquery/jquery.min.js +0 -5
- data/lib/middleman_ember_scaffold/template/vendor/javascripts/ember-data.js +0 -8769
- data/lib/middleman_ember_scaffold/template/vendor/javascripts/ember.js +0 -27755
- data/lib/middleman_ember_scaffold/template/vendor/javascripts/handlebars.js +0 -2201
@@ -1,321 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
|
3
|
-
Copyright (C) 2011 by Yehuda Katz
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
22
|
-
|
23
|
-
*/
|
24
|
-
|
25
|
-
// lib/handlebars/base.js
|
26
|
-
|
27
|
-
/*jshint eqnull:true*/
|
28
|
-
this.Handlebars = {};
|
29
|
-
|
30
|
-
(function(Handlebars) {
|
31
|
-
|
32
|
-
Handlebars.VERSION = "1.0.0-rc.3";
|
33
|
-
Handlebars.COMPILER_REVISION = 2;
|
34
|
-
|
35
|
-
Handlebars.REVISION_CHANGES = {
|
36
|
-
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
|
37
|
-
2: '>= 1.0.0-rc.3'
|
38
|
-
};
|
39
|
-
|
40
|
-
Handlebars.helpers = {};
|
41
|
-
Handlebars.partials = {};
|
42
|
-
|
43
|
-
Handlebars.registerHelper = function(name, fn, inverse) {
|
44
|
-
if(inverse) { fn.not = inverse; }
|
45
|
-
this.helpers[name] = fn;
|
46
|
-
};
|
47
|
-
|
48
|
-
Handlebars.registerPartial = function(name, str) {
|
49
|
-
this.partials[name] = str;
|
50
|
-
};
|
51
|
-
|
52
|
-
Handlebars.registerHelper('helperMissing', function(arg) {
|
53
|
-
if(arguments.length === 2) {
|
54
|
-
return undefined;
|
55
|
-
} else {
|
56
|
-
throw new Error("Could not find property '" + arg + "'");
|
57
|
-
}
|
58
|
-
});
|
59
|
-
|
60
|
-
var toString = Object.prototype.toString, functionType = "[object Function]";
|
61
|
-
|
62
|
-
Handlebars.registerHelper('blockHelperMissing', function(context, options) {
|
63
|
-
var inverse = options.inverse || function() {}, fn = options.fn;
|
64
|
-
|
65
|
-
|
66
|
-
var ret = "";
|
67
|
-
var type = toString.call(context);
|
68
|
-
|
69
|
-
if(type === functionType) { context = context.call(this); }
|
70
|
-
|
71
|
-
if(context === true) {
|
72
|
-
return fn(this);
|
73
|
-
} else if(context === false || context == null) {
|
74
|
-
return inverse(this);
|
75
|
-
} else if(type === "[object Array]") {
|
76
|
-
if(context.length > 0) {
|
77
|
-
return Handlebars.helpers.each(context, options);
|
78
|
-
} else {
|
79
|
-
return inverse(this);
|
80
|
-
}
|
81
|
-
} else {
|
82
|
-
return fn(context);
|
83
|
-
}
|
84
|
-
});
|
85
|
-
|
86
|
-
Handlebars.K = function() {};
|
87
|
-
|
88
|
-
Handlebars.createFrame = Object.create || function(object) {
|
89
|
-
Handlebars.K.prototype = object;
|
90
|
-
var obj = new Handlebars.K();
|
91
|
-
Handlebars.K.prototype = null;
|
92
|
-
return obj;
|
93
|
-
};
|
94
|
-
|
95
|
-
Handlebars.logger = {
|
96
|
-
DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
|
97
|
-
|
98
|
-
methodMap: {0: 'debug', 1: 'info', 2: 'warn', 3: 'error'},
|
99
|
-
|
100
|
-
// can be overridden in the host environment
|
101
|
-
log: function(level, obj) {
|
102
|
-
if (Handlebars.logger.level <= level) {
|
103
|
-
var method = Handlebars.logger.methodMap[level];
|
104
|
-
if (typeof console !== 'undefined' && console[method]) {
|
105
|
-
console[method].call(console, obj);
|
106
|
-
}
|
107
|
-
}
|
108
|
-
}
|
109
|
-
};
|
110
|
-
|
111
|
-
Handlebars.log = function(level, obj) { Handlebars.logger.log(level, obj); };
|
112
|
-
|
113
|
-
Handlebars.registerHelper('each', function(context, options) {
|
114
|
-
var fn = options.fn, inverse = options.inverse;
|
115
|
-
var i = 0, ret = "", data;
|
116
|
-
|
117
|
-
if (options.data) {
|
118
|
-
data = Handlebars.createFrame(options.data);
|
119
|
-
}
|
120
|
-
|
121
|
-
if(context && typeof context === 'object') {
|
122
|
-
if(context instanceof Array){
|
123
|
-
for(var j = context.length; i<j; i++) {
|
124
|
-
if (data) { data.index = i; }
|
125
|
-
ret = ret + fn(context[i], { data: data });
|
126
|
-
}
|
127
|
-
} else {
|
128
|
-
for(var key in context) {
|
129
|
-
if(context.hasOwnProperty(key)) {
|
130
|
-
if(data) { data.key = key; }
|
131
|
-
ret = ret + fn(context[key], {data: data});
|
132
|
-
i++;
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
if(i === 0){
|
139
|
-
ret = inverse(this);
|
140
|
-
}
|
141
|
-
|
142
|
-
return ret;
|
143
|
-
});
|
144
|
-
|
145
|
-
Handlebars.registerHelper('if', function(context, options) {
|
146
|
-
var type = toString.call(context);
|
147
|
-
if(type === functionType) { context = context.call(this); }
|
148
|
-
|
149
|
-
if(!context || Handlebars.Utils.isEmpty(context)) {
|
150
|
-
return options.inverse(this);
|
151
|
-
} else {
|
152
|
-
return options.fn(this);
|
153
|
-
}
|
154
|
-
});
|
155
|
-
|
156
|
-
Handlebars.registerHelper('unless', function(context, options) {
|
157
|
-
var fn = options.fn, inverse = options.inverse;
|
158
|
-
options.fn = inverse;
|
159
|
-
options.inverse = fn;
|
160
|
-
|
161
|
-
return Handlebars.helpers['if'].call(this, context, options);
|
162
|
-
});
|
163
|
-
|
164
|
-
Handlebars.registerHelper('with', function(context, options) {
|
165
|
-
return options.fn(context);
|
166
|
-
});
|
167
|
-
|
168
|
-
Handlebars.registerHelper('log', function(context, options) {
|
169
|
-
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
|
170
|
-
Handlebars.log(level, context);
|
171
|
-
});
|
172
|
-
|
173
|
-
}(this.Handlebars));
|
174
|
-
;
|
175
|
-
// lib/handlebars/utils.js
|
176
|
-
|
177
|
-
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
|
178
|
-
|
179
|
-
Handlebars.Exception = function(message) {
|
180
|
-
var tmp = Error.prototype.constructor.apply(this, arguments);
|
181
|
-
|
182
|
-
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
|
183
|
-
for (var idx = 0; idx < errorProps.length; idx++) {
|
184
|
-
this[errorProps[idx]] = tmp[errorProps[idx]];
|
185
|
-
}
|
186
|
-
};
|
187
|
-
Handlebars.Exception.prototype = new Error();
|
188
|
-
|
189
|
-
// Build out our basic SafeString type
|
190
|
-
Handlebars.SafeString = function(string) {
|
191
|
-
this.string = string;
|
192
|
-
};
|
193
|
-
Handlebars.SafeString.prototype.toString = function() {
|
194
|
-
return this.string.toString();
|
195
|
-
};
|
196
|
-
|
197
|
-
(function() {
|
198
|
-
var escape = {
|
199
|
-
"&": "&",
|
200
|
-
"<": "<",
|
201
|
-
">": ">",
|
202
|
-
'"': """,
|
203
|
-
"'": "'",
|
204
|
-
"`": "`"
|
205
|
-
};
|
206
|
-
|
207
|
-
var badChars = /[&<>"'`]/g;
|
208
|
-
var possible = /[&<>"'`]/;
|
209
|
-
|
210
|
-
var escapeChar = function(chr) {
|
211
|
-
return escape[chr] || "&";
|
212
|
-
};
|
213
|
-
|
214
|
-
Handlebars.Utils = {
|
215
|
-
escapeExpression: function(string) {
|
216
|
-
// don't escape SafeStrings, since they're already safe
|
217
|
-
if (string instanceof Handlebars.SafeString) {
|
218
|
-
return string.toString();
|
219
|
-
} else if (string == null || string === false) {
|
220
|
-
return "";
|
221
|
-
}
|
222
|
-
|
223
|
-
if(!possible.test(string)) { return string; }
|
224
|
-
return string.replace(badChars, escapeChar);
|
225
|
-
},
|
226
|
-
|
227
|
-
isEmpty: function(value) {
|
228
|
-
if (!value && value !== 0) {
|
229
|
-
return true;
|
230
|
-
} else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
|
231
|
-
return true;
|
232
|
-
} else {
|
233
|
-
return false;
|
234
|
-
}
|
235
|
-
}
|
236
|
-
};
|
237
|
-
})();;
|
238
|
-
// lib/handlebars/runtime.js
|
239
|
-
Handlebars.VM = {
|
240
|
-
template: function(templateSpec) {
|
241
|
-
// Just add water
|
242
|
-
var container = {
|
243
|
-
escapeExpression: Handlebars.Utils.escapeExpression,
|
244
|
-
invokePartial: Handlebars.VM.invokePartial,
|
245
|
-
programs: [],
|
246
|
-
program: function(i, fn, data) {
|
247
|
-
var programWrapper = this.programs[i];
|
248
|
-
if(data) {
|
249
|
-
return Handlebars.VM.program(fn, data);
|
250
|
-
} else if(programWrapper) {
|
251
|
-
return programWrapper;
|
252
|
-
} else {
|
253
|
-
programWrapper = this.programs[i] = Handlebars.VM.program(fn);
|
254
|
-
return programWrapper;
|
255
|
-
}
|
256
|
-
},
|
257
|
-
programWithDepth: Handlebars.VM.programWithDepth,
|
258
|
-
noop: Handlebars.VM.noop,
|
259
|
-
compilerInfo: null
|
260
|
-
};
|
261
|
-
|
262
|
-
return function(context, options) {
|
263
|
-
options = options || {};
|
264
|
-
var result = templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);
|
265
|
-
|
266
|
-
var compilerInfo = container.compilerInfo || [],
|
267
|
-
compilerRevision = compilerInfo[0] || 1,
|
268
|
-
currentRevision = Handlebars.COMPILER_REVISION;
|
269
|
-
|
270
|
-
if (compilerRevision !== currentRevision) {
|
271
|
-
if (compilerRevision < currentRevision) {
|
272
|
-
var runtimeVersions = Handlebars.REVISION_CHANGES[currentRevision],
|
273
|
-
compilerVersions = Handlebars.REVISION_CHANGES[compilerRevision];
|
274
|
-
throw "Template was precompiled with an older version of Handlebars than the current runtime. "+
|
275
|
-
"Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").";
|
276
|
-
} else {
|
277
|
-
// Use the embedded version info since the runtime doesn't know about this revision yet
|
278
|
-
throw "Template was precompiled with a newer version of Handlebars than the current runtime. "+
|
279
|
-
"Please update your runtime to a newer version ("+compilerInfo[1]+").";
|
280
|
-
}
|
281
|
-
}
|
282
|
-
|
283
|
-
return result;
|
284
|
-
};
|
285
|
-
},
|
286
|
-
|
287
|
-
programWithDepth: function(fn, data, $depth) {
|
288
|
-
var args = Array.prototype.slice.call(arguments, 2);
|
289
|
-
|
290
|
-
return function(context, options) {
|
291
|
-
options = options || {};
|
292
|
-
|
293
|
-
return fn.apply(this, [context, options.data || data].concat(args));
|
294
|
-
};
|
295
|
-
},
|
296
|
-
program: function(fn, data) {
|
297
|
-
return function(context, options) {
|
298
|
-
options = options || {};
|
299
|
-
|
300
|
-
return fn(context, options.data || data);
|
301
|
-
};
|
302
|
-
},
|
303
|
-
noop: function() { return ""; },
|
304
|
-
invokePartial: function(partial, name, context, helpers, partials, data) {
|
305
|
-
var options = { helpers: helpers, partials: partials, data: data };
|
306
|
-
|
307
|
-
if(partial === undefined) {
|
308
|
-
throw new Handlebars.Exception("The partial " + name + " could not be found");
|
309
|
-
} else if(partial instanceof Function) {
|
310
|
-
return partial(context, options);
|
311
|
-
} else if (!Handlebars.compile) {
|
312
|
-
throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
|
313
|
-
} else {
|
314
|
-
partials[name] = Handlebars.compile(partial, {data: data !== undefined});
|
315
|
-
return partials[name](context, options);
|
316
|
-
}
|
317
|
-
}
|
318
|
-
};
|
319
|
-
|
320
|
-
Handlebars.template = Handlebars.VM.template;
|
321
|
-
;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "jquery",
|
3
|
-
"version": "1.9.1",
|
4
|
-
"main": "./jquery.js",
|
5
|
-
"dependencies": {},
|
6
|
-
"gitHead": "c09c0bde45fa279780815d789d8ee53d3762ace3",
|
7
|
-
"_id": "jquery@1.9.1",
|
8
|
-
"readme": "ERROR: No README.md file found!",
|
9
|
-
"description": "ERROR: No README.md file found!",
|
10
|
-
"repository": {
|
11
|
-
"type": "git",
|
12
|
-
"url": "git://github.com/components/jquery.git"
|
13
|
-
}
|
14
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "components/jquery",
|
3
|
-
"description": "jQuery JavaScript Library",
|
4
|
-
"type": "component",
|
5
|
-
"homepage": "http://jquery.com",
|
6
|
-
"license": "MIT",
|
7
|
-
"support": {
|
8
|
-
"irc": "irc://irc.freenode.org/jquery",
|
9
|
-
"issues": "http://bugs.jquery.com",
|
10
|
-
"forum": "http://forum.jquery.com",
|
11
|
-
"wiki": "http://docs.jquery.com/",
|
12
|
-
"source": "https://github.com/jquery/jquery"
|
13
|
-
},
|
14
|
-
"authors": [
|
15
|
-
{
|
16
|
-
"name": "John Resig",
|
17
|
-
"email": "jeresig@gmail.com"
|
18
|
-
}
|
19
|
-
],
|
20
|
-
"require": {
|
21
|
-
"robloach/component-installer": "*"
|
22
|
-
},
|
23
|
-
"extra": {
|
24
|
-
"js": "jquery.js"
|
25
|
-
}
|
26
|
-
}
|
@@ -1,496 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* jQuery Migrate - v1.1.0 - 2013-01-31
|
3
|
-
* https://github.com/jquery/jquery-migrate
|
4
|
-
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
|
5
|
-
*/
|
6
|
-
(function( jQuery, window, undefined ) {
|
7
|
-
"use strict";
|
8
|
-
|
9
|
-
|
10
|
-
var warnedAbout = {};
|
11
|
-
|
12
|
-
// List of warnings already given; public read only
|
13
|
-
jQuery.migrateWarnings = [];
|
14
|
-
|
15
|
-
// Set to true to prevent console output; migrateWarnings still maintained
|
16
|
-
// jQuery.migrateMute = false;
|
17
|
-
|
18
|
-
// Show a message on the console so devs know we're active
|
19
|
-
if ( !jQuery.migrateMute && window.console && console.log ) {
|
20
|
-
console.log("JQMIGRATE: Logging is active");
|
21
|
-
}
|
22
|
-
|
23
|
-
// Set to false to disable traces that appear with warnings
|
24
|
-
if ( jQuery.migrateTrace === undefined ) {
|
25
|
-
jQuery.migrateTrace = true;
|
26
|
-
}
|
27
|
-
|
28
|
-
// Forget any warnings we've already given; public
|
29
|
-
jQuery.migrateReset = function() {
|
30
|
-
warnedAbout = {};
|
31
|
-
jQuery.migrateWarnings.length = 0;
|
32
|
-
};
|
33
|
-
|
34
|
-
function migrateWarn( msg) {
|
35
|
-
if ( !warnedAbout[ msg ] ) {
|
36
|
-
warnedAbout[ msg ] = true;
|
37
|
-
jQuery.migrateWarnings.push( msg );
|
38
|
-
if ( window.console && console.warn && !jQuery.migrateMute ) {
|
39
|
-
console.warn( "JQMIGRATE: " + msg );
|
40
|
-
if ( jQuery.migrateTrace && console.trace ) {
|
41
|
-
console.trace();
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
function migrateWarnProp( obj, prop, value, msg ) {
|
48
|
-
if ( Object.defineProperty ) {
|
49
|
-
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
50
|
-
// allow property to be overwritten in case some other plugin wants it
|
51
|
-
try {
|
52
|
-
Object.defineProperty( obj, prop, {
|
53
|
-
configurable: true,
|
54
|
-
enumerable: true,
|
55
|
-
get: function() {
|
56
|
-
migrateWarn( msg );
|
57
|
-
return value;
|
58
|
-
},
|
59
|
-
set: function( newValue ) {
|
60
|
-
migrateWarn( msg );
|
61
|
-
value = newValue;
|
62
|
-
}
|
63
|
-
});
|
64
|
-
return;
|
65
|
-
} catch( err ) {
|
66
|
-
// IE8 is a dope about Object.defineProperty, can't warn there
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
|
-
// Non-ES5 (or broken) browser; just set the property
|
71
|
-
jQuery._definePropertyBroken = true;
|
72
|
-
obj[ prop ] = value;
|
73
|
-
}
|
74
|
-
|
75
|
-
if ( document.compatMode === "BackCompat" ) {
|
76
|
-
// jQuery has never supported or tested Quirks Mode
|
77
|
-
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
78
|
-
}
|
79
|
-
|
80
|
-
|
81
|
-
var attrFn = {},
|
82
|
-
oldAttr = jQuery.attr,
|
83
|
-
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
84
|
-
function() { return null; },
|
85
|
-
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
86
|
-
function() { return undefined; },
|
87
|
-
rnoType = /^(?:input|button)$/i,
|
88
|
-
rnoAttrNodeType = /^[238]$/,
|
89
|
-
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
90
|
-
ruseDefault = /^(?:checked|selected)$/i;
|
91
|
-
|
92
|
-
// jQuery.attrFn
|
93
|
-
migrateWarnProp( jQuery, "attrFn", attrFn, "jQuery.attrFn is deprecated" );
|
94
|
-
|
95
|
-
jQuery.attr = function( elem, name, value, pass ) {
|
96
|
-
var lowerName = name.toLowerCase(),
|
97
|
-
nType = elem && elem.nodeType;
|
98
|
-
|
99
|
-
// Since pass is used internally, we only warn and shim for new jQuery
|
100
|
-
// versions where there isn't a pass arg in the formal params
|
101
|
-
if ( pass && oldAttr.length < 4 ) {
|
102
|
-
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
103
|
-
if ( elem && !rnoAttrNodeType.test( nType ) && jQuery.isFunction( jQuery.fn[ name ] ) ) {
|
104
|
-
return jQuery( elem )[ name ]( value );
|
105
|
-
}
|
106
|
-
}
|
107
|
-
|
108
|
-
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
|
109
|
-
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
|
110
|
-
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
|
111
|
-
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
112
|
-
}
|
113
|
-
|
114
|
-
// Restore boolHook for boolean property/attribute synchronization
|
115
|
-
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
116
|
-
jQuery.attrHooks[ lowerName ] = {
|
117
|
-
get: function( elem, name ) {
|
118
|
-
// Align boolean attributes with corresponding properties
|
119
|
-
// Fall back to attribute presence where some booleans are not supported
|
120
|
-
var attrNode,
|
121
|
-
property = jQuery.prop( elem, name );
|
122
|
-
return property === true || typeof property !== "boolean" &&
|
123
|
-
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
124
|
-
|
125
|
-
name.toLowerCase() :
|
126
|
-
undefined;
|
127
|
-
},
|
128
|
-
set: function( elem, value, name ) {
|
129
|
-
var propName;
|
130
|
-
if ( value === false ) {
|
131
|
-
// Remove boolean attributes when set to false
|
132
|
-
jQuery.removeAttr( elem, name );
|
133
|
-
} else {
|
134
|
-
// value is true since we know at this point it's type boolean and not false
|
135
|
-
// Set boolean attributes to the same name and set the DOM property
|
136
|
-
propName = jQuery.propFix[ name ] || name;
|
137
|
-
if ( propName in elem ) {
|
138
|
-
// Only set the IDL specifically if it already exists on the element
|
139
|
-
elem[ propName ] = true;
|
140
|
-
}
|
141
|
-
|
142
|
-
elem.setAttribute( name, name.toLowerCase() );
|
143
|
-
}
|
144
|
-
return name;
|
145
|
-
}
|
146
|
-
};
|
147
|
-
|
148
|
-
// Warn only for attributes that can remain distinct from their properties post-1.9
|
149
|
-
if ( ruseDefault.test( lowerName ) ) {
|
150
|
-
migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
return oldAttr.call( jQuery, elem, name, value );
|
155
|
-
};
|
156
|
-
|
157
|
-
// attrHooks: value
|
158
|
-
jQuery.attrHooks.value = {
|
159
|
-
get: function( elem, name ) {
|
160
|
-
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
161
|
-
if ( nodeName === "button" ) {
|
162
|
-
return valueAttrGet.apply( this, arguments );
|
163
|
-
}
|
164
|
-
if ( nodeName !== "input" && nodeName !== "option" ) {
|
165
|
-
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
|
166
|
-
}
|
167
|
-
return name in elem ?
|
168
|
-
elem.value :
|
169
|
-
null;
|
170
|
-
},
|
171
|
-
set: function( elem, value ) {
|
172
|
-
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
173
|
-
if ( nodeName === "button" ) {
|
174
|
-
return valueAttrSet.apply( this, arguments );
|
175
|
-
}
|
176
|
-
if ( nodeName !== "input" && nodeName !== "option" ) {
|
177
|
-
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
|
178
|
-
}
|
179
|
-
// Does not return so that setAttribute is also used
|
180
|
-
elem.value = value;
|
181
|
-
}
|
182
|
-
};
|
183
|
-
|
184
|
-
|
185
|
-
var matched, browser,
|
186
|
-
oldInit = jQuery.fn.init,
|
187
|
-
oldParseJSON = jQuery.parseJSON,
|
188
|
-
// Note this does NOT include the #9521 XSS fix from 1.7!
|
189
|
-
rquickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;
|
190
|
-
|
191
|
-
// $(html) "looks like html" rule change
|
192
|
-
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
193
|
-
var match;
|
194
|
-
|
195
|
-
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
196
|
-
(match = rquickExpr.exec( selector )) && match[1] ) {
|
197
|
-
// This is an HTML string according to the "old" rules; is it still?
|
198
|
-
if ( selector.charAt( 0 ) !== "<" ) {
|
199
|
-
migrateWarn("$(html) HTML strings must start with '<' character");
|
200
|
-
}
|
201
|
-
// Now process using loose rules; let pre-1.8 play too
|
202
|
-
if ( context && context.context ) {
|
203
|
-
// jQuery object as context; parseHTML expects a DOM object
|
204
|
-
context = context.context;
|
205
|
-
}
|
206
|
-
if ( jQuery.parseHTML ) {
|
207
|
-
return oldInit.call( this, jQuery.parseHTML( jQuery.trim(selector), context, true ),
|
208
|
-
context, rootjQuery );
|
209
|
-
}
|
210
|
-
}
|
211
|
-
return oldInit.apply( this, arguments );
|
212
|
-
};
|
213
|
-
jQuery.fn.init.prototype = jQuery.fn;
|
214
|
-
|
215
|
-
// Let $.parseJSON(falsy_value) return null
|
216
|
-
jQuery.parseJSON = function( json ) {
|
217
|
-
if ( !json && json !== null ) {
|
218
|
-
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
219
|
-
return null;
|
220
|
-
}
|
221
|
-
return oldParseJSON.apply( this, arguments );
|
222
|
-
};
|
223
|
-
|
224
|
-
jQuery.uaMatch = function( ua ) {
|
225
|
-
ua = ua.toLowerCase();
|
226
|
-
|
227
|
-
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
228
|
-
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
229
|
-
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
230
|
-
/(msie) ([\w.]+)/.exec( ua ) ||
|
231
|
-
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
232
|
-
[];
|
233
|
-
|
234
|
-
return {
|
235
|
-
browser: match[ 1 ] || "",
|
236
|
-
version: match[ 2 ] || "0"
|
237
|
-
};
|
238
|
-
};
|
239
|
-
|
240
|
-
matched = jQuery.uaMatch( navigator.userAgent );
|
241
|
-
browser = {};
|
242
|
-
|
243
|
-
if ( matched.browser ) {
|
244
|
-
browser[ matched.browser ] = true;
|
245
|
-
browser.version = matched.version;
|
246
|
-
}
|
247
|
-
|
248
|
-
// Chrome is Webkit, but Webkit is also Safari.
|
249
|
-
if ( browser.chrome ) {
|
250
|
-
browser.webkit = true;
|
251
|
-
} else if ( browser.webkit ) {
|
252
|
-
browser.safari = true;
|
253
|
-
}
|
254
|
-
|
255
|
-
jQuery.browser = browser;
|
256
|
-
|
257
|
-
// Warn if the code tries to get jQuery.browser
|
258
|
-
migrateWarnProp( jQuery, "browser", browser, "jQuery.browser is deprecated" );
|
259
|
-
|
260
|
-
jQuery.sub = function() {
|
261
|
-
function jQuerySub( selector, context ) {
|
262
|
-
return new jQuerySub.fn.init( selector, context );
|
263
|
-
}
|
264
|
-
jQuery.extend( true, jQuerySub, this );
|
265
|
-
jQuerySub.superclass = this;
|
266
|
-
jQuerySub.fn = jQuerySub.prototype = this();
|
267
|
-
jQuerySub.fn.constructor = jQuerySub;
|
268
|
-
jQuerySub.sub = this.sub;
|
269
|
-
jQuerySub.fn.init = function init( selector, context ) {
|
270
|
-
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
271
|
-
context = jQuerySub( context );
|
272
|
-
}
|
273
|
-
|
274
|
-
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
275
|
-
};
|
276
|
-
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
277
|
-
var rootjQuerySub = jQuerySub(document);
|
278
|
-
migrateWarn( "jQuery.sub() is deprecated" );
|
279
|
-
return jQuerySub;
|
280
|
-
};
|
281
|
-
|
282
|
-
|
283
|
-
var oldFnData = jQuery.fn.data;
|
284
|
-
|
285
|
-
jQuery.fn.data = function( name ) {
|
286
|
-
var ret, evt,
|
287
|
-
elem = this[0];
|
288
|
-
|
289
|
-
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
290
|
-
if ( elem && name === "events" && arguments.length === 1 ) {
|
291
|
-
ret = jQuery.data( elem, name );
|
292
|
-
evt = jQuery._data( elem, name );
|
293
|
-
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
294
|
-
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
295
|
-
return evt;
|
296
|
-
}
|
297
|
-
}
|
298
|
-
return oldFnData.apply( this, arguments );
|
299
|
-
};
|
300
|
-
|
301
|
-
|
302
|
-
var rscriptType = /\/(java|ecma)script/i,
|
303
|
-
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
304
|
-
|
305
|
-
jQuery.fn.andSelf = function() {
|
306
|
-
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
307
|
-
return oldSelf.apply( this, arguments );
|
308
|
-
};
|
309
|
-
|
310
|
-
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
311
|
-
if ( !jQuery.clean ) {
|
312
|
-
jQuery.clean = function( elems, context, fragment, scripts ) {
|
313
|
-
// Set context per 1.8 logic
|
314
|
-
context = context || document;
|
315
|
-
context = !context.nodeType && context[0] || context;
|
316
|
-
context = context.ownerDocument || context;
|
317
|
-
|
318
|
-
migrateWarn("jQuery.clean() is deprecated");
|
319
|
-
|
320
|
-
var i, elem, handleScript, jsTags,
|
321
|
-
ret = [];
|
322
|
-
|
323
|
-
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
324
|
-
|
325
|
-
// Complex logic lifted directly from jQuery 1.8
|
326
|
-
if ( fragment ) {
|
327
|
-
// Special handling of each script element
|
328
|
-
handleScript = function( elem ) {
|
329
|
-
// Check if we consider it executable
|
330
|
-
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
331
|
-
// Detach the script and store it in the scripts array (if provided) or the fragment
|
332
|
-
// Return truthy to indicate that it has been handled
|
333
|
-
return scripts ?
|
334
|
-
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
335
|
-
fragment.appendChild( elem );
|
336
|
-
}
|
337
|
-
};
|
338
|
-
|
339
|
-
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
340
|
-
// Check if we're done after handling an executable script
|
341
|
-
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
342
|
-
// Append to fragment and handle embedded scripts
|
343
|
-
fragment.appendChild( elem );
|
344
|
-
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
345
|
-
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
346
|
-
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
347
|
-
|
348
|
-
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
349
|
-
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
350
|
-
i += jsTags.length;
|
351
|
-
}
|
352
|
-
}
|
353
|
-
}
|
354
|
-
}
|
355
|
-
|
356
|
-
return ret;
|
357
|
-
};
|
358
|
-
}
|
359
|
-
|
360
|
-
var eventAdd = jQuery.event.add,
|
361
|
-
eventRemove = jQuery.event.remove,
|
362
|
-
eventTrigger = jQuery.event.trigger,
|
363
|
-
oldToggle = jQuery.fn.toggle,
|
364
|
-
oldLive = jQuery.fn.live,
|
365
|
-
oldDie = jQuery.fn.die,
|
366
|
-
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
367
|
-
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
368
|
-
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
369
|
-
hoverHack = function( events ) {
|
370
|
-
if ( typeof( events ) != "string" || jQuery.event.special.hover ) {
|
371
|
-
return events;
|
372
|
-
}
|
373
|
-
if ( rhoverHack.test( events ) ) {
|
374
|
-
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
375
|
-
}
|
376
|
-
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
377
|
-
};
|
378
|
-
|
379
|
-
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
380
|
-
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
381
|
-
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
382
|
-
}
|
383
|
-
|
384
|
-
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
385
|
-
if ( jQuery.event.dispatch ) {
|
386
|
-
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
387
|
-
}
|
388
|
-
|
389
|
-
// Support for 'hover' pseudo-event and ajax event warnings
|
390
|
-
jQuery.event.add = function( elem, types, handler, data, selector ){
|
391
|
-
if ( elem !== document && rajaxEvent.test( types ) ) {
|
392
|
-
migrateWarn( "AJAX events should be attached to document: " + types );
|
393
|
-
}
|
394
|
-
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
395
|
-
};
|
396
|
-
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
397
|
-
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
398
|
-
};
|
399
|
-
|
400
|
-
jQuery.fn.error = function() {
|
401
|
-
var args = Array.prototype.slice.call( arguments, 0);
|
402
|
-
migrateWarn("jQuery.fn.error() is deprecated");
|
403
|
-
args.splice( 0, 0, "error" );
|
404
|
-
if ( arguments.length ) {
|
405
|
-
return this.bind.apply( this, args );
|
406
|
-
}
|
407
|
-
// error event should not bubble to window, although it does pre-1.7
|
408
|
-
this.triggerHandler.apply( this, args );
|
409
|
-
return this;
|
410
|
-
};
|
411
|
-
|
412
|
-
jQuery.fn.toggle = function( fn, fn2 ) {
|
413
|
-
|
414
|
-
// Don't mess with animation or css toggles
|
415
|
-
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
416
|
-
return oldToggle.apply( this, arguments );
|
417
|
-
}
|
418
|
-
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
419
|
-
|
420
|
-
// Save reference to arguments for access in closure
|
421
|
-
var args = arguments,
|
422
|
-
guid = fn.guid || jQuery.guid++,
|
423
|
-
i = 0,
|
424
|
-
toggler = function( event ) {
|
425
|
-
// Figure out which function to execute
|
426
|
-
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
427
|
-
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
428
|
-
|
429
|
-
// Make sure that clicks stop
|
430
|
-
event.preventDefault();
|
431
|
-
|
432
|
-
// and execute the function
|
433
|
-
return args[ lastToggle ].apply( this, arguments ) || false;
|
434
|
-
};
|
435
|
-
|
436
|
-
// link all the functions, so any of them can unbind this click handler
|
437
|
-
toggler.guid = guid;
|
438
|
-
while ( i < args.length ) {
|
439
|
-
args[ i++ ].guid = guid;
|
440
|
-
}
|
441
|
-
|
442
|
-
return this.click( toggler );
|
443
|
-
};
|
444
|
-
|
445
|
-
jQuery.fn.live = function( types, data, fn ) {
|
446
|
-
migrateWarn("jQuery.fn.live() is deprecated");
|
447
|
-
if ( oldLive ) {
|
448
|
-
return oldLive.apply( this, arguments );
|
449
|
-
}
|
450
|
-
jQuery( this.context ).on( types, this.selector, data, fn );
|
451
|
-
return this;
|
452
|
-
};
|
453
|
-
|
454
|
-
jQuery.fn.die = function( types, fn ) {
|
455
|
-
migrateWarn("jQuery.fn.die() is deprecated");
|
456
|
-
if ( oldDie ) {
|
457
|
-
return oldDie.apply( this, arguments );
|
458
|
-
}
|
459
|
-
jQuery( this.context ).off( types, this.selector || "**", fn );
|
460
|
-
return this;
|
461
|
-
};
|
462
|
-
|
463
|
-
// Turn global events into document-triggered events
|
464
|
-
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
465
|
-
if ( !elem & !rajaxEvent.test( event ) ) {
|
466
|
-
migrateWarn( "Global events are undocumented and deprecated" );
|
467
|
-
}
|
468
|
-
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
469
|
-
};
|
470
|
-
jQuery.each( ajaxEvents.split("|"),
|
471
|
-
function( _, name ) {
|
472
|
-
jQuery.event.special[ name ] = {
|
473
|
-
setup: function() {
|
474
|
-
var elem = this;
|
475
|
-
|
476
|
-
// The document needs no shimming; must be !== for oldIE
|
477
|
-
if ( elem !== document ) {
|
478
|
-
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
479
|
-
jQuery.event.trigger( name, null, elem, true );
|
480
|
-
});
|
481
|
-
jQuery._data( this, name, jQuery.guid++ );
|
482
|
-
}
|
483
|
-
return false;
|
484
|
-
},
|
485
|
-
teardown: function() {
|
486
|
-
if ( this !== document ) {
|
487
|
-
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
488
|
-
}
|
489
|
-
return false;
|
490
|
-
}
|
491
|
-
};
|
492
|
-
}
|
493
|
-
);
|
494
|
-
|
495
|
-
|
496
|
-
})( jQuery, window );
|