fomantic-ui-sass 2.8.8.1 → 2.9.1

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