|
65 | 65 | var rgb = getFilterRgb(mainColor); |
66 | 66 | var filterValue = hasOwnFilter ? '' : 'url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cfilter id=%22color%22 color-interpolation-filters=%22sRGB%22%3E%3CfeColorMatrix type=%22matrix%22 values=%220 0 0 0 ' + (rgb.r / 255) + ' 0 0 0 0 ' + (rgb.g / 255) + ' 0 0 0 0 ' + (rgb.b / 255) + ' 0 0 0 1 0%22/%3E%3C/filter%3E%3C/svg%3E#color")'; |
67 | 67 |
|
68 | | - var newStyle = |
| 68 | + var newStyle = |
69 | 69 | 'body .activity__loader { display: none !important; background-image: none !important; }' + |
70 | | - 'body .activity__loader.active {' + |
71 | | - 'display: block !important;' + |
72 | | - 'position: fixed !important;' + |
73 | | - 'left: 50% !important;' + |
74 | | - 'top: 50% !important;' + |
75 | | - 'transform: translate(-50%, -50%) !important;' + |
76 | | - 'width: 108px !important;' + |
77 | | - 'height: 108px !important;' + |
78 | | - 'background-image: url(\'' + escapedUrl + '\') !important;' + |
79 | | - 'background-repeat: no-repeat !important;' + |
80 | | - 'background-position: center !important;' + |
81 | | - 'background-size: contain !important;' + |
82 | | - 'filter: ' + filterValue + ' !important;' + |
83 | | - 'z-index: 9999 !important;' + |
84 | | - '}' + |
85 | | - 'body .player-video__loader.custom::before {' + |
86 | | - 'content: "" !important;' + |
87 | | - 'position: absolute !important;' + |
88 | | - 'left: 50% !important; top: 50% !important;' + |
89 | | - 'transform: translate(-50%, -50%) !important;' + |
90 | | - 'width: 80px !important; height: 80px !important;' + |
91 | | - 'background: url(\'' + escapedUrl + '\') center/contain no-repeat !important;' + |
92 | | - 'filter: ' + filterValue + ' !important;' + |
93 | | - 'z-index: 9999 !important;' + |
94 | | - 'pointer-events: none;' + |
95 | | - '}' + |
| 70 | + 'body .activity__loader.active { display: block !important; position: fixed !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; width: 108px !important; height: 108px !important; background-image: url(\'' + escapedUrl + '\') !important; background-repeat: no-repeat !important; background-position: center !important; background-size: contain !important; filter: ' + filterValue + ' !important; z-index: 9999 !important; }' + |
| 71 | + 'body .player-video__loader.custom::before { content: "" !important; position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; width: 80px !important; height: 80px !important; background: url(\'' + escapedUrl + '\') center/contain no-repeat !important; filter: ' + filterValue + ' !important; z-index: 9999 !important; pointer-events: none; }' + |
96 | 72 | 'body .player-video__loader.custom { background-image: none !important; }' + |
97 | | - 'body .lampac-balanser-loader.custom, body .loading-layer__ico.custom, body .modal-loading.custom {' + |
98 | | - 'background-image: url(\'' + escapedUrl + '\') !important;' + |
99 | | - 'background-repeat: no-repeat !important;' + |
100 | | - 'background-position: center !important;' + |
101 | | - 'background-size: contain !important;' + |
102 | | - 'background-color: transparent !important;' + |
103 | | - 'filter: ' + filterValue + ' !important;' + |
104 | | - '}' + |
105 | | - 'body .player-video__youtube-needclick > div.custom {' + |
106 | | - 'position: absolute !important; left: 50% !important; top: 50% !important;' + |
107 | | - 'transform: translate(-50%, -50%) !important; width: 8em !important; height: 8em !important;' + |
108 | | - 'background: url(\'' + escapedUrl + '\') center/contain no-repeat !important;' + |
109 | | - 'filter: ' + filterValue + ' !important; text-indent: -9999px !important; z-index: 9999 !important;' + |
110 | | - '}'; |
| 73 | + 'body .lampac-balanser-loader.custom, body .loading-layer__ico.custom, body .modal-loading.custom { background-image: url(\'' + escapedUrl + '\') !important; background-repeat: no-repeat !important; background-position: center !important; background-size: contain !important; background-color: transparent !important; filter: ' + filterValue + ' !important; }' + |
| 74 | + 'body .player-video__youtube-needclick > div.custom { position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; width: 8em !important; height: 8em !important; background: url(\'' + escapedUrl + '\') center/contain no-repeat !important; filter: ' + filterValue + ' !important; text-indent: -9999px !important; z-index: 9999 !important; }'; |
111 | 75 |
|
112 | 76 | $('<style id="aniload-id">' + newStyle + '</style>').appendTo('head'); |
113 | 77 | $('.player-video__loader, .lampac-balanser-loader, .loading-layer__ico, .modal-loading, .player-video__youtube-needclick > div').addClass('custom'); |
|
139 | 103 | glassFilterValue = whiteFilter; |
140 | 104 | } |
141 | 105 |
|
142 | | - var glassStyle = glassFilterValue ? |
143 | | - 'body.glass--style .settings-param.focus .settings-folder__icon .activity__loader_prv {' + |
144 | | - 'filter: ' + glassFilterValue + ' !important;' + |
145 | | - '-webkit-filter: ' + glassFilterValue + ' !important;' + |
146 | | - '}' : ''; |
| 106 | + var glassStyle = glassFilterValue ? 'body.glass--style .settings-param.focus .settings-folder__icon .activity__loader_prv { filter: ' + glassFilterValue + ' !important; -webkit-filter: ' + glassFilterValue + ' !important; }' : ''; |
147 | 107 |
|
148 | | - var newStyle = '.settings-param[data-name="select_ani_mation"] .activity__loader_prv {' + |
149 | | - 'display: inline-block; width: 23px; height: 24px; margin-right: 10px; vertical-align: middle;' + |
150 | | - 'background: url(\'' + escapedUrl + '\') no-repeat 50% 50%; background-size: contain; background-color: transparent !important;' + |
151 | | - 'filter: ' + prvFilterValue + ' !important; -webkit-filter: ' + prvFilterValue + ' !important;' + |
152 | | - '}' + glassStyle; |
| 108 | + var newStyle = '.settings-param[data-name="select_ani_mation"] .activity__loader_prv { display: inline-block; width: 23px; height: 24px; margin-right: 10px; vertical-align: middle; background: url(\'' + escapedUrl + '\') no-repeat 50% 50%; background-size: contain; background-color: transparent !important; filter: ' + prvFilterValue + ' !important; -webkit-filter: ' + prvFilterValue + ' !important; }' + glassStyle; |
153 | 109 |
|
154 | 110 | $('<style id="aniload-id-prv">' + newStyle + '</style>').appendTo('head'); |
155 | 111 | } |
|
227 | 183 | }, |
228 | 184 | onChange: function () { |
229 | 185 | if (!window.svg_loaders || window.svg_loaders.length === 0) return; |
| 186 | + |
230 | 187 | create_ani_modal(); |
| 188 | + |
231 | 189 | var groupedLoaders = []; |
232 | | - for (var i = 0; i < window.svg_loaders.length; i += 6) groupedLoaders.push(window.svg_loaders.slice(i, i + 6)); |
| 190 | + for (var i = 0; i < window.svg_loaders.length; i += 6) { |
| 191 | + groupedLoaders.push(window.svg_loaders.slice(i, i + 6)); |
| 192 | + } |
| 193 | + |
233 | 194 | var svgContent = groupedLoaders.map(function(group, groupIndex) { |
234 | 195 | return '<div class="ani_loader_row">' + group.map(function(loader, index) { |
235 | 196 | return '<div class="ani_loader_square selector" tabindex="0" title="Loader ' + (groupIndex * 6 + index + 1) + '"><img src="' + loader + '"></div>'; |
236 | 197 | }).join('') + '</div>'; |
237 | 198 | }).join(''); |
| 199 | + |
238 | 200 | var defaultLoader = applyDefaultLoaderColor(); |
239 | 201 | var defaultButton = '<div class="ani_loader_square selector default" tabindex="0" title="' + Lampa.Lang.translate('default_loader') + '"><img src="' + defaultLoader.src + '"></div>'; |
| 202 | + |
240 | 203 | var svgValue = Lampa.Storage.get('ani_load_custom_svg', '') || 'Наприклад https://example.com/loader.svg'; |
241 | 204 | var inputHtml = '<div class="ani_loader_square selector svg_input" tabindex="0" style="width: 252px;"><div class="label">' + Lampa.Lang.translate('custom_svg_input') + '</div><div class="value">' + svgValue + '</div></div>'; |
| 205 | + |
242 | 206 | var topRowHtml = '<div style="display: flex; gap: 20px; padding: 0; justify-content: center; margin-bottom: 25px;">' + defaultButton + inputHtml + '</div>'; |
| 207 | + |
243 | 208 | var modalHtml = $('<div>' + topRowHtml + '<div class="ani_picker_container">' + svgContent + '</div></div>'); |
244 | 209 |
|
245 | 210 | Lampa.Modal.open({ |
|
252 | 217 | Lampa.Controller.toggle('settings_component'); |
253 | 218 | Lampa.Controller.enable('menu'); |
254 | 219 | }, |
255 | | - onSelect: function (element) { |
256 | | - if (!element.length || !(element[0] instanceof HTMLElement)) return; |
257 | | - var selected = element[0]; |
| 220 | + onSelect: function (elements) { |
| 221 | + if (!elements || elements.length === 0) return; |
| 222 | + |
| 223 | + var selected = elements[0]; |
| 224 | + |
258 | 225 | if (selected.classList.contains('svg_input')) { |
259 | 226 | Lampa.Noty.show(Lampa.Lang.translate('svg_input_hint')); |
260 | 227 | Lampa.Modal.close(); |
|
274 | 241 | Lampa.Storage.set('ani_load_custom_svg', value); |
275 | 242 | Lampa.Storage.set('ani_load', value); |
276 | 243 | applyCurrentLoader(); |
| 244 | + Lampa.Controller.toggle('settings_component'); |
| 245 | + Lampa.Controller.enable('menu'); |
277 | 246 | }); |
278 | 247 | return; |
279 | 248 | } |
| 249 | + |
280 | 250 | if (selected.classList.contains('default')) { |
281 | 251 | Lampa.Storage.set('ani_load', ''); |
282 | 252 | } else { |
283 | 253 | var img = selected.querySelector('img'); |
284 | 254 | Lampa.Storage.set('ani_load', img ? img.src : ''); |
285 | 255 | } |
| 256 | + |
286 | 257 | applyCurrentLoader(); |
| 258 | + |
| 259 | + // Флеш для підтвердження вибору |
| 260 | + var flashElement = document.querySelector('.activity__loader'); |
| 261 | + if (flashElement) { |
| 262 | + flashElement.classList.add('active'); |
| 263 | + flashElement.style.display = 'block'; |
| 264 | + setTimeout(function () { |
| 265 | + flashElement.classList.remove('active'); |
| 266 | + flashElement.style.display = 'none'; |
| 267 | + }, 500); |
| 268 | + } |
| 269 | + |
287 | 270 | Lampa.Modal.close(); |
288 | 271 | Lampa.Controller.toggle('settings_component'); |
289 | 272 | Lampa.Controller.enable('menu'); |
|
0 commit comments