head
:+ function applyTheme() {
+ const isDark = (localStorage.getItem('is-dark-theme') ?? 'true') === 'true';
+ if (isDark) {
+ document.body.classList.remove('light-mode');
+ document.body.classList.add('dark-mode');
+ } else {
+ document.body.classList.remove('dark-mode');
+ document.body.classList.add('light-mode');
+ }
+ }
- var dark = true;
function themeChange() {
- var element = document.body;
-
- if (dark == true) {
- element.classList.remove("dark-mode");
- element.classList.add("light-mode");
- dark = false;
- }
-
- else {
- element.classList.remove("light-mode");
- element.classList.add("dark-mode");
- dark = true;
- }
+ localStorage.setItem('is-dark-theme', !((localStorage.getItem('is-dark-theme') ?? 'true') === 'true'));
+ applyTheme();
}
+ window.addEventListener('DOMContentLoaded', function () {
+ applyTheme();
+ });
intlTelInput(document.querySelector('#user-phone'), {
initialCountry: 'auto',
separateDialCode: true,
geoIpLookup: function (callback) {
fetch('https://ipinfo.io/json')
.then(response => response.json())
.then(data => callback(data && data.country ? data.country : 'us'));
}
});
document.querySelectorAll('[data-seen-params]').forEach(element => {
try {
const entry = JSON.parse(element.dataset.seenParams);
if (entry?.type === 'GIFT' && 'price' in entry?.data) {
element.remove():
}
} catch (error) {}
});
const swiper_1 = new Swiper('.swiper-1', {
slidesPerView: 3,
spaceBetween: 30,
loop: true,
centeredSlides: true,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}
});
const swiper_2 = new Swiper('.swiper-2', {
slidesPerView: 1,
loop: true
});
const swipeAllSliders = (index) => {
swiper_1.slideToLoop(index);
swiper_2.slideToLoop(index);
};
swiper_1.on('slideChange', () => swipeAllSliders(swiper_1.realIndex));
swiper_2.on('slideChange', () => swipeAllSliders(swiper_2.realIndex));
React.useEffect(() => {
(async () => {
try {
const themes = await fetch("/arr").then((data) => data.json());
const activeTheme = Math.floor(themes.length / 2);
const activePlace = Math.floor(themes[activeTheme].subtopics.length / 2);
setThemes(themes);
setActiveTheme(activeTheme);
setActivePlace(activePlace);
} finally {
setIsLoad(false);
}
})();
}, []);
npm i create-react-app -g
create-react-app my-app