Jaouadart commited on
Commit
478cd50
·
verified ·
1 Parent(s): 622d489

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +178 -3
index.html CHANGED
@@ -24,6 +24,7 @@
24
  padding: 0;
25
  touch-action: pan-x pan-y;
26
  overflow-x: hidden; /* Prevent horizontal scroll */
 
27
  }
28
  .container {
29
  max-width: 100%;
@@ -42,6 +43,7 @@
42
  justify-content: space-between;
43
  width: 100%;
44
  margin: 0;
 
45
  }
46
  .header-item {
47
  display: flex;
@@ -115,6 +117,7 @@
115
  max-width: 150px;
116
  position: relative;
117
  overflow: hidden;
 
118
  }
119
  .interactive-card .word-label {
120
  font-family: 'Tajawal', sans-serif;
@@ -144,7 +147,7 @@
144
  z-index: 1000;
145
  display: none;
146
  opacity: 0;
147
- transition: opacity 0.5s ease-in-out;
148
  min-width: 250px;
149
  }
150
  .message-box.visible {
@@ -170,6 +173,7 @@
170
  border-radius: 0.5rem;
171
  z-index: 15;
172
  text-shadow: none;
 
173
  }
174
  .letter-badge {
175
  font-family: 'Tifinagh', sans-serif;
@@ -198,6 +202,7 @@
198
  transition: 0.5s;
199
  padding-top: 60px;
200
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.2);
 
201
  }
202
  .sidebar a {
203
  padding: 8px 8px 8px 32px;
@@ -258,7 +263,7 @@
258
  font-weight: bold;
259
  text-align: center;
260
  cursor: pointer;
261
- transition: transform 0.2s, box-shadow 0.2s;
262
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
263
  }
264
 
@@ -517,6 +522,34 @@
517
  .color-card:hover {
518
  transform: scale(1.05);
519
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  </style>
521
  </head>
522
  <body>
@@ -526,6 +559,8 @@
526
  <div id="message-content"></div>
527
  </div>
528
 
 
 
529
  <div id="sidebar" class="sidebar">
530
  <a href="javascript:void(0)" class="closebtn" onclick="closeSidebar()">&times;</a>
531
  <ul class="sidebar-links">
@@ -555,6 +590,111 @@
555
  let currentPage = 'main';
556
  let currentGame = null;
557
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
558
  // Data for different pages
559
  const tifinaghData = [
560
  { letter: 'ⴰ', word: 'ⴰⵎⴰⵏ', image: 'https://source.unsplash.com/400x400/?water', audio: 'audio/aman.mp3' },
@@ -889,6 +1029,33 @@
889
  currentGame = null;
890
  renderPage();
891
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
892
 
893
  // Sidebar functions
894
  function openSidebar() {
@@ -941,6 +1108,9 @@
941
  } else if (currentGame === 'shadow') {
942
  renderShadowGame(appContainer);
943
  }
 
 
 
944
  }
945
 
946
  // Header Creation
@@ -956,7 +1126,12 @@
956
  </button>
957
  </div>
958
  <div class="header-title">نجاح - Amurs</div>
959
- <div class="header-item">
 
 
 
 
 
960
  <button class="text-white" onclick="goBack()">
961
  <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-white" viewBox="0 0 24 24" fill="currentColor">
962
  <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
 
24
  padding: 0;
25
  touch-action: pan-x pan-y;
26
  overflow-x: hidden; /* Prevent horizontal scroll */
27
+ transition: background-color 0.5s ease;
28
  }
29
  .container {
30
  max-width: 100%;
 
43
  justify-content: space-between;
44
  width: 100%;
45
  margin: 0;
46
+ transition: background-color 0.5s ease;
47
  }
48
  .header-item {
49
  display: flex;
 
117
  max-width: 150px;
118
  position: relative;
119
  overflow: hidden;
120
+ transition: background-color 0.5s ease;
121
  }
122
  .interactive-card .word-label {
123
  font-family: 'Tajawal', sans-serif;
 
147
  z-index: 1000;
148
  display: none;
149
  opacity: 0;
150
+ transition: opacity 0.5s ease-in-out, background-color 0.5s ease;
151
  min-width: 250px;
152
  }
