vanilla-jet 1.0.26 → 1.0.27
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.
package/framework/dipper.js
CHANGED
|
@@ -22,7 +22,8 @@ function Dipper(options, shared) {
|
|
|
22
22
|
'images' : '/public/images/',
|
|
23
23
|
'scripts' : '/public/scripts/',
|
|
24
24
|
'styles' : '/public/styles/',
|
|
25
|
-
'fonts' : '/public/fonts/'
|
|
25
|
+
'fonts' : '/public/fonts/',
|
|
26
|
+
'anims' : '/public/anims/'
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
// -- Static content
|
|
@@ -212,6 +213,15 @@ Dipper.prototype.registerScript = function(
|
|
|
212
213
|
};
|
|
213
214
|
}
|
|
214
215
|
|
|
216
|
+
Dipper.prototype.registerAnimation = function(name, url) {
|
|
217
|
+
|
|
218
|
+
let obj = this;
|
|
219
|
+
obj.anims[name] = {
|
|
220
|
+
'resource' : url,
|
|
221
|
+
'requires' : []
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
215
225
|
Dipper.prototype.enqueueStyle = function(name) {
|
|
216
226
|
|
|
217
227
|
var obj = this,
|
|
@@ -328,6 +338,23 @@ Dipper.prototype.includeScript = function(script) {
|
|
|
328
338
|
}
|
|
329
339
|
}
|
|
330
340
|
|
|
341
|
+
Dipper.prototype.includeAnimation = function(anim) {
|
|
342
|
+
|
|
343
|
+
let obj = this;
|
|
344
|
+
if (obj.anims[anim]) {
|
|
345
|
+
|
|
346
|
+
let item = obj.anims[anim],
|
|
347
|
+
output = '',
|
|
348
|
+
resource = item['resource'];
|
|
349
|
+
|
|
350
|
+
if (!/^(https?:\/\/|\/\/)/.test(resource)) {
|
|
351
|
+
let jsonAnim = obj.openJsonFile(resource);
|
|
352
|
+
output = `var ${item['name']} = ${JSON.stringify(jsonAnim)};`;
|
|
353
|
+
}
|
|
354
|
+
return output + "\n";
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
331
358
|
Dipper.prototype.includeStyles = function() {
|
|
332
359
|
|
|
333
360
|
var obj = this,
|
|
@@ -357,6 +384,20 @@ Dipper.prototype.includeScripts = function () {
|
|
|
357
384
|
return scriptsString;
|
|
358
385
|
}
|
|
359
386
|
|
|
387
|
+
Dipper.prototype.includeAnimations = function() {
|
|
388
|
+
|
|
389
|
+
let obj = this,
|
|
390
|
+
_ = require('underscore'),
|
|
391
|
+
animsString = '',
|
|
392
|
+
keys = Object.keys(obj.anims);
|
|
393
|
+
|
|
394
|
+
_.each(keys, function(anim) {
|
|
395
|
+
animsString += obj.includeAnim(anim);
|
|
396
|
+
});
|
|
397
|
+
let baseAnimsString = `<script>'${animsString}'</script>`;
|
|
398
|
+
return baseAnimsString;
|
|
399
|
+
}
|
|
400
|
+
|
|
360
401
|
Dipper.prototype.includeManifest = function() {
|
|
361
402
|
|
|
362
403
|
var obj = this,
|