|
10 | 10 | }); |
11 | 11 |
|
12 | 12 | function applyAnimations() { |
13 | | - const enabled = Lampa.Storage.get('maxsm_themes_animations', 'true') === 'true'; |
14 | | - const styleId = '#accent_color_animations'; |
15 | | - |
16 | | - // Видаляємо попередній стиль, якщо є |
17 | | - $(styleId).remove(); |
| 13 | + const enabled = localStorage.getItem('maxsm_themes_animations') === 'true'; |
| 14 | + $('#maxsm_themes_animations').remove(); |
18 | 15 |
|
19 | 16 | if (enabled) { |
20 | 17 | const css = ` |
21 | | - <style id="accent_color_animations"> |
| 18 | + <style id="maxsm_themes_animations"> |
22 | 19 | .card, .torrent-item, .online-prestige, .extensions__item, .extensions__block-add, |
23 | 20 | .full-review-add, .full-review, .tag-count, .full-person, .full-episode, |
24 | 21 | .simple-button, .full-start__button, .items-cards .selector, .card-more, |
|
46 | 43 | } |
47 | 44 |
|
48 | 45 | function initAnimationsSetting() { |
| 46 | + // якщо параметр ще не збережений у localStorage — встановлюємо значення за замовчуванням |
| 47 | + if (localStorage.getItem('maxsm_themes_animations') === null) { |
| 48 | + localStorage.setItem('maxsm_themes_animations', 'true'); |
| 49 | + } |
| 50 | + |
49 | 51 | Lampa.SettingsApi.addParam({ |
50 | 52 | component: 'accent_color_plugin', |
51 | 53 | param: { |
52 | 54 | name: 'maxsm_themes_animations', |
53 | 55 | type: 'trigger', |
54 | | - default: true |
| 56 | + default: localStorage.getItem('maxsm_themes_animations') === 'true' |
55 | 57 | }, |
56 | 58 | field: { |
57 | 59 | name: Lampa.Lang.translate('maxsm_themes_animations'), |
58 | | - description: Lampa.Lang.translate('Увімкнути або вимкнути анімації при навігації в інтерфейсі.') |
| 60 | + description: Lampa.Lang.translate('Увімкнути або вимкнути анімації при навігації інтерфейсом.') |
59 | 61 | }, |
60 | 62 | onChange: function (value) { |
61 | | - Lampa.Storage.set('maxsm_themes_animations', value ? 'true' : 'false'); |
| 63 | + localStorage.setItem('maxsm_themes_animations', value ? 'true' : 'false'); |
62 | 64 | applyAnimations(); |
63 | 65 | } |
64 | 66 | }); |
|
0 commit comments