@pageboard/html 0.14.19 → 0.14.20
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/elements/accordion.js +1 -1
- package/elements/fieldsets.js +1 -1
- package/elements/form.js +2 -2
- package/elements/grid.js +1 -1
- package/elements/image.js +1 -1
- package/elements/input-file.js +2 -2
- package/elements/input-property.js +1 -1
- package/elements/inputs.js +5 -5
- package/elements/layout.js +1 -1
- package/elements/link.js +2 -2
- package/elements/menu.js +2 -2
- package/elements/navigation.js +1 -1
- package/elements/page.js +1 -1
- package/elements/paragraph.js +2 -2
- package/elements/query-tags.js +1 -1
- package/elements/tab.js +1 -1
- package/elements/table.js +1 -1
- package/elements/template.js +1 -1
- package/package.json +3 -8
- package/ui/card.css +3 -3
- package/ui/components/accordion.css +241 -0
- package/ui/components/accordion.js +613 -0
- package/ui/components/ad.css +275 -0
- package/ui/components/api.js +1167 -0
- package/ui/components/breadcrumb.css +122 -0
- package/ui/components/button.css +3525 -0
- package/ui/components/card.css +939 -0
- package/ui/components/checkbox.css +604 -0
- package/ui/components/checkbox.js +831 -0
- package/ui/components/colorize.js +274 -0
- package/ui/components/comment.css +268 -0
- package/ui/components/container.css +149 -0
- package/ui/components/dimmer.css +224 -0
- package/ui/components/dimmer.js +733 -0
- package/ui/components/divider.css +253 -0
- package/ui/components/dropdown.css +1448 -0
- package/ui/components/dropdown.js +3955 -0
- package/ui/components/embed.css +160 -0
- package/ui/components/embed.js +706 -0
- package/ui/components/feed.css +281 -0
- package/ui/components/flag.css +1035 -0
- package/ui/components/form.css +1011 -0
- package/ui/components/form.js +1706 -0
- package/ui/components/grid.css +1941 -0
- package/ui/components/header.css +719 -0
- package/ui/components/icon.css +4777 -0
- package/ui/components/image.css +310 -0
- package/ui/components/input.css +469 -0
- package/ui/components/item.css +464 -0
- package/ui/components/label.css +1281 -0
- package/ui/components/list.css +943 -0
- package/ui/components/loader.css +339 -0
- package/ui/components/menu.css +1940 -0
- package/ui/components/message.css +468 -0
- package/ui/components/modal.css +617 -0
- package/ui/components/modal.js +1034 -0
- package/ui/components/nag.css +145 -0
- package/ui/components/nag.js +507 -0
- package/ui/components/placeholder.css +229 -0
- package/ui/components/popup.css +640 -0
- package/ui/components/popup.js +1532 -0
- package/ui/components/progress.css +502 -0
- package/ui/components/progress.js +931 -0
- package/ui/components/rail.css +152 -0
- package/ui/components/rating.css +257 -0
- package/ui/components/rating.js +508 -0
- package/ui/components/reset.css +476 -0
- package/ui/components/reveal.css +260 -0
- package/ui/components/search.css +431 -0
- package/ui/components/search.js +1505 -0
- package/ui/components/segment.css +824 -0
- package/ui/components/shape.css +143 -0
- package/ui/components/shape.js +921 -0
- package/ui/components/sidebar.css +537 -0
- package/ui/components/sidebar.js +1033 -0
- package/ui/components/site.css +184 -0
- package/ui/components/site.js +487 -0
- package/ui/components/state.js +708 -0
- package/ui/components/statistic.css +534 -0
- package/ui/components/step.css +566 -0
- package/ui/components/sticky.css +73 -0
- package/ui/components/sticky.js +959 -0
- package/ui/components/tab.css +89 -0
- package/ui/components/tab.js +952 -0
- package/ui/components/table.css +1108 -0
- package/ui/components/transition.css +1792 -0
- package/ui/components/transition.js +1095 -0
- package/ui/components/video.css +121 -0
- package/ui/components/video.js +532 -0
- package/ui/components/visibility.js +1311 -0
- package/ui/components/visit.js +517 -0
- package/ui/item.css +2 -2
- package/ui/themes/default/assets/fonts/brand-icons.eot +0 -0
- package/ui/themes/default/assets/fonts/brand-icons.svg +1008 -0
- package/ui/themes/default/assets/fonts/brand-icons.ttf +0 -0
- package/ui/themes/default/assets/fonts/brand-icons.woff +0 -0
- package/ui/themes/default/assets/fonts/brand-icons.woff2 +0 -0
- package/ui/themes/default/assets/fonts/icons.eot +0 -0
- package/ui/themes/default/assets/fonts/icons.otf +0 -0
- package/ui/themes/default/assets/fonts/icons.svg +1518 -0
- package/ui/themes/default/assets/fonts/icons.ttf +0 -0
- package/ui/themes/default/assets/fonts/icons.woff +0 -0
- package/ui/themes/default/assets/fonts/icons.woff2 +0 -0
- package/ui/themes/default/assets/fonts/outline-icons.eot +0 -0
- package/ui/themes/default/assets/fonts/outline-icons.svg +366 -0
- package/ui/themes/default/assets/fonts/outline-icons.ttf +0 -0
- package/ui/themes/default/assets/fonts/outline-icons.woff +0 -0
- package/ui/themes/default/assets/fonts/outline-icons.woff2 +0 -0
- package/ui/themes/default/assets/images/flags.png +0 -0
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* # Semantic UI 2.4.1 - Embed
|
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Released under the MIT license
|
|
7
|
+
* http://opensource.org/licenses/MIT
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
;(function ($, window, document, undefined) {
|
|
12
|
+
|
|
13
|
+
"use strict";
|
|
14
|
+
|
|
15
|
+
window = (typeof window != 'undefined' && window.Math == Math)
|
|
16
|
+
? window
|
|
17
|
+
: (typeof self != 'undefined' && self.Math == Math)
|
|
18
|
+
? self
|
|
19
|
+
: Function('return this')()
|
|
20
|
+
;
|
|
21
|
+
|
|
22
|
+
$.fn.embed = function(parameters) {
|
|
23
|
+
|
|
24
|
+
var
|
|
25
|
+
$allModules = $(this),
|
|
26
|
+
|
|
27
|
+
moduleSelector = $allModules.selector || '',
|
|
28
|
+
|
|
29
|
+
time = new Date().getTime(),
|
|
30
|
+
performance = [],
|
|
31
|
+
|
|
32
|
+
query = arguments[0],
|
|
33
|
+
methodInvoked = (typeof query == 'string'),
|
|
34
|
+
queryArguments = [].slice.call(arguments, 1),
|
|
35
|
+
|
|
36
|
+
returnedValue
|
|
37
|
+
;
|
|
38
|
+
|
|
39
|
+
$allModules
|
|
40
|
+
.each(function() {
|
|
41
|
+
var
|
|
42
|
+
settings = ( $.isPlainObject(parameters) )
|
|
43
|
+
? $.extend(true, {}, $.fn.embed.settings, parameters)
|
|
44
|
+
: $.extend({}, $.fn.embed.settings),
|
|
45
|
+
|
|
46
|
+
selector = settings.selector,
|
|
47
|
+
className = settings.className,
|
|
48
|
+
sources = settings.sources,
|
|
49
|
+
error = settings.error,
|
|
50
|
+
metadata = settings.metadata,
|
|
51
|
+
namespace = settings.namespace,
|
|
52
|
+
templates = settings.templates,
|
|
53
|
+
|
|
54
|
+
eventNamespace = '.' + namespace,
|
|
55
|
+
moduleNamespace = 'module-' + namespace,
|
|
56
|
+
|
|
57
|
+
$window = $(window),
|
|
58
|
+
$module = $(this),
|
|
59
|
+
$placeholder = $module.find(selector.placeholder),
|
|
60
|
+
$icon = $module.find(selector.icon),
|
|
61
|
+
$embed = $module.find(selector.embed),
|
|
62
|
+
|
|
63
|
+
element = this,
|
|
64
|
+
instance = $module.data(moduleNamespace),
|
|
65
|
+
module
|
|
66
|
+
;
|
|
67
|
+
|
|
68
|
+
module = {
|
|
69
|
+
|
|
70
|
+
initialize: function() {
|
|
71
|
+
module.debug('Initializing embed');
|
|
72
|
+
module.determine.autoplay();
|
|
73
|
+
module.create();
|
|
74
|
+
module.bind.events();
|
|
75
|
+
module.instantiate();
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
instantiate: function() {
|
|
79
|
+
module.verbose('Storing instance of module', module);
|
|
80
|
+
instance = module;
|
|
81
|
+
$module
|
|
82
|
+
.data(moduleNamespace, module)
|
|
83
|
+
;
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
destroy: function() {
|
|
87
|
+
module.verbose('Destroying previous instance of embed');
|
|
88
|
+
module.reset();
|
|
89
|
+
$module
|
|
90
|
+
.removeData(moduleNamespace)
|
|
91
|
+
.off(eventNamespace)
|
|
92
|
+
;
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
refresh: function() {
|
|
96
|
+
module.verbose('Refreshing selector cache');
|
|
97
|
+
$placeholder = $module.find(selector.placeholder);
|
|
98
|
+
$icon = $module.find(selector.icon);
|
|
99
|
+
$embed = $module.find(selector.embed);
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
bind: {
|
|
103
|
+
events: function() {
|
|
104
|
+
if( module.has.placeholder() ) {
|
|
105
|
+
module.debug('Adding placeholder events');
|
|
106
|
+
$module
|
|
107
|
+
.on('click' + eventNamespace, selector.placeholder, module.createAndShow)
|
|
108
|
+
.on('click' + eventNamespace, selector.icon, module.createAndShow)
|
|
109
|
+
;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
create: function() {
|
|
115
|
+
var
|
|
116
|
+
placeholder = module.get.placeholder()
|
|
117
|
+
;
|
|
118
|
+
if(placeholder) {
|
|
119
|
+
module.createPlaceholder();
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
module.createAndShow();
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
createPlaceholder: function(placeholder) {
|
|
127
|
+
var
|
|
128
|
+
icon = module.get.icon(),
|
|
129
|
+
url = module.get.url(),
|
|
130
|
+
embed = module.generate.embed(url)
|
|
131
|
+
;
|
|
132
|
+
placeholder = placeholder || module.get.placeholder();
|
|
133
|
+
$module.html( templates.placeholder(placeholder, icon) );
|
|
134
|
+
module.debug('Creating placeholder for embed', placeholder, icon);
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
createEmbed: function(url) {
|
|
138
|
+
module.refresh();
|
|
139
|
+
url = url || module.get.url();
|
|
140
|
+
$embed = $('<div/>')
|
|
141
|
+
.addClass(className.embed)
|
|
142
|
+
.html( module.generate.embed(url) )
|
|
143
|
+
.appendTo($module)
|
|
144
|
+
;
|
|
145
|
+
settings.onCreate.call(element, url);
|
|
146
|
+
module.debug('Creating embed object', $embed);
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
changeEmbed: function(url) {
|
|
150
|
+
$embed
|
|
151
|
+
.html( module.generate.embed(url) )
|
|
152
|
+
;
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
createAndShow: function() {
|
|
156
|
+
module.createEmbed();
|
|
157
|
+
module.show();
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
// sets new embed
|
|
161
|
+
change: function(source, id, url) {
|
|
162
|
+
module.debug('Changing video to ', source, id, url);
|
|
163
|
+
$module
|
|
164
|
+
.data(metadata.source, source)
|
|
165
|
+
.data(metadata.id, id)
|
|
166
|
+
;
|
|
167
|
+
if(url) {
|
|
168
|
+
$module.data(metadata.url, url);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
$module.removeData(metadata.url);
|
|
172
|
+
}
|
|
173
|
+
if(module.has.embed()) {
|
|
174
|
+
module.changeEmbed();
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
module.create();
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
// clears embed
|
|
182
|
+
reset: function() {
|
|
183
|
+
module.debug('Clearing embed and showing placeholder');
|
|
184
|
+
module.remove.data();
|
|
185
|
+
module.remove.active();
|
|
186
|
+
module.remove.embed();
|
|
187
|
+
module.showPlaceholder();
|
|
188
|
+
settings.onReset.call(element);
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
// shows current embed
|
|
192
|
+
show: function() {
|
|
193
|
+
module.debug('Showing embed');
|
|
194
|
+
module.set.active();
|
|
195
|
+
settings.onDisplay.call(element);
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
hide: function() {
|
|
199
|
+
module.debug('Hiding embed');
|
|
200
|
+
module.showPlaceholder();
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
showPlaceholder: function() {
|
|
204
|
+
module.debug('Showing placeholder image');
|
|
205
|
+
module.remove.active();
|
|
206
|
+
settings.onPlaceholderDisplay.call(element);
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
get: {
|
|
210
|
+
id: function() {
|
|
211
|
+
return settings.id || $module.data(metadata.id);
|
|
212
|
+
},
|
|
213
|
+
placeholder: function() {
|
|
214
|
+
return settings.placeholder || $module.data(metadata.placeholder);
|
|
215
|
+
},
|
|
216
|
+
icon: function() {
|
|
217
|
+
return (settings.icon)
|
|
218
|
+
? settings.icon
|
|
219
|
+
: ($module.data(metadata.icon) !== undefined)
|
|
220
|
+
? $module.data(metadata.icon)
|
|
221
|
+
: module.determine.icon()
|
|
222
|
+
;
|
|
223
|
+
},
|
|
224
|
+
source: function(url) {
|
|
225
|
+
return (settings.source)
|
|
226
|
+
? settings.source
|
|
227
|
+
: ($module.data(metadata.source) !== undefined)
|
|
228
|
+
? $module.data(metadata.source)
|
|
229
|
+
: module.determine.source()
|
|
230
|
+
;
|
|
231
|
+
},
|
|
232
|
+
type: function() {
|
|
233
|
+
var source = module.get.source();
|
|
234
|
+
return (sources[source] !== undefined)
|
|
235
|
+
? sources[source].type
|
|
236
|
+
: false
|
|
237
|
+
;
|
|
238
|
+
},
|
|
239
|
+
url: function() {
|
|
240
|
+
return (settings.url)
|
|
241
|
+
? settings.url
|
|
242
|
+
: ($module.data(metadata.url) !== undefined)
|
|
243
|
+
? $module.data(metadata.url)
|
|
244
|
+
: module.determine.url()
|
|
245
|
+
;
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
determine: {
|
|
250
|
+
autoplay: function() {
|
|
251
|
+
if(module.should.autoplay()) {
|
|
252
|
+
settings.autoplay = true;
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
source: function(url) {
|
|
256
|
+
var
|
|
257
|
+
matchedSource = false
|
|
258
|
+
;
|
|
259
|
+
url = url || module.get.url();
|
|
260
|
+
if(url) {
|
|
261
|
+
$.each(sources, function(name, source) {
|
|
262
|
+
if(url.search(source.domain) !== -1) {
|
|
263
|
+
matchedSource = name;
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
return matchedSource;
|
|
269
|
+
},
|
|
270
|
+
icon: function() {
|
|
271
|
+
var
|
|
272
|
+
source = module.get.source()
|
|
273
|
+
;
|
|
274
|
+
return (sources[source] !== undefined)
|
|
275
|
+
? sources[source].icon
|
|
276
|
+
: false
|
|
277
|
+
;
|
|
278
|
+
},
|
|
279
|
+
url: function() {
|
|
280
|
+
var
|
|
281
|
+
id = settings.id || $module.data(metadata.id),
|
|
282
|
+
source = settings.source || $module.data(metadata.source),
|
|
283
|
+
url
|
|
284
|
+
;
|
|
285
|
+
url = (sources[source] !== undefined)
|
|
286
|
+
? sources[source].url.replace('{id}', id)
|
|
287
|
+
: false
|
|
288
|
+
;
|
|
289
|
+
if(url) {
|
|
290
|
+
$module.data(metadata.url, url);
|
|
291
|
+
}
|
|
292
|
+
return url;
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
set: {
|
|
298
|
+
active: function() {
|
|
299
|
+
$module.addClass(className.active);
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
remove: {
|
|
304
|
+
data: function() {
|
|
305
|
+
$module
|
|
306
|
+
.removeData(metadata.id)
|
|
307
|
+
.removeData(metadata.icon)
|
|
308
|
+
.removeData(metadata.placeholder)
|
|
309
|
+
.removeData(metadata.source)
|
|
310
|
+
.removeData(metadata.url)
|
|
311
|
+
;
|
|
312
|
+
},
|
|
313
|
+
active: function() {
|
|
314
|
+
$module.removeClass(className.active);
|
|
315
|
+
},
|
|
316
|
+
embed: function() {
|
|
317
|
+
$embed.empty();
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
encode: {
|
|
322
|
+
parameters: function(parameters) {
|
|
323
|
+
var
|
|
324
|
+
urlString = [],
|
|
325
|
+
index
|
|
326
|
+
;
|
|
327
|
+
for (index in parameters) {
|
|
328
|
+
urlString.push( encodeURIComponent(index) + '=' + encodeURIComponent( parameters[index] ) );
|
|
329
|
+
}
|
|
330
|
+
return urlString.join('&');
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
generate: {
|
|
335
|
+
embed: function(url) {
|
|
336
|
+
module.debug('Generating embed html');
|
|
337
|
+
var
|
|
338
|
+
source = module.get.source(),
|
|
339
|
+
html,
|
|
340
|
+
parameters
|
|
341
|
+
;
|
|
342
|
+
url = module.get.url(url);
|
|
343
|
+
if(url) {
|
|
344
|
+
parameters = module.generate.parameters(source);
|
|
345
|
+
html = templates.iframe(url, parameters);
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
module.error(error.noURL, $module);
|
|
349
|
+
}
|
|
350
|
+
return html;
|
|
351
|
+
},
|
|
352
|
+
parameters: function(source, extraParameters) {
|
|
353
|
+
var
|
|
354
|
+
parameters = (sources[source] && sources[source].parameters !== undefined)
|
|
355
|
+
? sources[source].parameters(settings)
|
|
356
|
+
: {}
|
|
357
|
+
;
|
|
358
|
+
extraParameters = extraParameters || settings.parameters;
|
|
359
|
+
if(extraParameters) {
|
|
360
|
+
parameters = $.extend({}, parameters, extraParameters);
|
|
361
|
+
}
|
|
362
|
+
parameters = settings.onEmbed(parameters);
|
|
363
|
+
return module.encode.parameters(parameters);
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
has: {
|
|
368
|
+
embed: function() {
|
|
369
|
+
return ($embed.length > 0);
|
|
370
|
+
},
|
|
371
|
+
placeholder: function() {
|
|
372
|
+
return settings.placeholder || $module.data(metadata.placeholder);
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
should: {
|
|
377
|
+
autoplay: function() {
|
|
378
|
+
return (settings.autoplay === 'auto')
|
|
379
|
+
? (settings.placeholder || $module.data(metadata.placeholder) !== undefined)
|
|
380
|
+
: settings.autoplay
|
|
381
|
+
;
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
|
|
385
|
+
is: {
|
|
386
|
+
video: function() {
|
|
387
|
+
return module.get.type() == 'video';
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
setting: function(name, value) {
|
|
392
|
+
module.debug('Changing setting', name, value);
|
|
393
|
+
if( $.isPlainObject(name) ) {
|
|
394
|
+
$.extend(true, settings, name);
|
|
395
|
+
}
|
|
396
|
+
else if(value !== undefined) {
|
|
397
|
+
if($.isPlainObject(settings[name])) {
|
|
398
|
+
$.extend(true, settings[name], value);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
settings[name] = value;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
return settings[name];
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
internal: function(name, value) {
|
|
409
|
+
if( $.isPlainObject(name) ) {
|
|
410
|
+
$.extend(true, module, name);
|
|
411
|
+
}
|
|
412
|
+
else if(value !== undefined) {
|
|
413
|
+
module[name] = value;
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
return module[name];
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
debug: function() {
|
|
420
|
+
if(!settings.silent && settings.debug) {
|
|
421
|
+
if(settings.performance) {
|
|
422
|
+
module.performance.log(arguments);
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
426
|
+
module.debug.apply(console, arguments);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
verbose: function() {
|
|
431
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
|
432
|
+
if(settings.performance) {
|
|
433
|
+
module.performance.log(arguments);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
437
|
+
module.verbose.apply(console, arguments);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
error: function() {
|
|
442
|
+
if(!settings.silent) {
|
|
443
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
|
444
|
+
module.error.apply(console, arguments);
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
performance: {
|
|
448
|
+
log: function(message) {
|
|
449
|
+
var
|
|
450
|
+
currentTime,
|
|
451
|
+
executionTime,
|
|
452
|
+
previousTime
|
|
453
|
+
;
|
|
454
|
+
if(settings.performance) {
|
|
455
|
+
currentTime = new Date().getTime();
|
|
456
|
+
previousTime = time || currentTime;
|
|
457
|
+
executionTime = currentTime - previousTime;
|
|
458
|
+
time = currentTime;
|
|
459
|
+
performance.push({
|
|
460
|
+
'Name' : message[0],
|
|
461
|
+
'Arguments' : [].slice.call(message, 1) || '',
|
|
462
|
+
'Element' : element,
|
|
463
|
+
'Execution Time' : executionTime
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
clearTimeout(module.performance.timer);
|
|
467
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
|
468
|
+
},
|
|
469
|
+
display: function() {
|
|
470
|
+
var
|
|
471
|
+
title = settings.name + ':',
|
|
472
|
+
totalTime = 0
|
|
473
|
+
;
|
|
474
|
+
time = false;
|
|
475
|
+
clearTimeout(module.performance.timer);
|
|
476
|
+
$.each(performance, function(index, data) {
|
|
477
|
+
totalTime += data['Execution Time'];
|
|
478
|
+
});
|
|
479
|
+
title += ' ' + totalTime + 'ms';
|
|
480
|
+
if(moduleSelector) {
|
|
481
|
+
title += ' \'' + moduleSelector + '\'';
|
|
482
|
+
}
|
|
483
|
+
if($allModules.length > 1) {
|
|
484
|
+
title += ' ' + '(' + $allModules.length + ')';
|
|
485
|
+
}
|
|
486
|
+
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
|
487
|
+
console.groupCollapsed(title);
|
|
488
|
+
if(console.table) {
|
|
489
|
+
console.table(performance);
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
$.each(performance, function(index, data) {
|
|
493
|
+
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
console.groupEnd();
|
|
497
|
+
}
|
|
498
|
+
performance = [];
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
invoke: function(query, passedArguments, context) {
|
|
502
|
+
var
|
|
503
|
+
object = instance,
|
|
504
|
+
maxDepth,
|
|
505
|
+
found,
|
|
506
|
+
response
|
|
507
|
+
;
|
|
508
|
+
passedArguments = passedArguments || queryArguments;
|
|
509
|
+
context = element || context;
|
|
510
|
+
if(typeof query == 'string' && object !== undefined) {
|
|
511
|
+
query = query.split(/[\. ]/);
|
|
512
|
+
maxDepth = query.length - 1;
|
|
513
|
+
$.each(query, function(depth, value) {
|
|
514
|
+
var camelCaseValue = (depth != maxDepth)
|
|
515
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
516
|
+
: query
|
|
517
|
+
;
|
|
518
|
+
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
|
519
|
+
object = object[camelCaseValue];
|
|
520
|
+
}
|
|
521
|
+
else if( object[camelCaseValue] !== undefined ) {
|
|
522
|
+
found = object[camelCaseValue];
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
|
526
|
+
object = object[value];
|
|
527
|
+
}
|
|
528
|
+
else if( object[value] !== undefined ) {
|
|
529
|
+
found = object[value];
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
module.error(error.method, query);
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
if ( $.isFunction( found ) ) {
|
|
539
|
+
response = found.apply(context, passedArguments);
|
|
540
|
+
}
|
|
541
|
+
else if(found !== undefined) {
|
|
542
|
+
response = found;
|
|
543
|
+
}
|
|
544
|
+
if($.isArray(returnedValue)) {
|
|
545
|
+
returnedValue.push(response);
|
|
546
|
+
}
|
|
547
|
+
else if(returnedValue !== undefined) {
|
|
548
|
+
returnedValue = [returnedValue, response];
|
|
549
|
+
}
|
|
550
|
+
else if(response !== undefined) {
|
|
551
|
+
returnedValue = response;
|
|
552
|
+
}
|
|
553
|
+
return found;
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
if(methodInvoked) {
|
|
558
|
+
if(instance === undefined) {
|
|
559
|
+
module.initialize();
|
|
560
|
+
}
|
|
561
|
+
module.invoke(query);
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
if(instance !== undefined) {
|
|
565
|
+
instance.invoke('destroy');
|
|
566
|
+
}
|
|
567
|
+
module.initialize();
|
|
568
|
+
}
|
|
569
|
+
})
|
|
570
|
+
;
|
|
571
|
+
return (returnedValue !== undefined)
|
|
572
|
+
? returnedValue
|
|
573
|
+
: this
|
|
574
|
+
;
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
$.fn.embed.settings = {
|
|
578
|
+
|
|
579
|
+
name : 'Embed',
|
|
580
|
+
namespace : 'embed',
|
|
581
|
+
|
|
582
|
+
silent : false,
|
|
583
|
+
debug : false,
|
|
584
|
+
verbose : false,
|
|
585
|
+
performance : true,
|
|
586
|
+
|
|
587
|
+
icon : false,
|
|
588
|
+
source : false,
|
|
589
|
+
url : false,
|
|
590
|
+
id : false,
|
|
591
|
+
|
|
592
|
+
// standard video settings
|
|
593
|
+
autoplay : 'auto',
|
|
594
|
+
color : '#444444',
|
|
595
|
+
hd : true,
|
|
596
|
+
brandedUI : false,
|
|
597
|
+
|
|
598
|
+
// additional parameters to include with the embed
|
|
599
|
+
parameters: false,
|
|
600
|
+
|
|
601
|
+
onDisplay : function() {},
|
|
602
|
+
onPlaceholderDisplay : function() {},
|
|
603
|
+
onReset : function() {},
|
|
604
|
+
onCreate : function(url) {},
|
|
605
|
+
onEmbed : function(parameters) {
|
|
606
|
+
return parameters;
|
|
607
|
+
},
|
|
608
|
+
|
|
609
|
+
metadata : {
|
|
610
|
+
id : 'id',
|
|
611
|
+
icon : 'icon',
|
|
612
|
+
placeholder : 'placeholder',
|
|
613
|
+
source : 'source',
|
|
614
|
+
url : 'url'
|
|
615
|
+
},
|
|
616
|
+
|
|
617
|
+
error : {
|
|
618
|
+
noURL : 'No URL specified',
|
|
619
|
+
method : 'The method you called is not defined'
|
|
620
|
+
},
|
|
621
|
+
|
|
622
|
+
className : {
|
|
623
|
+
active : 'active',
|
|
624
|
+
embed : 'embed'
|
|
625
|
+
},
|
|
626
|
+
|
|
627
|
+
selector : {
|
|
628
|
+
embed : '.embed',
|
|
629
|
+
placeholder : '.placeholder',
|
|
630
|
+
icon : '.icon'
|
|
631
|
+
},
|
|
632
|
+
|
|
633
|
+
sources: {
|
|
634
|
+
youtube: {
|
|
635
|
+
name : 'youtube',
|
|
636
|
+
type : 'video',
|
|
637
|
+
icon : 'video play',
|
|
638
|
+
domain : 'youtube.com',
|
|
639
|
+
url : '//www.youtube.com/embed/{id}',
|
|
640
|
+
parameters: function(settings) {
|
|
641
|
+
return {
|
|
642
|
+
autohide : !settings.brandedUI,
|
|
643
|
+
autoplay : settings.autoplay,
|
|
644
|
+
color : settings.color || undefined,
|
|
645
|
+
hq : settings.hd,
|
|
646
|
+
jsapi : settings.api,
|
|
647
|
+
modestbranding : !settings.brandedUI
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
vimeo: {
|
|
652
|
+
name : 'vimeo',
|
|
653
|
+
type : 'video',
|
|
654
|
+
icon : 'video play',
|
|
655
|
+
domain : 'vimeo.com',
|
|
656
|
+
url : '//player.vimeo.com/video/{id}',
|
|
657
|
+
parameters: function(settings) {
|
|
658
|
+
return {
|
|
659
|
+
api : settings.api,
|
|
660
|
+
autoplay : settings.autoplay,
|
|
661
|
+
byline : settings.brandedUI,
|
|
662
|
+
color : settings.color || undefined,
|
|
663
|
+
portrait : settings.brandedUI,
|
|
664
|
+
title : settings.brandedUI
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
|
|
670
|
+
templates: {
|
|
671
|
+
iframe : function(url, parameters) {
|
|
672
|
+
var src = url;
|
|
673
|
+
if (parameters) {
|
|
674
|
+
src += '?' + parameters;
|
|
675
|
+
}
|
|
676
|
+
return ''
|
|
677
|
+
+ '<iframe src="' + src + '"'
|
|
678
|
+
+ ' width="100%" height="100%"'
|
|
679
|
+
+ ' frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
|
|
680
|
+
;
|
|
681
|
+
},
|
|
682
|
+
placeholder : function(image, icon) {
|
|
683
|
+
var
|
|
684
|
+
html = ''
|
|
685
|
+
;
|
|
686
|
+
if(icon) {
|
|
687
|
+
html += '<i class="' + icon + ' icon"></i>';
|
|
688
|
+
}
|
|
689
|
+
if(image) {
|
|
690
|
+
html += '<img class="placeholder" src="' + image + '">';
|
|
691
|
+
}
|
|
692
|
+
return html;
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
|
|
696
|
+
// NOT YET IMPLEMENTED
|
|
697
|
+
api : false,
|
|
698
|
+
onPause : function() {},
|
|
699
|
+
onPlay : function() {},
|
|
700
|
+
onStop : function() {}
|
|
701
|
+
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
})( jQuery, window, document );
|