fomantic-ui-sass 2.9.0 → 2.9.1

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