fomantic-ui-sass 2.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +27 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +370 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +177 -0
- data/Rakefile +8 -0
- data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.svg +1008 -0
- data/app/assets/fonts/semantic-ui/brand-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/icons.otf +0 -0
- data/app/assets/fonts/semantic-ui/icons.svg +1518 -0
- data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.svg +366 -0
- data/app/assets/fonts/semantic-ui/outline-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
- data/app/assets/images/semantic-ui/flags.png +0 -0
- data/app/assets/javascripts/semantic-ui.js +27 -0
- data/app/assets/javascripts/semantic-ui/accordion.js +613 -0
- data/app/assets/javascripts/semantic-ui/api.js +1167 -0
- data/app/assets/javascripts/semantic-ui/calendar.js +1476 -0
- data/app/assets/javascripts/semantic-ui/checkbox.js +828 -0
- data/app/assets/javascripts/semantic-ui/colorize.js +280 -0
- data/app/assets/javascripts/semantic-ui/dimmer.js +735 -0
- data/app/assets/javascripts/semantic-ui/dropdown.js +4030 -0
- data/app/assets/javascripts/semantic-ui/embed.js +706 -0
- data/app/assets/javascripts/semantic-ui/form.js +1707 -0
- data/app/assets/javascripts/semantic-ui/modal.js +1090 -0
- data/app/assets/javascripts/semantic-ui/nag.js +507 -0
- data/app/assets/javascripts/semantic-ui/popup.js +1532 -0
- data/app/assets/javascripts/semantic-ui/progress.js +923 -0
- data/app/assets/javascripts/semantic-ui/range.js +278 -0
- data/app/assets/javascripts/semantic-ui/rating.js +511 -0
- data/app/assets/javascripts/semantic-ui/search.js +1515 -0
- data/app/assets/javascripts/semantic-ui/shape.js +921 -0
- data/app/assets/javascripts/semantic-ui/sidebar.js +1033 -0
- data/app/assets/javascripts/semantic-ui/site.js +490 -0
- data/app/assets/javascripts/semantic-ui/state.js +708 -0
- data/app/assets/javascripts/semantic-ui/sticky.js +959 -0
- data/app/assets/javascripts/semantic-ui/tab.js +952 -0
- data/app/assets/javascripts/semantic-ui/toast.js +592 -0
- data/app/assets/javascripts/semantic-ui/transition.js +1106 -0
- data/app/assets/javascripts/semantic-ui/video.js +532 -0
- data/app/assets/javascripts/semantic-ui/visibility.js +1311 -0
- data/app/assets/javascripts/semantic-ui/visit.js +525 -0
- data/app/assets/stylesheets/semantic-ui.scss +5 -0
- data/app/assets/stylesheets/semantic-ui/collections/_all.scss +6 -0
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +124 -0
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +1158 -0
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +2093 -0
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +2193 -0
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +606 -0
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +1117 -0
- data/app/assets/stylesheets/semantic-ui/elements/_all.scss +16 -0
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +4530 -0
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +145 -0
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +259 -0
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1036 -0
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +762 -0
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +6330 -0
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +310 -0
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +519 -0
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +1395 -0
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +959 -0
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +458 -0
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +242 -0
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +152 -0
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +295 -0
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +884 -0
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +675 -0
- data/app/assets/stylesheets/semantic-ui/globals/_all.scss +3 -0
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +485 -0
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +206 -0
- data/app/assets/stylesheets/semantic-ui/globals/_variables.scss +4 -0
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +247 -0
- data/app/assets/stylesheets/semantic-ui/modules/_all.scss +20 -0
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +165 -0
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +718 -0
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +464 -0
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +1745 -0
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +165 -0
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +646 -0
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +148 -0
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +789 -0
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +523 -0
- data/app/assets/stylesheets/semantic-ui/modules/_range.scss +192 -0
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +263 -0
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +445 -0
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +154 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +626 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +78 -0
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +92 -0
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +291 -0
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +2059 -0
- data/app/assets/stylesheets/semantic-ui/modules/_video.scss +125 -0
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +275 -0
- data/app/assets/stylesheets/semantic-ui/views/_all.scss +6 -0
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +1124 -0
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +296 -0
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +314 -0
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +555 -0
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +583 -0
- data/app/helpers/semantic_breadcrumbs_helper.rb +10 -0
- data/app/helpers/semantic_flash_helper.rb +22 -0
- data/app/helpers/semantic_icon_helper.rb +8 -0
- data/app/views/semantic/_breadcrumbs.html.erb +12 -0
- data/fomantic-ui-sass.gemspec +31 -0
- data/lib/fomantic-ui-sass.rb +62 -0
- data/lib/fomantic/ui/sass/breadcrumbs.rb +41 -0
- data/lib/fomantic/ui/sass/engine.rb +23 -0
- data/lib/fomantic/ui/sass/version.rb +8 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/semantic_breadcrumbs_helper_spec.rb +38 -0
- data/spec/helpers/semantic_flash_helper_spec.rb +36 -0
- data/spec/helpers/semantic_icon_helper_spec.rb +48 -0
- data/spec/spec_helper.rb +17 -0
- data/tasks/converter.rb +216 -0
- data/templates/project/manifest.rb +29 -0
- data/templates/project/styles.scss +1 -0
- metadata +390 -0
@@ -0,0 +1,532 @@
|
|
1
|
+
/*!
|
2
|
+
* # Semantic UI 2.0.0 - Video
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
|
+
*
|
5
|
+
*
|
6
|
+
* Copyright 2014 Contributorss
|
7
|
+
* Released under the MIT license
|
8
|
+
* http://opensource.org/licenses/MIT
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
|
12
|
+
;(function ($, window, document, undefined) {
|
13
|
+
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
$.fn.video = function(parameters) {
|
17
|
+
|
18
|
+
var
|
19
|
+
$allModules = $(this),
|
20
|
+
|
21
|
+
moduleSelector = $allModules.selector || '',
|
22
|
+
|
23
|
+
time = new Date().getTime(),
|
24
|
+
performance = [],
|
25
|
+
|
26
|
+
query = arguments[0],
|
27
|
+
methodInvoked = (typeof query == 'string'),
|
28
|
+
queryArguments = [].slice.call(arguments, 1),
|
29
|
+
|
30
|
+
requestAnimationFrame = window.requestAnimationFrame
|
31
|
+
|| window.mozRequestAnimationFrame
|
32
|
+
|| window.webkitRequestAnimationFrame
|
33
|
+
|| window.msRequestAnimationFrame
|
34
|
+
|| function(callback) { setTimeout(callback, 0); },
|
35
|
+
|
36
|
+
returnedValue
|
37
|
+
;
|
38
|
+
|
39
|
+
$allModules
|
40
|
+
.each(function() {
|
41
|
+
var
|
42
|
+
settings = ( $.isPlainObject(parameters) )
|
43
|
+
? $.extend(true, {}, $.fn.video.settings, parameters)
|
44
|
+
: $.extend({}, $.fn.video.settings),
|
45
|
+
|
46
|
+
selector = settings.selector,
|
47
|
+
className = settings.className,
|
48
|
+
error = settings.error,
|
49
|
+
metadata = settings.metadata,
|
50
|
+
namespace = settings.namespace,
|
51
|
+
templates = settings.templates,
|
52
|
+
|
53
|
+
eventNamespace = '.' + namespace,
|
54
|
+
moduleNamespace = 'module-' + namespace,
|
55
|
+
|
56
|
+
$window = $(window),
|
57
|
+
$module = $(this),
|
58
|
+
$placeholder = $module.find(selector.placeholder),
|
59
|
+
$playButton = $module.find(selector.playButton),
|
60
|
+
$embed = $module.find(selector.embed),
|
61
|
+
|
62
|
+
element = this,
|
63
|
+
instance = $module.data(moduleNamespace),
|
64
|
+
module
|
65
|
+
;
|
66
|
+
|
67
|
+
module = {
|
68
|
+
|
69
|
+
initialize: function() {
|
70
|
+
module.debug('Initializing video');
|
71
|
+
module.create();
|
72
|
+
$module
|
73
|
+
.on('click' + eventNamespace, selector.placeholder, module.play)
|
74
|
+
.on('click' + eventNamespace, selector.playButton, module.play)
|
75
|
+
;
|
76
|
+
module.instantiate();
|
77
|
+
},
|
78
|
+
|
79
|
+
instantiate: function() {
|
80
|
+
module.verbose('Storing instance of module', module);
|
81
|
+
instance = module;
|
82
|
+
$module
|
83
|
+
.data(moduleNamespace, module)
|
84
|
+
;
|
85
|
+
},
|
86
|
+
|
87
|
+
create: function() {
|
88
|
+
var
|
89
|
+
image = $module.data(metadata.image),
|
90
|
+
html = templates.video(image)
|
91
|
+
;
|
92
|
+
$module.html(html);
|
93
|
+
module.refresh();
|
94
|
+
if(!image) {
|
95
|
+
module.play();
|
96
|
+
}
|
97
|
+
module.debug('Creating html for video element', html);
|
98
|
+
},
|
99
|
+
|
100
|
+
destroy: function() {
|
101
|
+
module.verbose('Destroying previous instance of video');
|
102
|
+
module.reset();
|
103
|
+
$module
|
104
|
+
.removeData(moduleNamespace)
|
105
|
+
.off(eventNamespace)
|
106
|
+
;
|
107
|
+
},
|
108
|
+
|
109
|
+
refresh: function() {
|
110
|
+
module.verbose('Refreshing selector cache');
|
111
|
+
$placeholder = $module.find(selector.placeholder);
|
112
|
+
$playButton = $module.find(selector.playButton);
|
113
|
+
$embed = $module.find(selector.embed);
|
114
|
+
},
|
115
|
+
|
116
|
+
// sets new video
|
117
|
+
change: function(source, id, url) {
|
118
|
+
module.debug('Changing video to ', source, id, url);
|
119
|
+
$module
|
120
|
+
.data(metadata.source, source)
|
121
|
+
.data(metadata.id, id)
|
122
|
+
.data(metadata.url, url)
|
123
|
+
;
|
124
|
+
settings.onChange();
|
125
|
+
},
|
126
|
+
|
127
|
+
// clears video embed
|
128
|
+
reset: function() {
|
129
|
+
module.debug('Clearing video embed and showing placeholder');
|
130
|
+
$module
|
131
|
+
.removeClass(className.active)
|
132
|
+
;
|
133
|
+
$embed
|
134
|
+
.html(' ')
|
135
|
+
;
|
136
|
+
$placeholder
|
137
|
+
.show()
|
138
|
+
;
|
139
|
+
settings.onReset();
|
140
|
+
},
|
141
|
+
|
142
|
+
// plays current video
|
143
|
+
play: function() {
|
144
|
+
module.debug('Playing video');
|
145
|
+
var
|
146
|
+
source = $module.data(metadata.source) || false,
|
147
|
+
url = $module.data(metadata.url) || false,
|
148
|
+
id = $module.data(metadata.id) || false
|
149
|
+
;
|
150
|
+
$embed
|
151
|
+
.html( module.generate.html(source, id, url) )
|
152
|
+
;
|
153
|
+
$module
|
154
|
+
.addClass(className.active)
|
155
|
+
;
|
156
|
+
settings.onPlay();
|
157
|
+
},
|
158
|
+
|
159
|
+
get: {
|
160
|
+
source: function(url) {
|
161
|
+
if(typeof url !== 'string') {
|
162
|
+
return false;
|
163
|
+
}
|
164
|
+
if(url.search('youtube.com') !== -1) {
|
165
|
+
return 'youtube';
|
166
|
+
}
|
167
|
+
else if(url.search('vimeo.com') !== -1) {
|
168
|
+
return 'vimeo';
|
169
|
+
}
|
170
|
+
return false;
|
171
|
+
},
|
172
|
+
id: function(url) {
|
173
|
+
if(url.match(settings.regExp.youtube)) {
|
174
|
+
return url.match(settings.regExp.youtube)[1];
|
175
|
+
}
|
176
|
+
else if(url.match(settings.regExp.vimeo)) {
|
177
|
+
return url.match(settings.regExp.vimeo)[2];
|
178
|
+
}
|
179
|
+
return false;
|
180
|
+
}
|
181
|
+
},
|
182
|
+
|
183
|
+
generate: {
|
184
|
+
// generates iframe html
|
185
|
+
html: function(source, id, url) {
|
186
|
+
module.debug('Generating embed html');
|
187
|
+
var
|
188
|
+
html
|
189
|
+
;
|
190
|
+
// allow override of settings
|
191
|
+
source = source || settings.source;
|
192
|
+
id = id || settings.id;
|
193
|
+
if((source && id) || url) {
|
194
|
+
if(!source || !id) {
|
195
|
+
source = module.get.source(url);
|
196
|
+
id = module.get.id(url);
|
197
|
+
}
|
198
|
+
if(source == 'vimeo') {
|
199
|
+
html = ''
|
200
|
+
+ '<iframe src="//player.vimeo.com/video/' + id + '?=' + module.generate.url(source) + '"'
|
201
|
+
+ ' width="100%" height="100%"'
|
202
|
+
+ ' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
|
203
|
+
;
|
204
|
+
}
|
205
|
+
else if(source == 'youtube') {
|
206
|
+
html = ''
|
207
|
+
+ '<iframe src="//www.youtube.com/embed/' + id + '?=' + module.generate.url(source) + '"'
|
208
|
+
+ ' width="100%" height="100%"'
|
209
|
+
+ ' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
|
210
|
+
;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
else {
|
214
|
+
module.error(error.noVideo);
|
215
|
+
}
|
216
|
+
return html;
|
217
|
+
},
|
218
|
+
|
219
|
+
// generate url parameters
|
220
|
+
url: function(source) {
|
221
|
+
var
|
222
|
+
api = (settings.api)
|
223
|
+
? 1
|
224
|
+
: 0,
|
225
|
+
autoplay = (settings.autoplay === 'auto')
|
226
|
+
? ($module.data('image') !== undefined)
|
227
|
+
: settings.autoplay,
|
228
|
+
hd = (settings.hd)
|
229
|
+
? 1
|
230
|
+
: 0,
|
231
|
+
showUI = (settings.showUI)
|
232
|
+
? 1
|
233
|
+
: 0,
|
234
|
+
// opposite used for some params
|
235
|
+
hideUI = !(settings.showUI)
|
236
|
+
? 1
|
237
|
+
: 0,
|
238
|
+
url = ''
|
239
|
+
;
|
240
|
+
if(source == 'vimeo') {
|
241
|
+
url = ''
|
242
|
+
+ 'api=' + api
|
243
|
+
+ '&title=' + showUI
|
244
|
+
+ '&byline=' + showUI
|
245
|
+
+ '&portrait=' + showUI
|
246
|
+
+ '&autoplay=' + autoplay
|
247
|
+
;
|
248
|
+
if(settings.color) {
|
249
|
+
url += '&color=' + settings.color;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
if(source == 'ustream') {
|
253
|
+
url = ''
|
254
|
+
+ 'autoplay=' + autoplay
|
255
|
+
;
|
256
|
+
if(settings.color) {
|
257
|
+
url += '&color=' + settings.color;
|
258
|
+
}
|
259
|
+
}
|
260
|
+
else if(source == 'youtube') {
|
261
|
+
url = ''
|
262
|
+
+ 'enablejsapi=' + api
|
263
|
+
+ '&autoplay=' + autoplay
|
264
|
+
+ '&autohide=' + hideUI
|
265
|
+
+ '&hq=' + hd
|
266
|
+
+ '&modestbranding=1'
|
267
|
+
;
|
268
|
+
if(settings.color) {
|
269
|
+
url += '&color=' + settings.color;
|
270
|
+
}
|
271
|
+
}
|
272
|
+
return url;
|
273
|
+
}
|
274
|
+
},
|
275
|
+
|
276
|
+
setting: function(name, value) {
|
277
|
+
module.debug('Changing setting', name, value);
|
278
|
+
if( $.isPlainObject(name) ) {
|
279
|
+
$.extend(true, settings, name);
|
280
|
+
}
|
281
|
+
else if(value !== undefined) {
|
282
|
+
settings[name] = value;
|
283
|
+
}
|
284
|
+
else {
|
285
|
+
return settings[name];
|
286
|
+
}
|
287
|
+
},
|
288
|
+
internal: function(name, value) {
|
289
|
+
if( $.isPlainObject(name) ) {
|
290
|
+
$.extend(true, module, name);
|
291
|
+
}
|
292
|
+
else if(value !== undefined) {
|
293
|
+
module[name] = value;
|
294
|
+
}
|
295
|
+
else {
|
296
|
+
return module[name];
|
297
|
+
}
|
298
|
+
},
|
299
|
+
debug: function() {
|
300
|
+
if(settings.debug) {
|
301
|
+
if(settings.performance) {
|
302
|
+
module.performance.log(arguments);
|
303
|
+
}
|
304
|
+
else {
|
305
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
306
|
+
module.debug.apply(console, arguments);
|
307
|
+
}
|
308
|
+
}
|
309
|
+
},
|
310
|
+
verbose: function() {
|
311
|
+
if(settings.verbose && settings.debug) {
|
312
|
+
if(settings.performance) {
|
313
|
+
module.performance.log(arguments);
|
314
|
+
}
|
315
|
+
else {
|
316
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
317
|
+
module.verbose.apply(console, arguments);
|
318
|
+
}
|
319
|
+
}
|
320
|
+
},
|
321
|
+
error: function() {
|
322
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
323
|
+
module.error.apply(console, arguments);
|
324
|
+
},
|
325
|
+
performance: {
|
326
|
+
log: function(message) {
|
327
|
+
var
|
328
|
+
currentTime,
|
329
|
+
executionTime,
|
330
|
+
previousTime
|
331
|
+
;
|
332
|
+
if(settings.performance) {
|
333
|
+
currentTime = new Date().getTime();
|
334
|
+
previousTime = time || currentTime;
|
335
|
+
executionTime = currentTime - previousTime;
|
336
|
+
time = currentTime;
|
337
|
+
performance.push({
|
338
|
+
'Name' : message[0],
|
339
|
+
'Arguments' : [].slice.call(message, 1) || '',
|
340
|
+
'Element' : element,
|
341
|
+
'Execution Time' : executionTime
|
342
|
+
});
|
343
|
+
}
|
344
|
+
clearTimeout(module.performance.timer);
|
345
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
346
|
+
},
|
347
|
+
display: function() {
|
348
|
+
var
|
349
|
+
title = settings.name + ':',
|
350
|
+
totalTime = 0
|
351
|
+
;
|
352
|
+
time = false;
|
353
|
+
clearTimeout(module.performance.timer);
|
354
|
+
$.each(performance, function(index, data) {
|
355
|
+
totalTime += data['Execution Time'];
|
356
|
+
});
|
357
|
+
title += ' ' + totalTime + 'ms';
|
358
|
+
if(moduleSelector) {
|
359
|
+
title += ' \'' + moduleSelector + '\'';
|
360
|
+
}
|
361
|
+
if($allModules.length > 1) {
|
362
|
+
title += ' ' + '(' + $allModules.length + ')';
|
363
|
+
}
|
364
|
+
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
365
|
+
console.groupCollapsed(title);
|
366
|
+
if(console.table) {
|
367
|
+
console.table(performance);
|
368
|
+
}
|
369
|
+
else {
|
370
|
+
$.each(performance, function(index, data) {
|
371
|
+
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
372
|
+
});
|
373
|
+
}
|
374
|
+
console.groupEnd();
|
375
|
+
}
|
376
|
+
performance = [];
|
377
|
+
}
|
378
|
+
},
|
379
|
+
invoke: function(query, passedArguments, context) {
|
380
|
+
var
|
381
|
+
object = instance,
|
382
|
+
maxDepth,
|
383
|
+
found,
|
384
|
+
response
|
385
|
+
;
|
386
|
+
passedArguments = passedArguments || queryArguments;
|
387
|
+
context = element || context;
|
388
|
+
if(typeof query == 'string' && object !== undefined) {
|
389
|
+
query = query.split(/[\. ]/);
|
390
|
+
maxDepth = query.length - 1;
|
391
|
+
$.each(query, function(depth, value) {
|
392
|
+
var camelCaseValue = (depth != maxDepth)
|
393
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
394
|
+
: query
|
395
|
+
;
|
396
|
+
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
397
|
+
object = object[camelCaseValue];
|
398
|
+
}
|
399
|
+
else if( object[camelCaseValue] !== undefined ) {
|
400
|
+
found = object[camelCaseValue];
|
401
|
+
return false;
|
402
|
+
}
|
403
|
+
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
404
|
+
object = object[value];
|
405
|
+
}
|
406
|
+
else if( object[value] !== undefined ) {
|
407
|
+
found = object[value];
|
408
|
+
return false;
|
409
|
+
}
|
410
|
+
else {
|
411
|
+
module.error(error.method, query);
|
412
|
+
return false;
|
413
|
+
}
|
414
|
+
});
|
415
|
+
}
|
416
|
+
if ( $.isFunction( found ) ) {
|
417
|
+
response = found.apply(context, passedArguments);
|
418
|
+
}
|
419
|
+
else if(found !== undefined) {
|
420
|
+
response = found;
|
421
|
+
}
|
422
|
+
if($.isArray(returnedValue)) {
|
423
|
+
returnedValue.push(response);
|
424
|
+
}
|
425
|
+
else if(returnedValue !== undefined) {
|
426
|
+
returnedValue = [returnedValue, response];
|
427
|
+
}
|
428
|
+
else if(response !== undefined) {
|
429
|
+
returnedValue = response;
|
430
|
+
}
|
431
|
+
return found;
|
432
|
+
}
|
433
|
+
};
|
434
|
+
|
435
|
+
if(methodInvoked) {
|
436
|
+
if(instance === undefined) {
|
437
|
+
module.initialize();
|
438
|
+
}
|
439
|
+
module.invoke(query);
|
440
|
+
}
|
441
|
+
else {
|
442
|
+
if(instance !== undefined) {
|
443
|
+
instance.invoke('destroy');
|
444
|
+
}
|
445
|
+
module.initialize();
|
446
|
+
}
|
447
|
+
})
|
448
|
+
;
|
449
|
+
return (returnedValue !== undefined)
|
450
|
+
? returnedValue
|
451
|
+
: this
|
452
|
+
;
|
453
|
+
};
|
454
|
+
|
455
|
+
$.fn.video.settings = {
|
456
|
+
|
457
|
+
name : 'Video',
|
458
|
+
namespace : 'video',
|
459
|
+
|
460
|
+
debug : false,
|
461
|
+
verbose : false,
|
462
|
+
performance : true,
|
463
|
+
|
464
|
+
metadata : {
|
465
|
+
id : 'id',
|
466
|
+
image : 'image',
|
467
|
+
source : 'source',
|
468
|
+
url : 'url'
|
469
|
+
},
|
470
|
+
|
471
|
+
source : false,
|
472
|
+
url : false,
|
473
|
+
id : false,
|
474
|
+
|
475
|
+
aspectRatio : (16/9),
|
476
|
+
|
477
|
+
onPlay : function(){},
|
478
|
+
onReset : function(){},
|
479
|
+
onChange : function(){},
|
480
|
+
|
481
|
+
// callbacks not coded yet (needs to use jsapi)
|
482
|
+
onPause : function() {},
|
483
|
+
onStop : function() {},
|
484
|
+
|
485
|
+
width : 'auto',
|
486
|
+
height : 'auto',
|
487
|
+
|
488
|
+
autoplay : 'auto',
|
489
|
+
color : '#442359',
|
490
|
+
hd : true,
|
491
|
+
showUI : false,
|
492
|
+
api : true,
|
493
|
+
|
494
|
+
regExp : {
|
495
|
+
youtube : /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,
|
496
|
+
vimeo : /http:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/
|
497
|
+
},
|
498
|
+
|
499
|
+
error : {
|
500
|
+
noVideo : 'No video specified',
|
501
|
+
method : 'The method you called is not defined'
|
502
|
+
},
|
503
|
+
|
504
|
+
className : {
|
505
|
+
active : 'active'
|
506
|
+
},
|
507
|
+
|
508
|
+
selector : {
|
509
|
+
embed : '.embed',
|
510
|
+
placeholder : '.placeholder',
|
511
|
+
playButton : '.play'
|
512
|
+
}
|
513
|
+
};
|
514
|
+
|
515
|
+
$.fn.video.settings.templates = {
|
516
|
+
video: function(image) {
|
517
|
+
var
|
518
|
+
html = ''
|
519
|
+
;
|
520
|
+
if(image) {
|
521
|
+
html += ''
|
522
|
+
+ '<i class="video play icon"></i>'
|
523
|
+
+ '<img class="placeholder" src="' + image + '">'
|
524
|
+
;
|
525
|
+
}
|
526
|
+
html += '<div class="embed"></div>';
|
527
|
+
return html;
|
528
|
+
}
|
529
|
+
};
|
530
|
+
|
531
|
+
|
532
|
+
})( jQuery, window , document );
|