rails-active-ui 0.2.2 → 0.3.1
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 +4 -4
- data/app/assets/datatables.css +15 -0
- data/app/assets/stylesheets.css +5 -1
- data/app/blocks/resource_list_block.rb +153 -0
- data/app/components/back_button_component.rb +34 -0
- data/app/components/button_component.rb +4 -2
- data/app/components/button_to_component.rb +3 -4
- data/app/components/column_component.rb +1 -1
- data/app/components/container_component.rb +1 -1
- data/app/components/dropdown_component.rb +8 -2
- data/app/components/grid_component.rb +5 -1
- data/app/components/link_to_component.rb +23 -0
- data/app/components/menu_item_component.rb +5 -1
- data/app/components/message_component.rb +3 -1
- data/app/components/modal_component.rb +23 -3
- data/app/components/paragraph_component.rb +13 -0
- data/app/components/row_component.rb +1 -1
- data/app/components/table_row_component.rb +3 -5
- data/app/components/template_component.rb +13 -0
- data/app/helpers/component_helper.rb +122 -76
- data/app/helpers/fui_helper.rb +37 -0
- data/app/javascript/datatables.js +10 -0
- data/app/javascript/ui/controllers/fui_datatable_controller.js +35 -0
- data/app/javascript/ui/controllers/fui_dropdown_controller.js +8 -1
- data/app/javascript/ui/controllers/fui_item_list_controller.js +40 -0
- data/app/javascript/ui/controllers/navigation_controller.js +23 -0
- data/app/javascript/ui/index.js +11 -0
- data/app/lib/component.rb +1 -1
- data/config/importmap.rb +3 -0
- data/config/initializers/ruby_template_handler.rb +4 -1
- data/formantic-ui/components/accordion.css +369 -0
- data/formantic-ui/components/accordion.js +595 -0
- data/formantic-ui/components/accordion.min.css +9 -0
- data/formantic-ui/components/accordion.min.js +11 -0
- data/formantic-ui/components/ad.css +264 -0
- data/formantic-ui/components/ad.min.css +10 -0
- data/formantic-ui/components/api.js +1225 -0
- data/formantic-ui/components/api.min.js +11 -0
- data/formantic-ui/components/breadcrumb.css +135 -0
- data/formantic-ui/components/breadcrumb.min.css +9 -0
- data/formantic-ui/components/button.css +4058 -0
- data/formantic-ui/components/button.min.css +9 -0
- data/formantic-ui/components/calendar.css +327 -0
- data/formantic-ui/components/calendar.js +2045 -0
- data/formantic-ui/components/calendar.min.css +9 -0
- data/formantic-ui/components/calendar.min.js +11 -0
- data/formantic-ui/components/card.css +1881 -0
- data/formantic-ui/components/card.min.css +9 -0
- data/formantic-ui/components/checkbox.css +785 -0
- data/formantic-ui/components/checkbox.js +888 -0
- data/formantic-ui/components/checkbox.min.css +9 -0
- data/formantic-ui/components/checkbox.min.js +11 -0
- data/formantic-ui/components/comment.css +283 -0
- data/formantic-ui/components/comment.min.css +9 -0
- data/formantic-ui/components/container.css +300 -0
- data/formantic-ui/components/container.min.css +9 -0
- data/formantic-ui/components/dimmer.css +367 -0
- data/formantic-ui/components/dimmer.js +732 -0
- data/formantic-ui/components/dimmer.min.css +9 -0
- data/formantic-ui/components/dimmer.min.js +11 -0
- data/formantic-ui/components/divider.css +287 -0
- data/formantic-ui/components/divider.min.css +9 -0
- data/formantic-ui/components/dropdown.css +2087 -0
- data/formantic-ui/components/dropdown.js +4432 -0
- data/formantic-ui/components/dropdown.min.css +9 -0
- data/formantic-ui/components/dropdown.min.js +11 -0
- data/formantic-ui/components/embed.css +155 -0
- data/formantic-ui/components/embed.js +688 -0
- data/formantic-ui/components/embed.min.css +9 -0
- data/formantic-ui/components/embed.min.js +11 -0
- data/formantic-ui/components/emoji.css +15311 -0
- data/formantic-ui/components/emoji.min.css +9 -0
- data/formantic-ui/components/feed.css +799 -0
- data/formantic-ui/components/feed.min.css +9 -0
- data/formantic-ui/components/flag.css +1149 -0
- data/formantic-ui/components/flag.min.css +9 -0
- data/formantic-ui/components/flyout.css +546 -0
- data/formantic-ui/components/flyout.js +1551 -0
- data/formantic-ui/components/flyout.min.css +9 -0
- data/formantic-ui/components/flyout.min.js +11 -0
- data/formantic-ui/components/form.css +1885 -0
- data/formantic-ui/components/form.js +2199 -0
- data/formantic-ui/components/form.min.css +9 -0
- data/formantic-ui/components/form.min.js +11 -0
- data/formantic-ui/components/grid.css +1952 -0
- data/formantic-ui/components/grid.min.css +9 -0
- data/formantic-ui/components/header.css +778 -0
- data/formantic-ui/components/header.min.css +9 -0
- data/formantic-ui/components/icon.css +7066 -0
- data/formantic-ui/components/icon.min.css +9 -0
- data/formantic-ui/components/image.css +315 -0
- data/formantic-ui/components/image.min.css +9 -0
- data/formantic-ui/components/input.css +1566 -0
- data/formantic-ui/components/input.min.css +9 -0
- data/formantic-ui/components/item.css +534 -0
- data/formantic-ui/components/item.min.css +9 -0
- data/formantic-ui/components/label.css +2114 -0
- data/formantic-ui/components/label.min.css +9 -0
- data/formantic-ui/components/list.css +955 -0
- data/formantic-ui/components/list.min.css +9 -0
- data/formantic-ui/components/loader.css +787 -0
- data/formantic-ui/components/loader.min.css +9 -0
- data/formantic-ui/components/menu.css +2131 -0
- data/formantic-ui/components/menu.min.css +9 -0
- data/formantic-ui/components/message.css +619 -0
- data/formantic-ui/components/message.min.css +9 -0
- data/formantic-ui/components/modal.css +779 -0
- data/formantic-ui/components/modal.js +1637 -0
- data/formantic-ui/components/modal.min.css +9 -0
- data/formantic-ui/components/modal.min.js +11 -0
- data/formantic-ui/components/nag.css +290 -0
- data/formantic-ui/components/nag.js +566 -0
- data/formantic-ui/components/nag.min.css +9 -0
- data/formantic-ui/components/nag.min.js +11 -0
- data/formantic-ui/components/placeholder.css +228 -0
- data/formantic-ui/components/placeholder.min.css +9 -0
- data/formantic-ui/components/popup.css +1184 -0
- data/formantic-ui/components/popup.js +1561 -0
- data/formantic-ui/components/popup.min.css +9 -0
- data/formantic-ui/components/popup.min.js +11 -0
- data/formantic-ui/components/progress.css +761 -0
- data/formantic-ui/components/progress.js +979 -0
- data/formantic-ui/components/progress.min.css +9 -0
- data/formantic-ui/components/progress.min.js +11 -0
- data/formantic-ui/components/rail.css +147 -0
- data/formantic-ui/components/rail.min.css +9 -0
- data/formantic-ui/components/rating.css +414 -0
- data/formantic-ui/components/rating.js +540 -0
- data/formantic-ui/components/rating.min.css +9 -0
- data/formantic-ui/components/rating.min.js +11 -0
- data/formantic-ui/components/reset.css +386 -0
- data/formantic-ui/components/reset.min.css +9 -0
- data/formantic-ui/components/reveal.css +277 -0
- data/formantic-ui/components/reveal.min.css +9 -0
- data/formantic-ui/components/search.css +541 -0
- data/formantic-ui/components/search.js +1641 -0
- data/formantic-ui/components/search.min.css +9 -0
- data/formantic-ui/components/search.min.js +11 -0
- data/formantic-ui/components/segment.css +1053 -0
- data/formantic-ui/components/segment.min.css +9 -0
- data/formantic-ui/components/shape.css +144 -0
- data/formantic-ui/components/shape.js +797 -0
- data/formantic-ui/components/shape.min.css +9 -0
- data/formantic-ui/components/shape.min.js +11 -0
- data/formantic-ui/components/sidebar.css +539 -0
- data/formantic-ui/components/sidebar.js +1054 -0
- data/formantic-ui/components/sidebar.min.css +9 -0
- data/formantic-ui/components/sidebar.min.js +11 -0
- data/formantic-ui/components/site.css +286 -0
- data/formantic-ui/components/site.js +455 -0
- data/formantic-ui/components/site.min.css +9 -0
- data/formantic-ui/components/site.min.js +11 -0
- data/formantic-ui/components/slider.css +926 -0
- data/formantic-ui/components/slider.js +1546 -0
- data/formantic-ui/components/slider.min.css +9 -0
- data/formantic-ui/components/slider.min.js +11 -0
- data/formantic-ui/components/state.js +697 -0
- data/formantic-ui/components/state.min.js +11 -0
- data/formantic-ui/components/statistic.css +586 -0
- data/formantic-ui/components/statistic.min.css +9 -0
- data/formantic-ui/components/step.css +1538 -0
- data/formantic-ui/components/step.min.css +9 -0
- data/formantic-ui/components/sticky.css +73 -0
- data/formantic-ui/components/sticky.js +917 -0
- data/formantic-ui/components/sticky.min.css +9 -0
- data/formantic-ui/components/sticky.min.js +11 -0
- data/formantic-ui/components/tab.css +84 -0
- data/formantic-ui/components/tab.js +967 -0
- data/formantic-ui/components/tab.min.css +9 -0
- data/formantic-ui/components/tab.min.js +11 -0
- data/formantic-ui/components/table.css +3473 -0
- data/formantic-ui/components/table.min.css +9 -0
- data/formantic-ui/components/text.css +155 -0
- data/formantic-ui/components/text.min.css +9 -0
- data/formantic-ui/components/toast.css +751 -0
- data/formantic-ui/components/toast.js +964 -0
- data/formantic-ui/components/toast.min.css +9 -0
- data/formantic-ui/components/toast.min.js +11 -0
- data/formantic-ui/components/transition.css +1148 -0
- data/formantic-ui/components/transition.js +1034 -0
- data/formantic-ui/components/transition.min.css +9 -0
- data/formantic-ui/components/transition.min.js +11 -0
- data/formantic-ui/components/visibility.js +1292 -0
- data/formantic-ui/components/visibility.min.js +11 -0
- data/formantic-ui/semantic.css +78485 -0
- data/formantic-ui/semantic.js +31036 -0
- data/formantic-ui/semantic.min.css +11 -0
- data/formantic-ui/semantic.min.js +11 -0
- data/formantic-ui/themes/basic/assets/fonts/LICENSE.txt +91 -0
- data/formantic-ui/themes/basic/assets/fonts/icons.woff +0 -0
- data/formantic-ui/themes/basic/assets/fonts/icons.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LICENSE_Lato.txt +94 -0
- data/formantic-ui/themes/default/assets/fonts/LICENSE_icons.txt +165 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Bold.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Italic.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Regular.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/brand-icons.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/brand-icons.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/icons.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/outline-icons.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/outline-icons.woff2 +0 -0
- data/formantic-ui/themes/famfamfam/assets/images/flags.png +0 -0
- data/formantic-ui/themes/github/assets/fonts/LICENSE.txt +94 -0
- data/formantic-ui/themes/github/assets/fonts/octicons.woff +0 -0
- data/formantic-ui/themes/github/assets/fonts/octicons.woff2 +0 -0
- data/formantic-ui/themes/material/assets/fonts/LICENSE.txt +202 -0
- data/formantic-ui/themes/material/assets/fonts/icons.woff +0 -0
- data/formantic-ui/themes/material/assets/fonts/icons.woff2 +0 -0
- data/lib/ui/engine.rb +7 -2
- data/lib/ui/version.rb +1 -1
- metadata +205 -7
- data/app/components/link_component.rb +0 -23
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* # Fomantic-UI 2.9.4 - Rating
|
|
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.rating = function (parameters) {
|
|
23
|
+
var
|
|
24
|
+
$allModules = $(this),
|
|
25
|
+
|
|
26
|
+
time = Date.now(),
|
|
27
|
+
performance = [],
|
|
28
|
+
|
|
29
|
+
query = arguments[0],
|
|
30
|
+
methodInvoked = typeof query === 'string',
|
|
31
|
+
queryArguments = [].slice.call(arguments, 1),
|
|
32
|
+
returnedValue
|
|
33
|
+
;
|
|
34
|
+
$allModules.each(function () {
|
|
35
|
+
var
|
|
36
|
+
settings = $.isPlainObject(parameters)
|
|
37
|
+
? $.extend(true, {}, $.fn.rating.settings, parameters)
|
|
38
|
+
: $.extend({}, $.fn.rating.settings),
|
|
39
|
+
|
|
40
|
+
namespace = settings.namespace,
|
|
41
|
+
className = settings.className,
|
|
42
|
+
error = settings.error,
|
|
43
|
+
metadata = settings.metadata,
|
|
44
|
+
selector = settings.selector,
|
|
45
|
+
cssVars = settings.cssVars,
|
|
46
|
+
|
|
47
|
+
eventNamespace = '.' + namespace,
|
|
48
|
+
moduleNamespace = 'module-' + namespace,
|
|
49
|
+
|
|
50
|
+
element = this,
|
|
51
|
+
instance = $(this).data(moduleNamespace),
|
|
52
|
+
|
|
53
|
+
$module = $(this),
|
|
54
|
+
$icon = $module.find(selector.icon),
|
|
55
|
+
|
|
56
|
+
initialLoad,
|
|
57
|
+
module
|
|
58
|
+
;
|
|
59
|
+
|
|
60
|
+
module = {
|
|
61
|
+
|
|
62
|
+
initialize: function () {
|
|
63
|
+
module.verbose('Initializing rating module', settings);
|
|
64
|
+
|
|
65
|
+
if ($icon.length === 0) {
|
|
66
|
+
module.setup.layout();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (settings.interactive && !module.is.disabled()) {
|
|
70
|
+
module.enable();
|
|
71
|
+
} else {
|
|
72
|
+
module.disable();
|
|
73
|
+
}
|
|
74
|
+
module.set.initialLoad();
|
|
75
|
+
module.set.rating(module.get.initialRating());
|
|
76
|
+
module.remove.initialLoad();
|
|
77
|
+
module.instantiate();
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
instantiate: function () {
|
|
81
|
+
module.verbose('Instantiating module', settings);
|
|
82
|
+
instance = module;
|
|
83
|
+
$module
|
|
84
|
+
.data(moduleNamespace, module)
|
|
85
|
+
;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
destroy: function () {
|
|
89
|
+
module.verbose('Destroying previous instance', instance);
|
|
90
|
+
module.remove.events();
|
|
91
|
+
$module
|
|
92
|
+
.removeData(moduleNamespace)
|
|
93
|
+
;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
refresh: function () {
|
|
97
|
+
$icon = $module.find(selector.icon);
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
setup: {
|
|
101
|
+
layout: function () {
|
|
102
|
+
var
|
|
103
|
+
maxRating = module.get.maxRating(),
|
|
104
|
+
icon = module.get.icon(),
|
|
105
|
+
html = $.fn.rating.settings.templates.icon(maxRating, icon)
|
|
106
|
+
;
|
|
107
|
+
module.debug('Generating icon html dynamically');
|
|
108
|
+
$module
|
|
109
|
+
.html(html)
|
|
110
|
+
;
|
|
111
|
+
module.refresh();
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
event: {
|
|
116
|
+
mouseenter: function () {
|
|
117
|
+
var
|
|
118
|
+
$activeIcon = $(this)
|
|
119
|
+
;
|
|
120
|
+
$activeIcon
|
|
121
|
+
.nextAll()
|
|
122
|
+
.removeClass(className.selected)
|
|
123
|
+
;
|
|
124
|
+
$module
|
|
125
|
+
.addClass(className.selected)
|
|
126
|
+
;
|
|
127
|
+
$activeIcon
|
|
128
|
+
.addClass(className.selected)
|
|
129
|
+
.prevAll()
|
|
130
|
+
.addClass(className.selected)
|
|
131
|
+
;
|
|
132
|
+
},
|
|
133
|
+
mouseleave: function () {
|
|
134
|
+
$module
|
|
135
|
+
.removeClass(className.selected)
|
|
136
|
+
;
|
|
137
|
+
$icon
|
|
138
|
+
.removeClass(className.selected)
|
|
139
|
+
;
|
|
140
|
+
},
|
|
141
|
+
click: function () {
|
|
142
|
+
var
|
|
143
|
+
$activeIcon = $(this),
|
|
144
|
+
currentRating = module.get.rating(),
|
|
145
|
+
rating = $icon.index($activeIcon) + 1,
|
|
146
|
+
canClear = settings.clearable === 'auto'
|
|
147
|
+
? $icon.length === 1
|
|
148
|
+
: settings.clearable
|
|
149
|
+
;
|
|
150
|
+
if (canClear && currentRating === rating) {
|
|
151
|
+
module.clearRating();
|
|
152
|
+
} else {
|
|
153
|
+
module.set.rating(rating);
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
clearRating: function () {
|
|
159
|
+
module.debug('Clearing current rating');
|
|
160
|
+
module.set.rating(0);
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
bind: {
|
|
164
|
+
events: function () {
|
|
165
|
+
module.verbose('Binding events');
|
|
166
|
+
$module
|
|
167
|
+
.on('mouseenter' + eventNamespace, selector.icon, module.event.mouseenter)
|
|
168
|
+
.on('mouseleave' + eventNamespace, selector.icon, module.event.mouseleave)
|
|
169
|
+
.on('click' + eventNamespace, selector.icon, module.event.click)
|
|
170
|
+
;
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
remove: {
|
|
175
|
+
events: function () {
|
|
176
|
+
module.verbose('Removing events');
|
|
177
|
+
$module
|
|
178
|
+
.off(eventNamespace)
|
|
179
|
+
;
|
|
180
|
+
},
|
|
181
|
+
initialLoad: function () {
|
|
182
|
+
initialLoad = false;
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
enable: function () {
|
|
187
|
+
module.debug('Setting rating to interactive mode');
|
|
188
|
+
module.bind.events();
|
|
189
|
+
$module
|
|
190
|
+
.removeClass(className.disabled)
|
|
191
|
+
;
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
disable: function () {
|
|
195
|
+
module.debug('Setting rating to read-only mode');
|
|
196
|
+
module.remove.events();
|
|
197
|
+
$module
|
|
198
|
+
.addClass(className.disabled)
|
|
199
|
+
;
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
is: {
|
|
203
|
+
initialLoad: function () {
|
|
204
|
+
return initialLoad;
|
|
205
|
+
},
|
|
206
|
+
disabled: function () {
|
|
207
|
+
return $module.hasClass(className.disabled);
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
get: {
|
|
212
|
+
icon: function () {
|
|
213
|
+
var icon = $module.data(metadata.icon);
|
|
214
|
+
if (icon) {
|
|
215
|
+
$module.removeData(metadata.icon);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return icon || settings.icon;
|
|
219
|
+
},
|
|
220
|
+
initialRating: function () {
|
|
221
|
+
if ($module.data(metadata.rating) !== undefined) {
|
|
222
|
+
$module.removeData(metadata.rating);
|
|
223
|
+
|
|
224
|
+
return $module.data(metadata.rating);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return settings.initialRating;
|
|
228
|
+
},
|
|
229
|
+
maxRating: function () {
|
|
230
|
+
if ($module.data(metadata.maxRating) !== undefined) {
|
|
231
|
+
$module.removeData(metadata.maxRating);
|
|
232
|
+
|
|
233
|
+
return $module.data(metadata.maxRating);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return settings.maxRating;
|
|
237
|
+
},
|
|
238
|
+
rating: function () {
|
|
239
|
+
var
|
|
240
|
+
currentRating = $icon.filter('.' + className.active).length
|
|
241
|
+
;
|
|
242
|
+
module.verbose('Current rating retrieved', currentRating);
|
|
243
|
+
|
|
244
|
+
return currentRating;
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
set: {
|
|
249
|
+
rating: function (rating) {
|
|
250
|
+
var
|
|
251
|
+
ratingIndex = Math.floor(
|
|
252
|
+
rating - 1 >= 0
|
|
253
|
+
? rating - 1
|
|
254
|
+
: 0
|
|
255
|
+
),
|
|
256
|
+
$activeIcon = $icon.eq(ratingIndex),
|
|
257
|
+
$partialActiveIcon = rating <= 1
|
|
258
|
+
? $activeIcon
|
|
259
|
+
: $activeIcon.next(),
|
|
260
|
+
filledPercentage = (rating % 1) * 100
|
|
261
|
+
;
|
|
262
|
+
$module
|
|
263
|
+
.removeClass(className.selected)
|
|
264
|
+
;
|
|
265
|
+
$icon
|
|
266
|
+
.removeClass(className.selected)
|
|
267
|
+
.removeClass(className.active)
|
|
268
|
+
.removeClass(className.partiallyActive)
|
|
269
|
+
;
|
|
270
|
+
if (rating > 0) {
|
|
271
|
+
module.verbose('Setting current rating to', rating);
|
|
272
|
+
$activeIcon
|
|
273
|
+
.prevAll()
|
|
274
|
+
.addBack()
|
|
275
|
+
.addClass(className.active)
|
|
276
|
+
;
|
|
277
|
+
if ($activeIcon.next() && rating % 1 !== 0) {
|
|
278
|
+
$partialActiveIcon
|
|
279
|
+
.addClass(className.partiallyActive)
|
|
280
|
+
.addClass(className.active)
|
|
281
|
+
;
|
|
282
|
+
$partialActiveIcon
|
|
283
|
+
.css(cssVars.filledCustomPropName, filledPercentage + '%')
|
|
284
|
+
;
|
|
285
|
+
if ($partialActiveIcon.css('backgroundColor') === 'transparent') {
|
|
286
|
+
$partialActiveIcon
|
|
287
|
+
.removeClass(className.partiallyActive)
|
|
288
|
+
.removeClass(className.active)
|
|
289
|
+
;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (!module.is.initialLoad()) {
|
|
294
|
+
settings.onRate.call(element, rating);
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
initialLoad: function () {
|
|
298
|
+
initialLoad = true;
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
setting: function (name, value) {
|
|
303
|
+
module.debug('Changing setting', name, value);
|
|
304
|
+
if ($.isPlainObject(name)) {
|
|
305
|
+
$.extend(true, settings, name);
|
|
306
|
+
} else if (value !== undefined) {
|
|
307
|
+
if ($.isPlainObject(settings[name])) {
|
|
308
|
+
$.extend(true, settings[name], value);
|
|
309
|
+
} else {
|
|
310
|
+
settings[name] = value;
|
|
311
|
+
}
|
|
312
|
+
} else {
|
|
313
|
+
return settings[name];
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
internal: function (name, value) {
|
|
317
|
+
if ($.isPlainObject(name)) {
|
|
318
|
+
$.extend(true, module, name);
|
|
319
|
+
} else if (value !== undefined) {
|
|
320
|
+
module[name] = value;
|
|
321
|
+
} else {
|
|
322
|
+
return module[name];
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
debug: function () {
|
|
326
|
+
if (!settings.silent && settings.debug) {
|
|
327
|
+
if (settings.performance) {
|
|
328
|
+
module.performance.log(arguments);
|
|
329
|
+
} else {
|
|
330
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
331
|
+
module.debug.apply(console, arguments);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
verbose: function () {
|
|
336
|
+
if (!settings.silent && settings.verbose && settings.debug) {
|
|
337
|
+
if (settings.performance) {
|
|
338
|
+
module.performance.log(arguments);
|
|
339
|
+
} else {
|
|
340
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
341
|
+
module.verbose.apply(console, arguments);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
error: function () {
|
|
346
|
+
if (!settings.silent) {
|
|
347
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
|
348
|
+
module.error.apply(console, arguments);
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
performance: {
|
|
352
|
+
log: function (message) {
|
|
353
|
+
var
|
|
354
|
+
currentTime,
|
|
355
|
+
executionTime,
|
|
356
|
+
previousTime
|
|
357
|
+
;
|
|
358
|
+
if (settings.performance) {
|
|
359
|
+
currentTime = Date.now();
|
|
360
|
+
previousTime = time || currentTime;
|
|
361
|
+
executionTime = currentTime - previousTime;
|
|
362
|
+
time = currentTime;
|
|
363
|
+
performance.push({
|
|
364
|
+
Name: message[0],
|
|
365
|
+
Arguments: [].slice.call(message, 1) || '',
|
|
366
|
+
Element: element,
|
|
367
|
+
'Execution Time': executionTime,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
clearTimeout(module.performance.timer);
|
|
371
|
+
module.performance.timer = setTimeout(function () {
|
|
372
|
+
module.performance.display();
|
|
373
|
+
}, 500);
|
|
374
|
+
},
|
|
375
|
+
display: function () {
|
|
376
|
+
var
|
|
377
|
+
title = settings.name + ':',
|
|
378
|
+
totalTime = 0
|
|
379
|
+
;
|
|
380
|
+
time = false;
|
|
381
|
+
clearTimeout(module.performance.timer);
|
|
382
|
+
$.each(performance, function (index, data) {
|
|
383
|
+
totalTime += data['Execution Time'];
|
|
384
|
+
});
|
|
385
|
+
title += ' ' + totalTime + 'ms';
|
|
386
|
+
if ($allModules.length > 1) {
|
|
387
|
+
title += ' (' + $allModules.length + ')';
|
|
388
|
+
}
|
|
389
|
+
if (performance.length > 0) {
|
|
390
|
+
console.groupCollapsed(title);
|
|
391
|
+
if (console.table) {
|
|
392
|
+
console.table(performance);
|
|
393
|
+
} else {
|
|
394
|
+
$.each(performance, function (index, data) {
|
|
395
|
+
console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
console.groupEnd();
|
|
399
|
+
}
|
|
400
|
+
performance = [];
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
invoke: function (query, passedArguments, context) {
|
|
404
|
+
var
|
|
405
|
+
object = instance,
|
|
406
|
+
maxDepth,
|
|
407
|
+
found,
|
|
408
|
+
response
|
|
409
|
+
;
|
|
410
|
+
passedArguments = passedArguments || queryArguments;
|
|
411
|
+
context = context || element;
|
|
412
|
+
if (typeof query === 'string' && object !== undefined) {
|
|
413
|
+
query = query.split(/[ .]/);
|
|
414
|
+
maxDepth = query.length - 1;
|
|
415
|
+
$.each(query, function (depth, value) {
|
|
416
|
+
var camelCaseValue = depth !== maxDepth
|
|
417
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
418
|
+
: query
|
|
419
|
+
;
|
|
420
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
421
|
+
object = object[camelCaseValue];
|
|
422
|
+
} else if (object[camelCaseValue] !== undefined) {
|
|
423
|
+
found = object[camelCaseValue];
|
|
424
|
+
|
|
425
|
+
return false;
|
|
426
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
|
427
|
+
object = object[value];
|
|
428
|
+
} else if (object[value] !== undefined) {
|
|
429
|
+
found = object[value];
|
|
430
|
+
|
|
431
|
+
return false;
|
|
432
|
+
} else {
|
|
433
|
+
module.error(error.method, query);
|
|
434
|
+
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
if (isFunction(found)) {
|
|
440
|
+
response = found.apply(context, passedArguments);
|
|
441
|
+
} else if (found !== undefined) {
|
|
442
|
+
response = found;
|
|
443
|
+
}
|
|
444
|
+
if (Array.isArray(returnedValue)) {
|
|
445
|
+
returnedValue.push(response);
|
|
446
|
+
} else if (returnedValue !== undefined) {
|
|
447
|
+
returnedValue = [returnedValue, response];
|
|
448
|
+
} else if (response !== undefined) {
|
|
449
|
+
returnedValue = response;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return found;
|
|
453
|
+
},
|
|
454
|
+
};
|
|
455
|
+
if (methodInvoked) {
|
|
456
|
+
if (instance === undefined) {
|
|
457
|
+
module.initialize();
|
|
458
|
+
}
|
|
459
|
+
module.invoke(query);
|
|
460
|
+
} else {
|
|
461
|
+
if (instance !== undefined) {
|
|
462
|
+
instance.invoke('destroy');
|
|
463
|
+
}
|
|
464
|
+
module.initialize();
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
return returnedValue !== undefined
|
|
469
|
+
? returnedValue
|
|
470
|
+
: this;
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
$.fn.rating.settings = {
|
|
474
|
+
|
|
475
|
+
name: 'Rating',
|
|
476
|
+
namespace: 'rating',
|
|
477
|
+
|
|
478
|
+
icon: 'star',
|
|
479
|
+
|
|
480
|
+
silent: false,
|
|
481
|
+
debug: false,
|
|
482
|
+
verbose: false,
|
|
483
|
+
performance: true,
|
|
484
|
+
|
|
485
|
+
initialRating: 0,
|
|
486
|
+
interactive: true,
|
|
487
|
+
maxRating: 4,
|
|
488
|
+
clearable: 'auto',
|
|
489
|
+
|
|
490
|
+
fireOnInit: false,
|
|
491
|
+
|
|
492
|
+
onRate: function (rating) {},
|
|
493
|
+
|
|
494
|
+
error: {
|
|
495
|
+
method: 'The method you called is not defined',
|
|
496
|
+
},
|
|
497
|
+
|
|
498
|
+
metadata: {
|
|
499
|
+
rating: 'rating',
|
|
500
|
+
maxRating: 'maxRating',
|
|
501
|
+
icon: 'icon',
|
|
502
|
+
},
|
|
503
|
+
|
|
504
|
+
className: {
|
|
505
|
+
active: 'active',
|
|
506
|
+
disabled: 'disabled',
|
|
507
|
+
selected: 'selected',
|
|
508
|
+
loading: 'loading',
|
|
509
|
+
partiallyActive: 'partial',
|
|
510
|
+
},
|
|
511
|
+
|
|
512
|
+
cssVars: {
|
|
513
|
+
filledCustomPropName: '--full',
|
|
514
|
+
},
|
|
515
|
+
|
|
516
|
+
selector: {
|
|
517
|
+
icon: '.icon',
|
|
518
|
+
},
|
|
519
|
+
|
|
520
|
+
templates: {
|
|
521
|
+
deQuote: function (string, encode) {
|
|
522
|
+
return String(string).replace(/"/g, encode ? '"' : '');
|
|
523
|
+
},
|
|
524
|
+
icon: function (maxRating, iconClass) {
|
|
525
|
+
var
|
|
526
|
+
icon = 1,
|
|
527
|
+
html = '',
|
|
528
|
+
deQuote = $.fn.rating.settings.templates.deQuote
|
|
529
|
+
;
|
|
530
|
+
while (icon <= maxRating) {
|
|
531
|
+
html += '<i class="' + deQuote(iconClass) + ' icon"></i>';
|
|
532
|
+
icon++;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
return html;
|
|
536
|
+
},
|
|
537
|
+
},
|
|
538
|
+
|
|
539
|
+
};
|
|
540
|
+
})(jQuery, window, document);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* # Fomantic-UI 2.9.4 - Rating
|
|
3
|
+
* https://github.com/fomantic/Fomantic-UI/
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Released under the MIT license
|
|
7
|
+
* https://opensource.org/licenses/MIT
|
|
8
|
+
*
|
|
9
|
+
*/.ui.rating{display:inline-flex;white-space:nowrap;vertical-align:baseline}.ui.rating:last-child{margin-right:0}.ui.rating .icon{padding:0;margin:0;text-align:center;font-weight:400;font-style:normal;flex:1 0 auto;cursor:pointer;width:1.25em;height:auto;transition:opacity .1s ease,background .1s ease,text-shadow .1s ease,color .1s ease;line-height:1;-webkit-backface-visibility:hidden;backface-visibility:hidden}.ui.rating .icon{background:0 0;color:rgba(0,0,0,.15)}.ui.rating .active.icon{background:0 0;color:rgba(0,0,0,.85)}.ui.rating .icon.partial.active{background:linear-gradient(to right,rgba(0,0,0,.85) 0 var(--full),rgba(0,0,0,.15) var(--full) 100%)}.ui.ui.ui.rating .icon.partial.active{-webkit-background-clip:text;background-clip:text;color:transparent;text-shadow:none}.ui.rating .icon.selected,.ui.rating .icon.selected.active,.ui.rating .icon.selected.partial.active{background:0 0;color:rgba(0,0,0,.87);background-clip:unset}.ui.primary.rating .active.icon{color:#54c8ff;text-shadow:0 -1px 0 #2185d0,-1px 0 0 #2185d0,0 1px 0 #2185d0,1px 0 0 #2185d0}.ui.primary.rating .icon.selected,.ui.primary.rating .icon.selected.active,.ui.primary.rating .icon.selected.partial.active{background:inherit;color:#21b8ff;text-shadow:0 -1px 0 #1678c2,-1px 0 0 #1678c2,0 1px 0 #1678c2,1px 0 0 #1678c2;-webkit-text-stroke:unset;background-clip:unset}.ui.primary.rating .icon.partial.active{background:linear-gradient(to right,#54c8ff 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#2185d0 .78px}.ui.secondary.rating .active.icon{color:#545454;text-shadow:0 -1px 0 #1b1c1d,-1px 0 0 #1b1c1d,0 1px 0 #1b1c1d,1px 0 0 #1b1c1d}.ui.secondary.rating .icon.selected,.ui.secondary.rating .icon.selected.active,.ui.secondary.rating .icon.selected.partial.active{background:inherit;color:#6e6e6e;text-shadow:0 -1px 0 #27292a,-1px 0 0 #27292a,0 1px 0 #27292a,1px 0 0 #27292a;-webkit-text-stroke:unset;background-clip:unset}.ui.secondary.rating .icon.partial.active{background:linear-gradient(to right,#545454 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#1b1c1d .78px}.ui.red.rating .active.icon{color:#ff695e;text-shadow:0 -1px 0 #db2828,-1px 0 0 #db2828,0 1px 0 #db2828,1px 0 0 #db2828}.ui.red.rating .icon.selected,.ui.red.rating .icon.selected.active,.ui.red.rating .icon.selected.partial.active{background:inherit;color:#ff392b;text-shadow:0 -1px 0 #d01919,-1px 0 0 #d01919,0 1px 0 #d01919,1px 0 0 #d01919;-webkit-text-stroke:unset;background-clip:unset}.ui.red.rating .icon.partial.active{background:linear-gradient(to right,#ff695e 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#db2828 .78px}.ui.orange.rating .active.icon{color:#ff851b;text-shadow:0 -1px 0 #f2711c,-1px 0 0 #f2711c,0 1px 0 #f2711c,1px 0 0 #f2711c}.ui.orange.rating .icon.selected,.ui.orange.rating .icon.selected.active,.ui.orange.rating .icon.selected.partial.active{background:inherit;color:#e76b00;text-shadow:0 -1px 0 #f26202,-1px 0 0 #f26202,0 1px 0 #f26202,1px 0 0 #f26202;-webkit-text-stroke:unset;background-clip:unset}.ui.orange.rating .icon.partial.active{background:linear-gradient(to right,#ff851b 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#f2711c .78px}.ui.yellow.rating .active.icon{color:#ffe21f;text-shadow:0 -1px 0 #fbbd08,-1px 0 0 #fbbd08,0 1px 0 #fbbd08,1px 0 0 #fbbd08}.ui.yellow.rating .icon.selected,.ui.yellow.rating .icon.selected.active,.ui.yellow.rating .icon.selected.partial.active{background:inherit;color:#ebcd00;text-shadow:0 -1px 0 #eaae00,-1px 0 0 #eaae00,0 1px 0 #eaae00,1px 0 0 #eaae00;-webkit-text-stroke:unset;background-clip:unset}.ui.yellow.rating .icon.partial.active{background:linear-gradient(to right,#ffe21f 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#fbbd08 .78px}.ui.olive.rating .active.icon{color:#d9e778;text-shadow:0 -1px 0 #b5cc18,-1px 0 0 #b5cc18,0 1px 0 #b5cc18,1px 0 0 #b5cc18}.ui.olive.rating .icon.selected,.ui.olive.rating .icon.selected.active,.ui.olive.rating .icon.selected.partial.active{background:inherit;color:#d2e745;text-shadow:0 -1px 0 #a7bd0d,-1px 0 0 #a7bd0d,0 1px 0 #a7bd0d,1px 0 0 #a7bd0d;-webkit-text-stroke:unset;background-clip:unset}.ui.olive.rating .icon.partial.active{background:linear-gradient(to right,#d9e778 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#b5cc18 .78px}.ui.green.rating .active.icon{color:#2ecc40;text-shadow:0 -1px 0 #21ba45,-1px 0 0 #21ba45,0 1px 0 #21ba45,1px 0 0 #21ba45}.ui.green.rating .icon.selected,.ui.green.rating .icon.selected.active,.ui.green.rating .icon.selected.partial.active{background:inherit;color:#1ea92e;text-shadow:0 -1px 0 #16ab39,-1px 0 0 #16ab39,0 1px 0 #16ab39,1px 0 0 #16ab39;-webkit-text-stroke:unset;background-clip:unset}.ui.green.rating .icon.partial.active{background:linear-gradient(to right,#2ecc40 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#21ba45 .78px}.ui.teal.rating .active.icon{color:#6dffff;text-shadow:0 -1px 0 #00b5ad,-1px 0 0 #00b5ad,0 1px 0 #00b5ad,1px 0 0 #00b5ad}.ui.teal.rating .icon.selected,.ui.teal.rating .icon.selected.active,.ui.teal.rating .icon.selected.partial.active{background:inherit;color:#3affff;text-shadow:0 -1px 0 #009c95,-1px 0 0 #009c95,0 1px 0 #009c95,1px 0 0 #009c95;-webkit-text-stroke:unset;background-clip:unset}.ui.teal.rating .icon.partial.active{background:linear-gradient(to right,#6dffff 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#00b5ad .78px}.ui.blue.rating .active.icon{color:#54c8ff;text-shadow:0 -1px 0 #2185d0,-1px 0 0 #2185d0,0 1px 0 #2185d0,1px 0 0 #2185d0}.ui.blue.rating .icon.selected,.ui.blue.rating .icon.selected.active,.ui.blue.rating .icon.selected.partial.active{background:inherit;color:#21b8ff;text-shadow:0 -1px 0 #1678c2,-1px 0 0 #1678c2,0 1px 0 #1678c2,1px 0 0 #1678c2;-webkit-text-stroke:unset;background-clip:unset}.ui.blue.rating .icon.partial.active{background:linear-gradient(to right,#54c8ff 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#2185d0 .78px}.ui.violet.rating .active.icon{color:#a291fb;text-shadow:0 -1px 0 #6435c9,-1px 0 0 #6435c9,0 1px 0 #6435c9,1px 0 0 #6435c9}.ui.violet.rating .icon.selected,.ui.violet.rating .icon.selected.active,.ui.violet.rating .icon.selected.partial.active{background:inherit;color:#745aff;text-shadow:0 -1px 0 #5829bb,-1px 0 0 #5829bb,0 1px 0 #5829bb,1px 0 0 #5829bb;-webkit-text-stroke:unset;background-clip:unset}.ui.violet.rating .icon.partial.active{background:linear-gradient(to right,#a291fb 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#6435c9 .78px}.ui.purple.rating .active.icon{color:#dc73ff;text-shadow:0 -1px 0 #a333c8,-1px 0 0 #a333c8,0 1px 0 #a333c8,1px 0 0 #a333c8}.ui.purple.rating .icon.selected,.ui.purple.rating .icon.selected.active,.ui.purple.rating .icon.selected.partial.active{background:inherit;color:#cf40ff;text-shadow:0 -1px 0 #9627ba,-1px 0 0 #9627ba,0 1px 0 #9627ba,1px 0 0 #9627ba;-webkit-text-stroke:unset;background-clip:unset}.ui.purple.rating .icon.partial.active{background:linear-gradient(to right,#dc73ff 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#a333c8 .78px}.ui.pink.rating .active.icon{color:#ff8edf;text-shadow:0 -1px 0 #e03997,-1px 0 0 #e03997,0 1px 0 #e03997,1px 0 0 #e03997}.ui.pink.rating .icon.selected,.ui.pink.rating .icon.selected.active,.ui.pink.rating .icon.selected.partial.active{background:inherit;color:#ff5bd1;text-shadow:0 -1px 0 #e61a8d,-1px 0 0 #e61a8d,0 1px 0 #e61a8d,1px 0 0 #e61a8d;-webkit-text-stroke:unset;background-clip:unset}.ui.pink.rating .icon.partial.active{background:linear-gradient(to right,#ff8edf 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#e03997 .78px}.ui.brown.rating .active.icon{color:#d67c1c;text-shadow:0 -1px 0 #a5673f,-1px 0 0 #a5673f,0 1px 0 #a5673f,1px 0 0 #a5673f}.ui.brown.rating .icon.selected,.ui.brown.rating .icon.selected.active,.ui.brown.rating .icon.selected.partial.active{background:inherit;color:#b0620f;text-shadow:0 -1px 0 #975b33,-1px 0 0 #975b33,0 1px 0 #975b33,1px 0 0 #975b33;-webkit-text-stroke:unset;background-clip:unset}.ui.brown.rating .icon.partial.active{background:linear-gradient(to right,#d67c1c 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#a5673f .78px}.ui.grey.rating .active.icon{color:#dcddde;text-shadow:0 -1px 0 #767676,-1px 0 0 #767676,0 1px 0 #767676,1px 0 0 #767676}.ui.grey.rating .icon.selected,.ui.grey.rating .icon.selected.active,.ui.grey.rating .icon.selected.partial.active{background:inherit;color:#c2c4c5;text-shadow:0 -1px 0 #838383,-1px 0 0 #838383,0 1px 0 #838383,1px 0 0 #838383;-webkit-text-stroke:unset;background-clip:unset}.ui.grey.rating .icon.partial.active{background:linear-gradient(to right,#dcddde 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#767676 .78px}.ui.black.rating .active.icon{color:#545454;text-shadow:0 -1px 0 #1b1c1d,-1px 0 0 #1b1c1d,0 1px 0 #1b1c1d,1px 0 0 #1b1c1d}.ui.black.rating .icon.selected,.ui.black.rating .icon.selected.active,.ui.black.rating .icon.selected.partial.active{background:inherit;color:#000;text-shadow:0 -1px 0 #27292a,-1px 0 0 #27292a,0 1px 0 #27292a,1px 0 0 #27292a;-webkit-text-stroke:unset;background-clip:unset}.ui.black.rating .icon.partial.active{background:linear-gradient(to right,#545454 0 var(--full),rgba(0,0,0,.15) var(--full) 100%);-webkit-text-stroke:#1b1c1d .78px}.ui.disabled.rating .icon{cursor:default;pointer-events:none}.ui.rating.selected .active.icon{opacity:1}.ui.rating .icon.selected,.ui.rating.selected .icon.selected{opacity:1}.ui.rating{font-size:1rem}.ui.mini.rating{font-size:.78571429rem}.ui.tiny.rating{font-size:.85714286rem}.ui.small.rating{font-size:.92857143rem}.ui.large.rating{font-size:1.14285714rem}.ui.big.rating{font-size:1.28571429rem}.ui.huge.rating{font-size:1.42857143rem}.ui.massive.rating{font-size:2rem}
|
|
@@ -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 2025 Contributors
|
|
7
|
+
* Released under the MIT license
|
|
8
|
+
* https://opensource.org/licenses/MIT
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
!function(A,e){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,A.fn.rating=function(f){var p,b=A(this),h=Date.now(),y=[],C=f,x="string"==typeof C,R=[].slice.call(arguments,1);return b.each(function(){var e,a=A.isPlainObject(f)?A.extend(!0,{},A.fn.rating.settings,f):A.extend({},A.fn.rating.settings),n=a.namespace,o=a.className,l=a.error,t=a.metadata,i=a.selector,r=a.cssVars,s="."+n,c="module-"+n,d=this,u=A(this).data(c),g=A(this),v=g.find(i.icon),m={initialize:function(){m.verbose("Initializing rating module",a),0===v.length&&m.setup.layout(),a.interactive&&!m.is.disabled()?m.enable():m.disable(),m.set.initialLoad(),m.set.rating(m.get.initialRating()),m.remove.initialLoad(),m.instantiate()},instantiate:function(){m.verbose("Instantiating module",a),u=m,g.data(c,m)},destroy:function(){m.verbose("Destroying previous instance",u),m.remove.events(),g.removeData(c)},refresh:function(){v=g.find(i.icon)},setup:{layout:function(){var e=m.get.maxRating(),n=m.get.icon(),e=A.fn.rating.settings.templates.icon(e,n);m.debug("Generating icon html dynamically"),g.html(e),m.refresh()}},event:{mouseenter:function(){var e=A(this);e.nextAll().removeClass(o.selected),g.addClass(o.selected),e.addClass(o.selected).prevAll().addClass(o.selected)},mouseleave:function(){g.removeClass(o.selected),v.removeClass(o.selected)},click:function(){var e=A(this),n=m.get.rating(),e=v.index(e)+1;("auto"===a.clearable?1===v.length:a.clearable)&&n===e?m.clearRating():m.set.rating(e)}},clearRating:function(){m.debug("Clearing current rating"),m.set.rating(0)},bind:{events:function(){m.verbose("Binding events"),g.on("mouseenter"+s,i.icon,m.event.mouseenter).on("mouseleave"+s,i.icon,m.event.mouseleave).on("click"+s,i.icon,m.event.click)}},remove:{events:function(){m.verbose("Removing events"),g.off(s)},initialLoad:function(){e=!1}},enable:function(){m.debug("Setting rating to interactive mode"),m.bind.events(),g.removeClass(o.disabled)},disable:function(){m.debug("Setting rating to read-only mode"),m.remove.events(),g.addClass(o.disabled)},is:{initialLoad:function(){return e},disabled:function(){return g.hasClass(o.disabled)}},get:{icon:function(){var e=g.data(t.icon);return e&&g.removeData(t.icon),e||a.icon},initialRating:function(){return void 0!==g.data(t.rating)?(g.removeData(t.rating),g.data(t.rating)):a.initialRating},maxRating:function(){return void 0!==g.data(t.maxRating)?(g.removeData(t.maxRating),g.data(t.maxRating)):a.maxRating},rating:function(){var e=v.filter("."+o.active).length;return m.verbose("Current rating retrieved",e),e}},set:{rating:function(e){var n=Math.floor(0<=e-1?e-1:0),n=v.eq(n),t=e<=1?n:n.next(),i=e%1*100;g.removeClass(o.selected),v.removeClass(o.selected).removeClass(o.active).removeClass(o.partiallyActive),0<e&&(m.verbose("Setting current rating to",e),n.prevAll().addBack().addClass(o.active),n.next()&&e%1!=0&&(t.addClass(o.partiallyActive).addClass(o.active),t.css(r.filledCustomPropName,i+"%"),"transparent"===t.css("backgroundColor")&&t.removeClass(o.partiallyActive).removeClass(o.active))),m.is.initialLoad()||a.onRate.call(d,e)},initialLoad:function(){e=!0}},setting:function(e,n){if(m.debug("Changing setting",e,n),A.isPlainObject(e))A.extend(!0,a,e);else{if(void 0===n)return a[e];A.isPlainObject(a[e])?A.extend(!0,a[e],n):a[e]=n}},internal:function(e,n){if(A.isPlainObject(e))A.extend(!0,m,e);else{if(void 0===n)return m[e];m[e]=n}},debug:function(){!a.silent&&a.debug&&(a.performance?m.performance.log(arguments):(m.debug=Function.prototype.bind.call(console.info,console,a.name+":"),m.debug.apply(console,arguments)))},verbose:function(){!a.silent&&a.verbose&&a.debug&&(a.performance?m.performance.log(arguments):(m.verbose=Function.prototype.bind.call(console.info,console,a.name+":"),m.verbose.apply(console,arguments)))},error:function(){a.silent||(m.error=Function.prototype.bind.call(console.error,console,a.name+":"),m.error.apply(console,arguments))},performance:{log:function(e){var n,t;a.performance&&(t=(n=Date.now())-(h||n),h=n,y.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:d,"Execution Time":t})),clearTimeout(m.performance.timer),m.performance.timer=setTimeout(function(){m.performance.display()},500)},display:function(){var e=a.name+":",t=0;h=!1,clearTimeout(m.performance.timer),A.each(y,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",1<b.length&&(e+=" ("+b.length+")"),0<y.length&&(console.groupCollapsed(e),console.table?console.table(y):A.each(y,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),y=[]}},invoke:function(i,e,n){var a,o,t,r,s=u;return e=e||R,n=n||d,"string"==typeof i&&void 0!==s&&(i=i.split(/[ .]/),a=i.length-1,A.each(i,function(e,n){var t=e!==a?n+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(A.isPlainObject(s[t])&&e!==a)s=s[t];else{if(void 0!==s[t])return o=s[t],!1;{if(!A.isPlainObject(s[n])||e===a)return void 0!==s[n]?o=s[n]:m.error(l.method,i),!1;s=s[n]}}})),"function"==typeof(r=o)&&"number"!=typeof r.nodeType?t=o.apply(n,e):void 0!==o&&(t=o),Array.isArray(p)?p.push(t):void 0!==p?p=[p,t]:void 0!==t&&(p=t),o}};x?(void 0===u&&m.initialize(),m.invoke(C)):(void 0!==u&&u.invoke("destroy"),m.initialize())}),void 0!==p?p:this},A.fn.rating.settings={name:"Rating",namespace:"rating",icon:"star",silent:!1,debug:!1,verbose:!1,performance:!0,initialRating:0,interactive:!0,maxRating:4,clearable:"auto",fireOnInit:!1,onRate:function(e){},error:{method:"The method you called is not defined"},metadata:{rating:"rating",maxRating:"maxRating",icon:"icon"},className:{active:"active",disabled:"disabled",selected:"selected",loading:"loading",partiallyActive:"partial"},cssVars:{filledCustomPropName:"--full"},selector:{icon:".icon"},templates:{deQuote:function(e,n){return String(e).replace(/"/g,n?""":"")},icon:function(e,n){for(var t=1,i="",a=A.fn.rating.settings.templates.deQuote;t<=e;)i+='<i class="'+a(n)+' icon"></i>',t++;return i}}}}(jQuery,window,document);
|