rails-active-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Rakefile +6 -0
- data/app/assets/stylesheets.css +73555 -0
- data/app/components/accordion_component.rb +34 -0
- data/app/components/ad_component.rb +28 -0
- data/app/components/api_component.rb +24 -0
- data/app/components/breadcrumb_component.rb +26 -0
- data/app/components/button_component.rb +49 -0
- data/app/components/calendar_component.rb +34 -0
- data/app/components/card_component.rb +56 -0
- data/app/components/checkbox_component.rb +41 -0
- data/app/components/column_component.rb +62 -0
- data/app/components/comment_component.rb +45 -0
- data/app/components/concerns/alignable.rb +21 -0
- data/app/components/concerns/attachable.rb +16 -0
- data/app/components/concerns/orientable.rb +21 -0
- data/app/components/concerns/positionable.rb +21 -0
- data/app/components/concerns/sizeable.rb +18 -0
- data/app/components/container_component.rb +23 -0
- data/app/components/dimmer_component.rb +30 -0
- data/app/components/divider_component.rb +30 -0
- data/app/components/dropdown_component.rb +63 -0
- data/app/components/embed_component.rb +32 -0
- data/app/components/emoji_component.rb +15 -0
- data/app/components/feed_component.rb +22 -0
- data/app/components/flag_component.rb +15 -0
- data/app/components/flyout_component.rb +41 -0
- data/app/components/form_component.rb +39 -0
- data/app/components/grid_component.rb +85 -0
- data/app/components/h_stack_component.rb +67 -0
- data/app/components/header_component.rb +60 -0
- data/app/components/icon_component.rb +41 -0
- data/app/components/image_component.rb +46 -0
- data/app/components/input_component.rb +52 -0
- data/app/components/item_component.rb +39 -0
- data/app/components/item_group_component.rb +30 -0
- data/app/components/label_component.rb +49 -0
- data/app/components/link_component.rb +23 -0
- data/app/components/list_component.rb +39 -0
- data/app/components/loader_component.rb +33 -0
- data/app/components/menu_component.rb +64 -0
- data/app/components/menu_item_component.rb +52 -0
- data/app/components/message_component.rb +54 -0
- data/app/components/modal_component.rb +50 -0
- data/app/components/nag_component.rb +25 -0
- data/app/components/overlay_component.rb +16 -0
- data/app/components/placeholder_component.rb +39 -0
- data/app/components/popup_component.rb +31 -0
- data/app/components/progress_component.rb +48 -0
- data/app/components/pusher_component.rb +18 -0
- data/app/components/rail_component.rb +31 -0
- data/app/components/rating_component.rb +41 -0
- data/app/components/reset_component.rb +12 -0
- data/app/components/reveal_component.rb +39 -0
- data/app/components/row_component.rb +39 -0
- data/app/components/search_component.rb +44 -0
- data/app/components/segment_component.rb +57 -0
- data/app/components/segment_group_component.rb +36 -0
- data/app/components/shape_component.rb +25 -0
- data/app/components/sidebar_component.rb +33 -0
- data/app/components/site_component.rb +12 -0
- data/app/components/slider_component.rb +46 -0
- data/app/components/state_component.rb +25 -0
- data/app/components/statistic_component.rb +43 -0
- data/app/components/step_component.rb +56 -0
- data/app/components/step_group_component.rb +38 -0
- data/app/components/sticky_component.rb +22 -0
- data/app/components/sub_header_component.rb +15 -0
- data/app/components/sub_menu_component.rb +24 -0
- data/app/components/tab_component.rb +24 -0
- data/app/components/table_cell_component.rb +60 -0
- data/app/components/table_component.rb +160 -0
- data/app/components/table_row_component.rb +43 -0
- data/app/components/text_component.rb +73 -0
- data/app/components/toast_component.rb +36 -0
- data/app/components/transition_component.rb +32 -0
- data/app/components/v_stack_component.rb +31 -0
- data/app/components/visibility_component.rb +22 -0
- data/app/helpers/component_helper.rb +109 -0
- data/app/helpers/fui_helper.rb +53 -0
- data/app/javascript/accordion.js +547 -0
- data/app/javascript/accordion.min.js +11 -0
- data/app/javascript/api.js +1112 -0
- data/app/javascript/api.min.js +11 -0
- data/app/javascript/calendar.js +1960 -0
- data/app/javascript/calendar.min.js +11 -0
- data/app/javascript/checkbox.js +819 -0
- data/app/javascript/checkbox.min.js +11 -0
- data/app/javascript/dimmer.js +686 -0
- data/app/javascript/dimmer.min.js +11 -0
- data/app/javascript/dropdown.js +4019 -0
- data/app/javascript/dropdown.min.js +11 -0
- data/app/javascript/embed.js +646 -0
- data/app/javascript/embed.min.js +11 -0
- data/app/javascript/flyout.js +1405 -0
- data/app/javascript/flyout.min.js +11 -0
- data/app/javascript/form.js +2070 -0
- data/app/javascript/form.min.js +11 -0
- data/app/javascript/jquery.js +10716 -0
- data/app/javascript/jquery.min.js +2 -0
- data/app/javascript/modal.js +1507 -0
- data/app/javascript/modal.min.js +11 -0
- data/app/javascript/nag.js +522 -0
- data/app/javascript/nag.min.js +11 -0
- data/app/javascript/popup.js +1457 -0
- data/app/javascript/popup.min.js +11 -0
- data/app/javascript/progress.js +922 -0
- data/app/javascript/progress.min.js +11 -0
- data/app/javascript/rating.js +496 -0
- data/app/javascript/rating.min.js +11 -0
- data/app/javascript/search.js +1519 -0
- data/app/javascript/search.min.js +11 -0
- data/app/javascript/shape.js +721 -0
- data/app/javascript/shape.min.js +11 -0
- data/app/javascript/sidebar.js +952 -0
- data/app/javascript/sidebar.min.js +11 -0
- data/app/javascript/site.js +415 -0
- data/app/javascript/site.min.js +11 -0
- data/app/javascript/slider.js +1449 -0
- data/app/javascript/slider.min.js +11 -0
- data/app/javascript/state.js +653 -0
- data/app/javascript/state.min.js +11 -0
- data/app/javascript/sticky.js +852 -0
- data/app/javascript/sticky.min.js +11 -0
- data/app/javascript/tab.js +867 -0
- data/app/javascript/tab.min.js +11 -0
- data/app/javascript/toast.js +916 -0
- data/app/javascript/toast.min.js +11 -0
- data/app/javascript/transition.js +955 -0
- data/app/javascript/transition.min.js +11 -0
- data/app/javascript/ui/controllers/fui_accordion_controller.js +45 -0
- data/app/javascript/ui/controllers/fui_api_controller.js +80 -0
- data/app/javascript/ui/controllers/fui_calendar_controller.js +66 -0
- data/app/javascript/ui/controllers/fui_checkbox_controller.js +48 -0
- data/app/javascript/ui/controllers/fui_dimmer_controller.js +45 -0
- data/app/javascript/ui/controllers/fui_dropdown_controller.js +68 -0
- data/app/javascript/ui/controllers/fui_embed_controller.js +49 -0
- data/app/javascript/ui/controllers/fui_flyout_controller.js +49 -0
- data/app/javascript/ui/controllers/fui_form_controller.js +62 -0
- data/app/javascript/ui/controllers/fui_modal_controller.js +61 -0
- data/app/javascript/ui/controllers/fui_nag_controller.js +52 -0
- data/app/javascript/ui/controllers/fui_popup_controller.js +58 -0
- data/app/javascript/ui/controllers/fui_progress_controller.js +60 -0
- data/app/javascript/ui/controllers/fui_rating_controller.js +49 -0
- data/app/javascript/ui/controllers/fui_search_controller.js +76 -0
- data/app/javascript/ui/controllers/fui_shape_controller.js +45 -0
- data/app/javascript/ui/controllers/fui_sidebar_controller.js +48 -0
- data/app/javascript/ui/controllers/fui_site_controller.js +29 -0
- data/app/javascript/ui/controllers/fui_slider_controller.js +53 -0
- data/app/javascript/ui/controllers/fui_state_controller.js +63 -0
- data/app/javascript/ui/controllers/fui_sticky_controller.js +50 -0
- data/app/javascript/ui/controllers/fui_tab_controller.js +57 -0
- data/app/javascript/ui/controllers/fui_toast_controller.js +60 -0
- data/app/javascript/ui/controllers/fui_transition_controller.js +60 -0
- data/app/javascript/ui/controllers/fui_visibility_controller.js +55 -0
- data/app/javascript/ui/index.js +114 -0
- data/app/javascript/visibility.js +1196 -0
- data/app/javascript/visibility.min.js +11 -0
- data/app/lib/component.rb +63 -0
- data/config/importmap.rb +27 -0
- data/config/initializers/ruby_template_handler.rb +31 -0
- data/config/routes.rb +2 -0
- data/lib/tasks/ui_tasks.rake +4 -0
- data/lib/ui/engine.rb +27 -0
- data/lib/ui/version.rb +3 -0
- data/lib/ui.rb +6 -0
- metadata +220 -0
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* # Fomantic-UI 2.9.4 - Embed
|
|
3
|
+
* https://github.com/fomantic/Fomantic-UI/
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Released under the MIT license
|
|
7
|
+
* https://opensource.org/licenses/MIT
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
(function ($, window, document) {
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
function isFunction(obj) {
|
|
15
|
+
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
window = window !== undefined && window.Math === Math
|
|
19
|
+
? window
|
|
20
|
+
: globalThis;
|
|
21
|
+
|
|
22
|
+
$.fn.embed = function (...args) {
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
|
|
25
|
+
let time = Date.now();
|
|
26
|
+
let performance = [];
|
|
27
|
+
|
|
28
|
+
const parameters = args[0];
|
|
29
|
+
const methodInvoked = typeof parameters === 'string';
|
|
30
|
+
const queryArguments = args.slice(1);
|
|
31
|
+
|
|
32
|
+
let returnedValue;
|
|
33
|
+
|
|
34
|
+
$allModules.each(function () {
|
|
35
|
+
const settings = $.isPlainObject(parameters)
|
|
36
|
+
? $.extend(true, {}, $.fn.embed.settings, parameters)
|
|
37
|
+
: $.extend({}, $.fn.embed.settings);
|
|
38
|
+
|
|
39
|
+
const selector = settings.selector;
|
|
40
|
+
const className = settings.className;
|
|
41
|
+
const sources = settings.sources;
|
|
42
|
+
const error = settings.error;
|
|
43
|
+
const metadata = settings.metadata;
|
|
44
|
+
const namespace = settings.namespace;
|
|
45
|
+
const templates = settings.templates;
|
|
46
|
+
|
|
47
|
+
const eventNamespace = '.' + namespace;
|
|
48
|
+
const moduleNamespace = 'module-' + namespace;
|
|
49
|
+
|
|
50
|
+
const $module = $(this);
|
|
51
|
+
let $placeholder = $module.find(selector.placeholder);
|
|
52
|
+
let $icon = $module.find(selector.icon);
|
|
53
|
+
let $embed = $module.find(selector.embed);
|
|
54
|
+
|
|
55
|
+
const element = this;
|
|
56
|
+
let instance = $module.data(moduleNamespace);
|
|
57
|
+
|
|
58
|
+
const module = {
|
|
59
|
+
|
|
60
|
+
initialize: function () {
|
|
61
|
+
module.debug('Initializing embed');
|
|
62
|
+
module.determine.autoplay();
|
|
63
|
+
module.create();
|
|
64
|
+
module.bind.events();
|
|
65
|
+
module.instantiate();
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
instantiate: function () {
|
|
69
|
+
module.verbose('Storing instance of module', module);
|
|
70
|
+
instance = module;
|
|
71
|
+
$module
|
|
72
|
+
.data(moduleNamespace, module);
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
destroy: function () {
|
|
76
|
+
module.verbose('Destroying previous instance of embed');
|
|
77
|
+
module.reset();
|
|
78
|
+
$module
|
|
79
|
+
.removeData(moduleNamespace)
|
|
80
|
+
.off(eventNamespace);
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
refresh: function () {
|
|
84
|
+
module.verbose('Refreshing selector cache');
|
|
85
|
+
$placeholder = $module.find(selector.placeholder);
|
|
86
|
+
$icon = $module.find(selector.icon);
|
|
87
|
+
$embed = $module.find(selector.embed);
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
bind: {
|
|
91
|
+
events: function () {
|
|
92
|
+
if (module.has.placeholder()) {
|
|
93
|
+
module.debug('Adding placeholder events');
|
|
94
|
+
$module
|
|
95
|
+
.on('click' + eventNamespace, selector.placeholder, module.createAndShow)
|
|
96
|
+
.on('click' + eventNamespace, selector.icon, module.createAndShow);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
create: function () {
|
|
102
|
+
const placeholder = module.get.placeholder();
|
|
103
|
+
if (placeholder) {
|
|
104
|
+
module.createPlaceholder();
|
|
105
|
+
} else {
|
|
106
|
+
module.createAndShow();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
createPlaceholder: function (placeholder = module.get.placeholder()) {
|
|
111
|
+
const icon = module.get.icon();
|
|
112
|
+
const alt = module.get.alt();
|
|
113
|
+
$module.html(templates.placeholder(placeholder, icon, alt));
|
|
114
|
+
module.debug('Creating placeholder for embed', placeholder, icon, alt);
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
createEmbed: function (url = module.get.url()) {
|
|
118
|
+
module.refresh();
|
|
119
|
+
$embed = $('<div/>')
|
|
120
|
+
.addClass(className.embed)
|
|
121
|
+
.html(module.generate.embed(url))
|
|
122
|
+
.appendTo($module);
|
|
123
|
+
settings.onCreate.call(element, url);
|
|
124
|
+
module.debug('Creating embed object', $embed);
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
changeEmbed: function (url) {
|
|
128
|
+
$embed
|
|
129
|
+
.html(module.generate.embed(url));
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
createAndShow: function () {
|
|
133
|
+
module.createEmbed();
|
|
134
|
+
module.show();
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
// sets new embed
|
|
138
|
+
change: function (source, id, url) {
|
|
139
|
+
module.debug('Changing video to ', source, id, url);
|
|
140
|
+
$module
|
|
141
|
+
.data(metadata.source, source)
|
|
142
|
+
.data(metadata.id, id);
|
|
143
|
+
if (url) {
|
|
144
|
+
$module.data(metadata.url, url);
|
|
145
|
+
} else {
|
|
146
|
+
$module.removeData(metadata.url);
|
|
147
|
+
}
|
|
148
|
+
if (module.has.embed()) {
|
|
149
|
+
module.changeEmbed();
|
|
150
|
+
} else {
|
|
151
|
+
module.create();
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
// clear embed
|
|
156
|
+
reset: function () {
|
|
157
|
+
module.debug('Clearing embed and showing placeholder');
|
|
158
|
+
module.remove.data();
|
|
159
|
+
module.remove.active();
|
|
160
|
+
module.remove.embed();
|
|
161
|
+
module.showPlaceholder();
|
|
162
|
+
settings.onReset.call(element);
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
// shows current embed
|
|
166
|
+
show: function () {
|
|
167
|
+
module.debug('Showing embed');
|
|
168
|
+
module.set.active();
|
|
169
|
+
settings.onDisplay.call(element);
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
hide: function () {
|
|
173
|
+
module.debug('Hiding embed');
|
|
174
|
+
module.showPlaceholder();
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
showPlaceholder: function () {
|
|
178
|
+
module.debug('Showing placeholder image');
|
|
179
|
+
module.remove.active();
|
|
180
|
+
settings.onPlaceholderDisplay.call(element);
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
get: {
|
|
184
|
+
id: function () {
|
|
185
|
+
return settings.id || $module.data(metadata.id);
|
|
186
|
+
},
|
|
187
|
+
placeholder: function () {
|
|
188
|
+
return settings.placeholder || $module.data(metadata.placeholder);
|
|
189
|
+
},
|
|
190
|
+
alt: function () {
|
|
191
|
+
return settings.alt || $module.data(metadata.alt);
|
|
192
|
+
},
|
|
193
|
+
icon: function () {
|
|
194
|
+
return settings.icon || ($module.data(metadata.icon) !== undefined
|
|
195
|
+
? $module.data(metadata.icon)
|
|
196
|
+
: module.determine.icon());
|
|
197
|
+
},
|
|
198
|
+
source: function (url) {
|
|
199
|
+
return settings.source || ($module.data(metadata.source) !== undefined
|
|
200
|
+
? $module.data(metadata.source)
|
|
201
|
+
: module.determine.source());
|
|
202
|
+
},
|
|
203
|
+
type: function () {
|
|
204
|
+
const source = module.get.source();
|
|
205
|
+
|
|
206
|
+
return sources[source] !== undefined
|
|
207
|
+
? sources[source].type
|
|
208
|
+
: false;
|
|
209
|
+
},
|
|
210
|
+
url: function (url) {
|
|
211
|
+
return url || settings.url || ($module.data(metadata.url) !== undefined
|
|
212
|
+
? $module.data(metadata.url)
|
|
213
|
+
: module.determine.url());
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
determine: {
|
|
218
|
+
autoplay: function () {
|
|
219
|
+
if (module.should.autoplay()) {
|
|
220
|
+
settings.autoplay = true;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
source: function (url = module.get.url()) {
|
|
224
|
+
let matchedSource = false;
|
|
225
|
+
if (url) {
|
|
226
|
+
$.each(sources, function (name, source) {
|
|
227
|
+
if (url.search(source.domain) !== -1) {
|
|
228
|
+
matchedSource = name;
|
|
229
|
+
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return matchedSource;
|
|
236
|
+
},
|
|
237
|
+
icon: function () {
|
|
238
|
+
const source = module.get.source();
|
|
239
|
+
|
|
240
|
+
return sources[source] !== undefined
|
|
241
|
+
? sources[source].icon
|
|
242
|
+
: false;
|
|
243
|
+
},
|
|
244
|
+
url: function () {
|
|
245
|
+
const id = settings.id || $module.data(metadata.id);
|
|
246
|
+
const source = settings.source || $module.data(metadata.source);
|
|
247
|
+
const url = sources[source] !== undefined
|
|
248
|
+
? sources[source].url.replace('{id}', id)
|
|
249
|
+
: false;
|
|
250
|
+
if (url) {
|
|
251
|
+
$module.data(metadata.url, url);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return url;
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
set: {
|
|
259
|
+
active: function () {
|
|
260
|
+
$module.addClass(className.active);
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
remove: {
|
|
265
|
+
data: function () {
|
|
266
|
+
$module
|
|
267
|
+
.removeData(metadata.id)
|
|
268
|
+
.removeData(metadata.icon)
|
|
269
|
+
.removeData(metadata.placeholder)
|
|
270
|
+
.removeData(metadata.alt)
|
|
271
|
+
.removeData(metadata.source)
|
|
272
|
+
.removeData(metadata.url);
|
|
273
|
+
},
|
|
274
|
+
active: function () {
|
|
275
|
+
$module.removeClass(className.active);
|
|
276
|
+
},
|
|
277
|
+
embed: function () {
|
|
278
|
+
$embed.empty();
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
encode: {
|
|
283
|
+
parameters: function (parameters) {
|
|
284
|
+
const urlString = [];
|
|
285
|
+
let index;
|
|
286
|
+
for (index in parameters) {
|
|
287
|
+
if (Object.prototype.hasOwnProperty.call(parameters, index)) {
|
|
288
|
+
urlString.push(encodeURIComponent(index) + '=' + encodeURIComponent(parameters[index]));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return urlString.join('&');
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
generate: {
|
|
297
|
+
embed: function (url) {
|
|
298
|
+
module.debug('Generating embed html');
|
|
299
|
+
const source = module.get.source();
|
|
300
|
+
let html;
|
|
301
|
+
let parameters;
|
|
302
|
+
url = module.get.url(url);
|
|
303
|
+
if (url) {
|
|
304
|
+
parameters = module.generate.parameters(source);
|
|
305
|
+
html = templates.iframe(url, parameters);
|
|
306
|
+
} else {
|
|
307
|
+
module.error(error.noURL, $module);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return html;
|
|
311
|
+
},
|
|
312
|
+
parameters: function (source, extraParameters = settings.parameters) {
|
|
313
|
+
let parameters = sources[source] && sources[source].parameters !== undefined
|
|
314
|
+
? sources[source].parameters(settings)
|
|
315
|
+
: {};
|
|
316
|
+
if (extraParameters) {
|
|
317
|
+
parameters = $.extend({}, parameters, extraParameters);
|
|
318
|
+
}
|
|
319
|
+
parameters = settings.onEmbed(parameters);
|
|
320
|
+
|
|
321
|
+
return module.encode.parameters(parameters);
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
|
|
325
|
+
has: {
|
|
326
|
+
embed: function () {
|
|
327
|
+
return $embed.length > 0;
|
|
328
|
+
},
|
|
329
|
+
placeholder: function () {
|
|
330
|
+
return settings.placeholder || $module.data(metadata.placeholder);
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
should: {
|
|
335
|
+
autoplay: function () {
|
|
336
|
+
return settings.autoplay === 'auto'
|
|
337
|
+
? settings.placeholder || $module.data(metadata.placeholder) !== undefined
|
|
338
|
+
: settings.autoplay;
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
is: {
|
|
343
|
+
video: function () {
|
|
344
|
+
return module.get.type() === 'video';
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
|
|
348
|
+
setting: function (name, value) {
|
|
349
|
+
module.debug('Changing setting', name, value);
|
|
350
|
+
if ($.isPlainObject(name)) {
|
|
351
|
+
$.extend(true, settings, name);
|
|
352
|
+
} else if (value !== undefined) {
|
|
353
|
+
if ($.isPlainObject(settings[name])) {
|
|
354
|
+
$.extend(true, settings[name], value);
|
|
355
|
+
} else {
|
|
356
|
+
settings[name] = value;
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
return settings[name];
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
internal: function (name, value) {
|
|
363
|
+
if ($.isPlainObject(name)) {
|
|
364
|
+
$.extend(true, module, name);
|
|
365
|
+
} else if (value !== undefined) {
|
|
366
|
+
module[name] = value;
|
|
367
|
+
} else {
|
|
368
|
+
return module[name];
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
debug: function (...args) {
|
|
372
|
+
if (!settings.silent && settings.debug) {
|
|
373
|
+
if (settings.performance) {
|
|
374
|
+
module.performance.log(args);
|
|
375
|
+
} else {
|
|
376
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
377
|
+
module.debug.apply(console, args);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
verbose: function (...args) {
|
|
382
|
+
if (!settings.silent && settings.verbose && settings.debug) {
|
|
383
|
+
if (settings.performance) {
|
|
384
|
+
module.performance.log(args);
|
|
385
|
+
} else {
|
|
386
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
387
|
+
module.verbose.apply(console, args);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
error: function (...args) {
|
|
392
|
+
if (!settings.silent) {
|
|
393
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
|
394
|
+
module.error.apply(console, args);
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
performance: {
|
|
398
|
+
log: function (message) {
|
|
399
|
+
let currentTime;
|
|
400
|
+
let executionTime;
|
|
401
|
+
let previousTime;
|
|
402
|
+
if (settings.performance) {
|
|
403
|
+
currentTime = Date.now();
|
|
404
|
+
previousTime = time || currentTime;
|
|
405
|
+
executionTime = currentTime - previousTime;
|
|
406
|
+
time = currentTime;
|
|
407
|
+
performance.push({
|
|
408
|
+
Name: message[0],
|
|
409
|
+
Arguments: message.slice(1),
|
|
410
|
+
Element: element,
|
|
411
|
+
'Execution Time': executionTime,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
clearTimeout(module.performance.timer);
|
|
415
|
+
module.performance.timer = setTimeout(function () {
|
|
416
|
+
module.performance.display();
|
|
417
|
+
}, 500);
|
|
418
|
+
},
|
|
419
|
+
display: function () {
|
|
420
|
+
let title = settings.name + ':';
|
|
421
|
+
let totalTime = 0;
|
|
422
|
+
time = false;
|
|
423
|
+
clearTimeout(module.performance.timer);
|
|
424
|
+
$.each(performance, function (index, data) {
|
|
425
|
+
totalTime += data['Execution Time'];
|
|
426
|
+
});
|
|
427
|
+
title += ' ' + totalTime + 'ms';
|
|
428
|
+
if ($allModules.length > 1) {
|
|
429
|
+
title += ' (' + $allModules.length + ')';
|
|
430
|
+
}
|
|
431
|
+
if (performance.length > 0) {
|
|
432
|
+
console.groupCollapsed(title);
|
|
433
|
+
console.table(performance);
|
|
434
|
+
console.groupEnd();
|
|
435
|
+
}
|
|
436
|
+
performance = [];
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
invoke: function (query, passedArguments = queryArguments, context = element) {
|
|
440
|
+
let object = instance;
|
|
441
|
+
let maxDepth;
|
|
442
|
+
let found;
|
|
443
|
+
let response;
|
|
444
|
+
if (typeof query === 'string' && object !== undefined) {
|
|
445
|
+
query = query.split(/[ .]/);
|
|
446
|
+
maxDepth = query.length - 1;
|
|
447
|
+
$.each(query, function (depth, value) {
|
|
448
|
+
const camelCaseValue = depth !== maxDepth
|
|
449
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
450
|
+
: query;
|
|
451
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
452
|
+
object = object[camelCaseValue];
|
|
453
|
+
} else if (object[camelCaseValue] !== undefined) {
|
|
454
|
+
found = object[camelCaseValue];
|
|
455
|
+
|
|
456
|
+
return false;
|
|
457
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
|
458
|
+
object = object[value];
|
|
459
|
+
} else if (object[value] !== undefined) {
|
|
460
|
+
found = object[value];
|
|
461
|
+
|
|
462
|
+
return false;
|
|
463
|
+
} else {
|
|
464
|
+
module.error(error.method, query);
|
|
465
|
+
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
if (isFunction(found)) {
|
|
471
|
+
response = found.apply(context, passedArguments);
|
|
472
|
+
} else if (found !== undefined) {
|
|
473
|
+
response = found;
|
|
474
|
+
}
|
|
475
|
+
if (Array.isArray(returnedValue)) {
|
|
476
|
+
returnedValue.push(response);
|
|
477
|
+
} else if (returnedValue !== undefined) {
|
|
478
|
+
returnedValue = [returnedValue, response];
|
|
479
|
+
} else if (response !== undefined) {
|
|
480
|
+
returnedValue = response;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return found;
|
|
484
|
+
},
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
if (methodInvoked) {
|
|
488
|
+
if (instance === undefined) {
|
|
489
|
+
module.initialize();
|
|
490
|
+
}
|
|
491
|
+
module.invoke(parameters);
|
|
492
|
+
} else {
|
|
493
|
+
if (instance !== undefined) {
|
|
494
|
+
instance.invoke('destroy');
|
|
495
|
+
}
|
|
496
|
+
module.initialize();
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
return returnedValue !== undefined
|
|
501
|
+
? returnedValue
|
|
502
|
+
: this;
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
$.fn.embed.settings = {
|
|
506
|
+
|
|
507
|
+
name: 'Embed',
|
|
508
|
+
namespace: 'embed',
|
|
509
|
+
|
|
510
|
+
silent: false,
|
|
511
|
+
debug: false,
|
|
512
|
+
verbose: false,
|
|
513
|
+
performance: true,
|
|
514
|
+
|
|
515
|
+
icon: false,
|
|
516
|
+
source: false,
|
|
517
|
+
url: false,
|
|
518
|
+
id: false,
|
|
519
|
+
placeholder: false,
|
|
520
|
+
alt: false,
|
|
521
|
+
|
|
522
|
+
// standard video settings
|
|
523
|
+
autoplay: 'auto',
|
|
524
|
+
color: '#444',
|
|
525
|
+
hd: true,
|
|
526
|
+
brandedUI: false,
|
|
527
|
+
|
|
528
|
+
// additional parameters to include with the embed
|
|
529
|
+
parameters: false,
|
|
530
|
+
|
|
531
|
+
onDisplay: function () {},
|
|
532
|
+
onPlaceholderDisplay: function () {},
|
|
533
|
+
onReset: function () {},
|
|
534
|
+
onCreate: function (url) {},
|
|
535
|
+
onEmbed: function (parameters) {
|
|
536
|
+
return parameters;
|
|
537
|
+
},
|
|
538
|
+
|
|
539
|
+
metadata: {
|
|
540
|
+
id: 'id',
|
|
541
|
+
icon: 'icon',
|
|
542
|
+
placeholder: 'placeholder',
|
|
543
|
+
alt: 'alt',
|
|
544
|
+
source: 'source',
|
|
545
|
+
url: 'url',
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
error: {
|
|
549
|
+
noURL: 'No URL specified',
|
|
550
|
+
method: 'The method you called is not defined',
|
|
551
|
+
},
|
|
552
|
+
|
|
553
|
+
className: {
|
|
554
|
+
active: 'active',
|
|
555
|
+
embed: 'embed',
|
|
556
|
+
},
|
|
557
|
+
|
|
558
|
+
selector: {
|
|
559
|
+
embed: '.embed',
|
|
560
|
+
placeholder: '.placeholder',
|
|
561
|
+
icon: '.icon',
|
|
562
|
+
},
|
|
563
|
+
|
|
564
|
+
sources: {
|
|
565
|
+
youtube: {
|
|
566
|
+
name: 'youtube',
|
|
567
|
+
type: 'video',
|
|
568
|
+
icon: 'video play',
|
|
569
|
+
domain: 'youtube.com',
|
|
570
|
+
url: '//www.youtube.com/embed/{id}',
|
|
571
|
+
parameters: function (settings) {
|
|
572
|
+
return {
|
|
573
|
+
autohide: !settings.brandedUI,
|
|
574
|
+
autoplay: settings.autoplay,
|
|
575
|
+
color: settings.color || undefined,
|
|
576
|
+
hq: settings.hd,
|
|
577
|
+
jsapi: settings.api,
|
|
578
|
+
modestbranding: !settings.brandedUI,
|
|
579
|
+
};
|
|
580
|
+
},
|
|
581
|
+
},
|
|
582
|
+
vimeo: {
|
|
583
|
+
name: 'vimeo',
|
|
584
|
+
type: 'video',
|
|
585
|
+
icon: 'video play',
|
|
586
|
+
domain: 'vimeo.com',
|
|
587
|
+
url: '//player.vimeo.com/video/{id}',
|
|
588
|
+
parameters: function (settings) {
|
|
589
|
+
return {
|
|
590
|
+
api: settings.api,
|
|
591
|
+
autoplay: settings.autoplay,
|
|
592
|
+
byline: settings.brandedUI,
|
|
593
|
+
color: settings.color || undefined,
|
|
594
|
+
portrait: settings.brandedUI,
|
|
595
|
+
title: settings.brandedUI,
|
|
596
|
+
};
|
|
597
|
+
},
|
|
598
|
+
},
|
|
599
|
+
},
|
|
600
|
+
|
|
601
|
+
templates: {
|
|
602
|
+
escape: function (string) {
|
|
603
|
+
const escapeMap = {
|
|
604
|
+
'"': '"',
|
|
605
|
+
'&': '&',
|
|
606
|
+
"'": ''',
|
|
607
|
+
'<': '<',
|
|
608
|
+
'>': '>',
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
|
|
612
|
+
},
|
|
613
|
+
iframe: function (url, parameters) {
|
|
614
|
+
let src = url;
|
|
615
|
+
const escape = $.fn.embed.settings.templates.escape;
|
|
616
|
+
if (parameters) {
|
|
617
|
+
src += '?' + parameters;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
return ''
|
|
621
|
+
+ '<iframe src="' + escape(src) + '"'
|
|
622
|
+
+ ' width="100%" height="100%"'
|
|
623
|
+
+ ' msallowFullScreen allowFullScreen></iframe>';
|
|
624
|
+
},
|
|
625
|
+
placeholder: function (image, icon, alt) {
|
|
626
|
+
let html = '';
|
|
627
|
+
const escape = $.fn.embed.settings.templates.escape;
|
|
628
|
+
if (icon) {
|
|
629
|
+
html += '<i class="' + escape(icon) + ' icon"></i>';
|
|
630
|
+
}
|
|
631
|
+
if (image) {
|
|
632
|
+
html += '<img class="placeholder" src="' + escape(image) + '"' + (alt ? ' alt="' + escape(alt) + '"' : '') + '>';
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
return html;
|
|
636
|
+
},
|
|
637
|
+
},
|
|
638
|
+
|
|
639
|
+
// NOT YET IMPLEMENTED
|
|
640
|
+
api: false,
|
|
641
|
+
onPause: function () {},
|
|
642
|
+
onPlay: function () {},
|
|
643
|
+
onStop: function () {},
|
|
644
|
+
|
|
645
|
+
};
|
|
646
|
+
})(jQuery, window, document);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* # Fomantic UI - 2.9.4
|
|
3
|
+
* https://github.com/fomantic/Fomantic-UI
|
|
4
|
+
* https://fomantic-ui.com/
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2026 Contributors
|
|
7
|
+
* Released under the MIT license
|
|
8
|
+
* https://opensource.org/licenses/MIT
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
!function(U,e){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,U.fn.embed=function(...e){const v=U(this);let g=Date.now(),y=[];const w=e[0],P="string"==typeof w,D=e.slice(1);let C;return v.each(function(){const t=U.isPlainObject(w)?U.extend(!0,{},U.fn.embed.settings,w):U.extend({},U.fn.embed.settings),e=t.selector,o=t.className,a=t.sources,l=t.error,r=t.metadata;var n=t.namespace;const i=t.templates,c="."+n,d="module-"+n,u=U(this);u.find(e.placeholder);let s,m=void u.find(e.icon),p=u.find(e.embed);const f=this;let h=u.data(d);const b={initialize:function(){b.debug("Initializing embed"),b.determine.autoplay(),b.create(),b.bind.events(),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),h=b,u.data(d,b)},destroy:function(){b.verbose("Destroying previous instance of embed"),b.reset(),u.removeData(d).off(c)},refresh:function(){b.verbose("Refreshing selector cache"),s=u.find(e.placeholder),m=u.find(e.icon),p=u.find(e.embed)},bind:{events:function(){b.has.placeholder()&&(b.debug("Adding placeholder events"),u.on("click"+c,e.placeholder,b.createAndShow).on("click"+c,e.icon,b.createAndShow))}},create:function(){b.get.placeholder()?b.createPlaceholder():b.createAndShow()},createPlaceholder:function(e=b.get.placeholder()){var o=b.get.icon(),n=b.get.alt();u.html(i.placeholder(e,o,n)),b.debug("Creating placeholder for embed",e,o,n)},createEmbed:function(e=b.get.url()){b.refresh(),p=U("<div/>").addClass(o.embed).html(b.generate.embed(e)).appendTo(u),t.onCreate.call(f,e),b.debug("Creating embed object",p)},changeEmbed:function(e){p.html(b.generate.embed(e))},createAndShow:function(){b.createEmbed(),b.show()},change:function(e,o,n){b.debug("Changing video to ",e,o,n),u.data(r.source,e).data(r.id,o),n?u.data(r.url,n):u.removeData(r.url),b.has.embed()?b.changeEmbed():b.create()},reset:function(){b.debug("Clearing embed and showing placeholder"),b.remove.data(),b.remove.active(),b.remove.embed(),b.showPlaceholder(),t.onReset.call(f)},show:function(){b.debug("Showing embed"),b.set.active(),t.onDisplay.call(f)},hide:function(){b.debug("Hiding embed"),b.showPlaceholder()},showPlaceholder:function(){b.debug("Showing placeholder image"),b.remove.active(),t.onPlaceholderDisplay.call(f)},get:{id:function(){return t.id||u.data(r.id)},placeholder:function(){return t.placeholder||u.data(r.placeholder)},alt:function(){return t.alt||u.data(r.alt)},icon:function(){return t.icon||(void 0!==u.data(r.icon)?u.data(r.icon):b.determine.icon())},source:function(e){return t.source||(void 0!==u.data(r.source)?u.data(r.source):b.determine.source())},type:function(){var e=b.get.source();return void 0!==a[e]&&a[e].type},url:function(e){return e||t.url||(void 0!==u.data(r.url)?u.data(r.url):b.determine.url())}},determine:{autoplay:function(){b.should.autoplay()&&(t.autoplay=!0)},source:function(n=b.get.url()){let t=!1;return n&&U.each(a,function(e,o){if(-1!==n.search(o.domain))return t=e,!1}),t},icon:function(){var e=b.get.source();return void 0!==a[e]&&a[e].icon},url:function(){var e=t.id||u.data(r.id),o=t.source||u.data(r.source),o=void 0!==a[o]&&a[o].url.replace("{id}",e);return o&&u.data(r.url,o),o}},set:{active:function(){u.addClass(o.active)}},remove:{data:function(){u.removeData(r.id).removeData(r.icon).removeData(r.placeholder).removeData(r.alt).removeData(r.source).removeData(r.url)},active:function(){u.removeClass(o.active)},embed:function(){p.empty()}},encode:{parameters:function(e){const o=[];let n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return o.join("&")}},generate:{embed:function(e){b.debug("Generating embed html");var o=b.get.source();let n;return(e=b.get.url(e))?(o=b.generate.parameters(o),n=i.iframe(e,o)):b.error(l.noURL,u),n},parameters:function(e,o=t.parameters){let n=a[e]&&void 0!==a[e].parameters?a[e].parameters(t):{};return o&&(n=U.extend({},n,o)),n=t.onEmbed(n),b.encode.parameters(n)}},has:{embed:function(){return 0<p.length},placeholder:function(){return t.placeholder||u.data(r.placeholder)}},should:{autoplay:function(){return"auto"===t.autoplay?t.placeholder||void 0!==u.data(r.placeholder):t.autoplay}},is:{video:function(){return"video"===b.get.type()}},setting:function(e,o){if(b.debug("Changing setting",e,o),U.isPlainObject(e))U.extend(!0,t,e);else{if(void 0===o)return t[e];U.isPlainObject(t[e])?U.extend(!0,t[e],o):t[e]=o}},internal:function(e,o){if(U.isPlainObject(e))U.extend(!0,b,e);else{if(void 0===o)return b[e];b[e]=o}},debug:function(...e){!t.silent&&t.debug&&(t.performance?b.performance.log(e):(b.debug=Function.prototype.bind.call(console.info,console,t.name+":"),b.debug.apply(console,e)))},verbose:function(...e){!t.silent&&t.verbose&&t.debug&&(t.performance?b.performance.log(e):(b.verbose=Function.prototype.bind.call(console.info,console,t.name+":"),b.verbose.apply(console,e)))},error:function(...e){t.silent||(b.error=Function.prototype.bind.call(console.error,console,t.name+":"),b.error.apply(console,e))},performance:{log:function(e){var o,n;t.performance&&(n=(o=Date.now())-(g||o),g=o,y.push({Name:e[0],Arguments:e.slice(1),Element:f,"Execution Time":n})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(function(){b.performance.display()},500)},display:function(){let e=t.name+":",n=0;g=!1,clearTimeout(b.performance.timer),U.each(y,function(e,o){n+=o["Execution Time"]}),e+=" "+n+"ms",1<v.length&&(e+=" ("+v.length+")"),0<y.length&&(console.groupCollapsed(e),console.table(y),console.groupEnd()),y=[]}},invoke:function(t,e=D,o=f){let a=h,r,i,n;var c;return"string"==typeof t&&void 0!==a&&(t=t.split(/[ .]/),r=t.length-1,U.each(t,function(e,o){var n=e!==r?o+t[e+1].charAt(0).toUpperCase()+t[e+1].slice(1):t;if(U.isPlainObject(a[n])&&e!==r)a=a[n];else{if(void 0!==a[n])return i=a[n],!1;{if(!U.isPlainObject(a[o])||e===r)return void 0!==a[o]?i=a[o]:b.error(l.method,t),!1;a=a[o]}}})),"function"==typeof(c=i)&&"number"!=typeof c.nodeType?n=i.apply(o,e):void 0!==i&&(n=i),Array.isArray(C)?C.push(n):void 0!==C?C=[C,n]:void 0!==n&&(C=n),i}};P?(void 0===h&&b.initialize(),b.invoke(w)):(void 0!==h&&h.invoke("destroy"),b.initialize())}),void 0!==C?C:this},U.fn.embed.settings={name:"Embed",namespace:"embed",silent:!1,debug:!1,verbose:!1,performance:!0,icon:!1,source:!1,url:!1,id:!1,placeholder:!1,alt:!1,autoplay:"auto",color:"#444",hd:!0,brandedUI:!1,parameters:!1,onDisplay:function(){},onPlaceholderDisplay:function(){},onReset:function(){},onCreate:function(e){},onEmbed:function(e){return e},metadata:{id:"id",icon:"icon",placeholder:"placeholder",alt:"alt",source:"source",url:"url"},error:{noURL:"No URL specified",method:"The method you called is not defined"},className:{active:"active",embed:"embed"},selector:{embed:".embed",placeholder:".placeholder",icon:".icon"},sources:{youtube:{name:"youtube",type:"video",icon:"video play",domain:"youtube.com",url:"//www.youtube.com/embed/{id}",parameters:function(e){return{autohide:!e.brandedUI,autoplay:e.autoplay,color:e.color||void 0,hq:e.hd,jsapi:e.api,modestbranding:!e.brandedUI}}},vimeo:{name:"vimeo",type:"video",icon:"video play",domain:"vimeo.com",url:"//player.vimeo.com/video/{id}",parameters:function(e){return{api:e.api,autoplay:e.autoplay,byline:e.brandedUI,color:e.color||void 0,portrait:e.brandedUI,title:e.brandedUI}}}},templates:{escape:function(e){const o={'"':""","&":"&","'":"'","<":"<",">":">"};return String(e).replace(/["&'<>]/g,e=>o[e])},iframe:function(e,o){let n=e;const t=U.fn.embed.settings.templates.escape;return o&&(n+="?"+o),'<iframe src="'+t(n)+'" width="100%" height="100%" msallowFullScreen allowFullScreen></iframe>'},placeholder:function(e,o,n){let t="";const a=U.fn.embed.settings.templates.escape;return o&&(t+='<i class="'+a(o)+' icon"></i>'),e&&(t+='<img class="placeholder" src="'+a(e)+'"'+(n?' alt="'+a(n)+'"':"")+">"),t}},api:!1,onPause:function(){},onPlay:function(){},onStop:function(){}}}(jQuery,window,document);
|