153
  .message-box.visible {
 
173
  border-radius: 0.5rem;
174
  z-index: 15;
175
  text-shadow: none;
176
+ transition: background-color 0.5s ease, color 0.5s ease;
177
  }
178
  .letter-badge {
179
  font-family: 'Tifinagh', sans-serif;
 
202
  transition: 0.5s;
203
  padding-top: 60px;
204
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.2);
205
+ transition: background-color 0.5s ease;
206
  }
207
  .sidebar a {
208
  padding: 8px 8px 8px 32px;
 
263
  font-weight: bold;
264
  text-align: center;
265
  cursor: pointer;
266
+ transition: transform 0.2s, box-shadow 0.2s, background-color 0.5s ease, color 0.5s ease;
267
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
268
  }
269
 
 
522
  .color-card:hover {
523
  transform: scale(1.05);
524
  }
525
+
526
+ /* Color Picker Pop-up */
527
+ .color-picker {
528
+ position: fixed;
529
+ top: 50%;
530
+ left: 50%;
531
+ transform: translate(-50%, -50%);
532
+ background-color: white;
533
+ padding: 1.5rem;
534
+ border-radius: 1rem;
535
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
536
+ z-index: 1002;
537
+ display: none;
538
+ flex-wrap: wrap;
539
+ gap: 1rem;
540
+ }
541
+ .color-swatch {
542
+ width: 40px;
543
+ height: 40px;
544
+ border-radius: 50%;
545
+ cursor: pointer;
546
+ transition: transform 0.2s;
547
+ border: 2px solid transparent;
548
+ }
549
+ .color-swatch:hover {
550
+ transform: scale(1.1);
551
+ border: 2px solid #555;
552
+ }
553
  </style>
554
  </head>
555
  <body>
 
559
  <div id="message-content"></div>
560
  </div>
561
 
562
+ <div id="color-picker" class="color-picker"></div>
563
+
564
  <div id="sidebar" class="sidebar">
565
  <a href="javascript:void(0)" class="closebtn" onclick="closeSidebar()">&times;</a>
566
  <ul class="sidebar-links">
 
590
  let currentPage = 'main';
591
  let currentGame = null;
592
 
593
+ // --- THEMES ---
594
+ const themes = {
595
+ 'amurs': {
596
+ bg: '#F0F4C3',
597
+ primary: '#263238',
598
+ accent: '#FFB74D',
599
+ cardText: '#263238',
600
+ },
601
+ 'blue': {
602
+ bg: '#E3F2FD',
603
+ primary: '#1565C0',
604
+ accent: '#FFC107',
605
+ cardText: '#1565C0',
606
+ },
607
+ 'green': {
608
+ bg: '#E8F5E9',
609
+ primary: '#2E7D32',
610
+ accent: '#C5E1A5',
611
+ cardText: '#2E7D32',
612
+ },
613
+ 'purple': {
614
+ bg: '#EDE7F6',
615
+ primary: '#512DA8',
616
+ accent: '#D1C4E9',
617
+ cardText: '#512DA8',
618
+ },
619
+ 'orange': {
620
+ bg: '#FFF3E0',
621
+ primary: '#E65100',
622
+ accent: '#FFB74D',
623
+ cardText: '#E65100',
624
+ },
625
+ 'pink': {
626
+ bg: '#FCE4EC',
627
+ primary: '#AD1457',
628
+ accent: '#F48FB1',
629
+ cardText: '#AD1457',
630
+ },
631
+ 'gray': {
632
+ bg: '#ECEFF1',
633
+ primary: '#455A64',
634
+ accent: '#B0BEC5',
635
+ cardText: '#455A64',
636
+ }
637
+ };
638
+
639
+ function applyTheme(themeName) {
640
+ const theme = themes[themeName];
641
+ const root = document.documentElement;
642
+
643
+ // Update CSS variables if needed, or directly update element styles
644
+ document.body.style.backgroundColor = theme.bg;
645
+ document.querySelector('.header').style.backgroundColor = theme.primary;
646
+ document.querySelector('.sidebar').style.backgroundColor = theme.primary;
647
+
648
+ // Update buttons and badges
649
+ const interactiveCards = document.querySelectorAll('.interactive-card');
650
+ interactiveCards.forEach(card => card.style.backgroundColor = theme.primary);
651
+
652
+ const badges = document.querySelectorAll('.number-badge, .letter-badge');
653
+ badges.forEach(badge => {
654
+ badge.style.backgroundColor = theme.accent;
655
+ badge.style.color = theme.primary;
656
+ });
657
+
658
+ const bottomButtons = document.querySelectorAll('.bottom-button');
659
+ bottomButtons.forEach(btn => {
660
+ btn.style.backgroundColor = theme.accent;
661
+ btn.style.color = theme.primary;
662
+ });
663
+
664
+ const gameButtons = document.querySelectorAll('.game-button');
665
+ gameButtons.forEach(btn => {
666
+ btn.style.backgroundColor = theme.primary;
667
+ btn.style.color = 'white';
668
+ });
669
+
670
+ const optionButtons = document.querySelectorAll('.option-button');
671
+ optionButtons.forEach(btn => {
672
+ btn.style.backgroundColor = theme.accent;
673
+ btn.style.color = theme.primary;
674
+ });
675
+
676
+ const cards = document.querySelectorAll('.card');
677
+ cards.forEach(card => {
678
+ card.querySelector('.card-text').style.color = theme.primary;
679
+ });
680
+
681
+ // Update text colors for dynamic content
682
+ const dynamicText = document.querySelectorAll('.text-2xl, .text-xl, .story-text');
683
+ dynamicText.forEach(text => {
684
+ text.style.color = theme.primary;
685
+ });
686
+
687
+ const messageBox = document.getElementById('message-box');
688
+ if (messageBox) {
689
+ messageBox.style.backgroundColor = theme.primary;
690
+ }
691
+
692
+ // Re-render the current page to apply changes consistently
693
+ renderPage();
694
+ }
695
+
696
+ // --- END THEMES ---
697
+
698
  // Data for different pages
