class Config { static get themes() { return { defaultHeader: '/css/header-dark.css', defaultMain: '/css/main-dark.css', lightHeader: '/css/header-light.css', lightMain: '/css/main-light.css', }; } static get images() { return [ '/image/screen/one.png', '/image/screen/two.png', '/image/screen/three.png', '/image/screen/four.png', '/image/screen/five.png' ]; } } class Theme { constructor() { this.headerThemeLink = $('#theme-header-stylesheet'); this.mainThemeLink = $('#theme-main-stylesheet'); this.logo = $('.logo'); this.menuButton = $('#menu-button'); this.changeThemeButton = $('#change-theme-button'); this.init(); } init() { this.loadThemes(); this.updateImageSources(this.getCurrentHeaderTheme()); } loadThemes() { const savedHeaderTheme = localStorage.getItem('theme_header') || Config.themes.defaultHeader; const savedMainTheme = localStorage.getItem('theme_main') || Config.themes.defaultMain; this.headerThemeLink.attr('href', savedHeaderTheme); this.mainThemeLink.attr('href', savedMainTheme); } getCurrentHeaderTheme() { return this.headerThemeLink.attr('href'); } toggleTheme() { const currentHeaderTheme = this.getCurrentHeaderTheme(); const newHeaderTheme = currentHeaderTheme === Config.themes.lightHeader ? Config.themes.defaultHeader : Config.themes.lightHeader; const newMainTheme = currentHeaderTheme === Config.themes.lightHeader ? Config.themes.defaultMain : Config.themes.lightMain; this.headerThemeLink.attr('href', newHeaderTheme); this.mainThemeLink.attr('href', newMainTheme); this.updateImageSources(newHeaderTheme); localStorage.setItem('theme_header', newHeaderTheme); localStorage.setItem('theme_main', newMainTheme); } updateImageSources(headerTheme) { if (headerTheme === Config.themes.defaultHeader) { this.menuButton.attr('src', '/image/icon/menu-light.png'); this.changeThemeButton.attr('src', '/image/icon/change-theme-light.png'); this.logo.attr('src', '/image/logo-light.png'); } else { this.menuButton.attr('src', '/image/icon/menu-dark.png'); this.changeThemeButton.attr('src', '/image/icon/change-theme-dark.png'); this.logo.attr('src', '/image/logo-dark.png'); } } } class Navigation { constructor(theme) { this.header = $('header'); this.navigationButtons = $('.navigation-button'); this.menuButton = $('#menu-button'); this.changeThemeButton = $('#change-theme-button'); this.closeButton = $('#close-button'); this.telegramButton = $('#telegram-button'); this.whatsappButton = $('#whatsapp-button'); this.menu = $('.menu-container'); this.container = $('.container'); this.footer = $('footer'); this.theme = theme; this.init(); } init() { this.navigationButtons.on('click', (event) => this.openNavigationPage(event)); this.menuButton.on('click', () => this.showMenu()); this.changeThemeButton.on('click', () => this.theme.toggleTheme()); this.telegramButton.on('click', () => this.openTelegram()); this.whatsappButton.on('click', () => this.openWhatsApp()); this.closeButton.on('click', () => this.hideMenu()); } openNavigationPage(event) { const href = $(event.currentTarget).attr('href'); if (href) { window.location.href = href; } this.hideMenu(); } showMenu() { this.header.css('justify-content', 'right'); this.container.hide(); this.menu.css('display', 'flex'); this.menuButton.hide(); this.changeThemeButton.hide(); this.closeButton.css('display', 'flex'); this.footer.hide(); } hideMenu() { this.header.css('justify-content', 'space-between'); this.container.show(); this.menu.hide(); this.menuButton.css('display', 'flex'); this.changeThemeButton.css('display', 'flex'); this.closeButton.hide(); this.footer.show(); } openTelegram() { window.open('https://t.me/indiabullshousing', '_blank'); } openWhatsApp() { window.open('https://wa.me/919999999999', '_blank'); } } class ImageSlider { constructor() { this.currentImageIndex = 0; this.images = Config.images; this.backgroundImage = $('#background-image'); this.nextButton = $('#next-button'); this.prevButton = $('#prev-button'); this.init(); } init() { this.updateImage(); this.nextButton.on('click', () => this.nextImage()); this.prevButton.on('click', () => this.prevImage()); } updateImage() { this.backgroundImage.attr('src', this.images[this.currentImageIndex]); } nextImage() { this.currentImageIndex = (this.currentImageIndex + 1) % this.images.length; this.updateImage(); } prevImage() { this.currentImageIndex = (this.currentImageIndex - 1 + this.images.length) % this.images.length; this.updateImage(); } } class App { constructor() { this.theme = new Theme(); this.navigation = new Navigation(this.theme); this.imageSlider = new ImageSlider(); } } $(document).ready(() => { const app = new App(); });