Skip to content

Commit 5927690

Browse files
Update animations.js
1 parent 4739017 commit 5927690

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

‎animations.js‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@
1010
});
1111

1212
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();
1815

1916
if (enabled) {
2017
const css = `
21-
<style id="accent_color_animations">
18+
<style id="maxsm_themes_animations">
2219
.card, .torrent-item, .online-prestige, .extensions__item, .extensions__block-add,
2320
.full-review-add, .full-review, .tag-count, .full-person, .full-episode,
2421
.simple-button, .full-start__button, .items-cards .selector, .card-more,
@@ -46,19 +43,24 @@
4643
}
4744

4845
function initAnimationsSetting() {
46+
// якщо параметр ще не збережений у localStorage — встановлюємо значення за замовчуванням
47+
if (localStorage.getItem('maxsm_themes_animations') === null) {
48+
localStorage.setItem('maxsm_themes_animations', 'true');
49+
}
50+
4951
Lampa.SettingsApi.addParam({
5052
component: 'accent_color_plugin',
5153
param: {
5254
name: 'maxsm_themes_animations',
5355
type: 'trigger',
54-
default: true
56+
default: localStorage.getItem('maxsm_themes_animations') === 'true'
5557
},
5658
field: {
5759
name: Lampa.Lang.translate('maxsm_themes_animations'),
58-
description: Lampa.Lang.translate('Увімкнути або вимкнути анімації при навігації в інтерфейсі.')
60+
description: Lampa.Lang.translate('Увімкнути або вимкнути анімації при навігації інтерфейсом.')
5961
},
6062
onChange: function (value) {
61-
Lampa.Storage.set('maxsm_themes_animations', value ? 'true' : 'false');
63+
localStorage.setItem('maxsm_themes_animations', value ? 'true' : 'false');
6264
applyAnimations();
6365
}
6466
});

0 commit comments

Comments
 (0)