699
  const tifinaghData = [
700
  { letter: 'ⴰ', word: 'ⴰⵎⴰⵏ', image: 'https://source.unsplash.com/400x400/?water', audio: 'audio/aman.mp3' },
 
1029
  currentGame = null;
1030
  renderPage();
1031
  }
1032
+
1033
+ // Color Picker functions
1034
+ function toggleColorPicker() {
1035
+ const picker = document.getElementById('color-picker');
1036
+ if (picker.style.display === 'flex') {
1037
+ picker.style.display = 'none';
1038
+ } else {
1039
+ picker.style.display = 'flex';
1040
+ renderColorPicker();
1041
+ }
1042
+ }
1043
+
1044
+ function renderColorPicker() {
1045
+ const picker = document.getElementById('color-picker');
1046
+ picker.innerHTML = '';
1047
+ for (const theme in themes) {
1048
+ const swatch = document.createElement('div');
1049
+ swatch.className = 'color-swatch';
1050
+ swatch.style.backgroundColor = themes[theme].primary;
1051
+ swatch.dataset.theme = theme;
1052
+ swatch.onclick = () => {
1053
+ applyTheme(theme);
1054
+ toggleColorPicker();
1055
+ };
1056
+ picker.appendChild(swatch);
1057
+ }
1058
+ }
1059
 
1060
  // Sidebar functions
1061
  function openSidebar() {
 
1108
  } else if (currentGame === 'shadow') {
1109
  renderShadowGame(appContainer);
1110
  }
1111
+
1112
+ // Apply theme after rendering to ensure new elements have correct colors
1113
+ applyTheme('amurs');
1114
  }
1115
 
1116
  // Header Creation
 
1126
  </button>
1127
  </div>
1128
  <div class="header-title">نجاح - Amurs</div>
1129
+ <div class="header-item flex items-center justify-end space-x-2">
1130
+ <button class="text-white" onclick="toggleColorPicker()">
1131
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-white" viewBox="0 0 24 24" fill="currentColor">
1132
+ <path d="M12 3c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6zM8 12c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm4-4h8v4h-8z"/>
1133
+ </svg>
1134
+ </button>
1135
  <button class="text-white" onclick="goBack()">
1136
  <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-white" viewBox="0 0 24 24" fill="currentColor">
1137
  <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>