@arcade-v/arcade_v 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,184 +1,106 @@
1
- function changeFavicon(src) {
2
- const oldLink = document.getElementById('dynamic-favicon');
3
- if (oldLink && oldLink.parentNode === document.head) {
4
- try {
5
- document.head.removeChild(oldLink);
6
- } catch (error) {
7
- console.warn('Failed to remove old favicon:', error);
8
- }
1
+ function changeFavicon(src) {
2
+ const oldLink = document.getElementById('dynamic-favicon');
3
+ if (oldLink && oldLink.parentNode === document.head) {
4
+ try {
5
+ document.head.removeChild(oldLink);
6
+ } catch (error) {
7
+ console.warn('Failed to remove old favicon:', error);
9
8
  }
10
-
11
- const link = document.createElement('link');
12
- link.id = 'dynamic-favicon';
13
- link.rel = 'icon';
14
- link.href = src + '?v=' + new Date().getTime(); // prevent caching
15
- document.head.appendChild(link);
16
-
17
- localStorage.setItem('faviconSrc', src);
18
9
  }
19
10
 
20
- function changeTitle(title) {
21
- document.title = title;
22
- localStorage.setItem('pageTitle', title);
23
- }
11
+ const link = document.createElement('link');
12
+ link.id = 'dynamic-favicon';
13
+ link.rel = 'icon';
14
+ link.href = src + '?v=' + new Date().getTime(); // prevent caching
15
+ document.head.appendChild(link);
24
16
 
25
- function cloakpage(title, src) {
26
- changeTitle(title);
27
- changeFavicon(src);
28
- }
17
+ localStorage.setItem('faviconSrc', src);
18
+ }
29
19
 
30
- function changetheme(src) {
31
- document.body.style.backgroundImage = `url('${src}')`;
32
- const navbar = document.querySelector('.navbar');
33
- if (navbar) {
34
- navbar.style.backgroundImage = `url('${src}')`;
35
- }
36
- const dropdownContent = document.querySelector('.dropdown-content');
37
- if (dropdownContent) {
38
- dropdownContent.style.backgroundImage = `url('${src}')`;
39
- }
40
- localStorage.setItem('themeBg', src);
41
- }
20
+ function changeTitle(title) {
21
+ document.title = title;
22
+ localStorage.setItem('pageTitle', title);
23
+ }
42
24
 
43
- function changeFont(font) {
44
- document.body.style.fontFamily = font;
45
- localStorage.setItem('userFont', font);
46
- document.querySelectorAll('select').forEach(select => {
47
- select.style.fontFamily = font;
48
- });
49
- const searchBar = document.getElementById('searchBar');
50
- if (searchBar) {
51
- searchBar.style.fontFamily = font;
52
- }
25
+ function cloakpage(title, src) {
26
+ changeTitle(title);
27
+ changeFavicon(src);
28
+ }
29
+
30
+ function changetheme(src) {
31
+ document.body.style.backgroundImage = `url('${src}')`;
32
+ const navbar = document.querySelector('.navbar');
33
+ if (navbar) {
34
+ navbar.style.backgroundImage = `url('${src}')`;
35
+ }
36
+ const dropdownContent = document.querySelector('.dropdown-content');
37
+ if (dropdownContent) {
38
+ dropdownContent.style.backgroundImage = `url('${src}')`;
39
+ }
40
+ localStorage.setItem('themeBg', src);
53
41
  }
54
42
 
55
- function changeTextColor(color) {
56
- // Remove previous style block if it exists
57
- const oldStyle = document.getElementById('normal-text-style');
58
- if (oldStyle) oldStyle.remove();
59
-
60
- // Create new style for normal text + pagination + paragraphs
61
- const style = document.createElement('style');
62
- style.id = 'normal-text-style';
63
- style.innerHTML = `
64
- body,
65
- select,
66
- li a:not(.active),
67
- #searchBar:not(:focus),
68
- .game-title,
69
- p,
70
- .pagination button {
71
- color: ${color} !important;
72
- }
73
- `;
74
- document.head.appendChild(style);
75
-
76
- // Dynamically update outlines ONLY if they are not transparent or none
77
- document.querySelectorAll('*').forEach(el => {
78
- const computedStyle = window.getComputedStyle(el);
79
- const outlineColor = computedStyle.outlineColor;
80
- const outlineStyle = computedStyle.outlineStyle;
81
-
82
- // Check if outline exists and is not transparent or "none"
83
- if (
84
- outlineStyle !== 'none' &&
85
- outlineColor !== 'rgba(0, 0, 0, 0)' && // transparent
86
- outlineColor !== 'transparent'
87
- ) {
88
- el.style.outlineColor = color;
89
- }
43
+ function changeFont(font) {
44
+ document.body.style.fontFamily = font;
45
+ localStorage.setItem('userFont', font);
46
+ document.querySelectorAll('select').forEach(select => {
47
+ select.style.fontFamily = font;
90
48
  });
91
-
92
- // Save to localStorage for persistence
93
- localStorage.setItem('textColor', color);
49
+ const searchBar = document.getElementById('searchBar');
50
+ if (searchBar) {
51
+ searchBar.style.fontFamily = font;
52
+ }
94
53
  }
95
54
 
96
55
 
56
+ function changeTextColor(color) {
57
+ document.documentElement.style.setProperty('--text-color', color);
58
+ localStorage.setItem('textColor', color);
59
+ }
97
60
 
98
61
  function changeSelectedTextColor(color) {
99
- // Remove previous dynamic style if any
100
- const oldStyle = document.getElementById('selected-text-style');
101
- if (oldStyle) oldStyle.remove();
102
-
103
- const style = document.createElement('style');
104
- style.id = 'selected-text-style';
105
- style.innerHTML = `
106
- ::selection {
107
- background: #333;
108
- color: ${color};
109
- }
110
- `;
111
- document.head.appendChild(style);
112
- localStorage.setItem('selectedTextColor', color);
113
- }
114
- function changeFocusTextColor(color) {
115
- const oldStyle = document.getElementById('focus-text-style');
116
- if (oldStyle) oldStyle.remove();
117
-
118
- const style = document.createElement('style');
119
- style.id = 'focus-text-style';
120
- style.innerHTML = `
121
- input:focus,
122
- select:focus,
123
- textarea:focus {
124
- color: ${color};
125
- border-color: ${color};
126
- }
127
- `;
128
- document.head.appendChild(style);
129
- }
130
- function changeActiveTextColor(color) {
131
- // Remove old active text color style if any
132
- const oldStyle = document.getElementById('active-text-style');
133
- if (oldStyle) oldStyle.remove();
134
-
135
- const style = document.createElement('style');
136
- style.id = 'active-text-style';
137
- style.innerHTML = `
138
- li a.active {
139
- color: ${color} !important;
140
- }
141
- `;
142
- document.head.appendChild(style);
143
- localStorage.setItem('activeTextColor', color);
62
+ document.documentElement.style.setProperty('--selected-text-color', color);
63
+ localStorage.setItem('selectedTextColor', color);
144
64
  }
145
65
 
66
+
67
+
146
68
  function resetToDefault() {
147
- // Clear localStorage
148
- localStorage.removeItem('faviconSrc');
149
- localStorage.removeItem('pageTitle');
150
- localStorage.removeItem('themeBg');
151
- localStorage.removeItem('userFont');
152
- localStorage.removeItem('textColor');
153
- localStorage.removeItem('selectedTextColor');
154
- localStorage.removeItem('activeTextColor');
155
-
156
- // Reset Favicon & Title
157
- changeFavicon('https://gitlab.com/arcade_v/arcade_v_images/-/raw/main/favicon/logo.png');
158
- changeTitle('Arcade 4');
159
-
160
- // Reset Theme
161
- changetheme('https://gitlab.com/arcade_v/arcade_v_images/-/raw/main/backgrounds/void_theme.png');
162
-
163
- // Reset Font
164
- changeFont('Pixelify Sans, sans-serif');
165
-
166
- // Reset Normal Text Color
167
- changeTextColor('#ffffff');
168
- const picker1 = document.getElementById('textColorPicker1');
169
- if (picker1) picker1.value = '#ffffff';
170
-
171
- // Reset Selected/Focus/Active Text Color
172
- changeSelectedTextColor('#7F00FF');
173
- changeFocusTextColor('#7F00FF');
174
- changeActiveTextColor('#7F00FF');
175
- const picker2 = document.getElementById('textColorPicker2');
176
- if (picker2) picker2.value = '#7F00FF';
177
-
178
- // Reset dropdown selections
179
- document.getElementById('cloakDropdown').selectedIndex = 0;
180
- document.getElementById('backgroundDropdown').selectedIndex = 0;
181
- document.getElementById('fontDropdown').selectedIndex = 0;
69
+ // Clear localStorage
70
+ localStorage.removeItem('faviconSrc');
71
+ localStorage.removeItem('pageTitle');
72
+ localStorage.removeItem('themeBg');
73
+ localStorage.removeItem('userFont');
74
+ localStorage.removeItem('textColor');
75
+ localStorage.removeItem('selectedTextColor');
76
+ localStorage.removeItem('activeTextColor');
77
+
78
+ // Reset Favicon & Title
79
+ changeFavicon('https://gitlab.com/arcade_v/arcade_v_images/-/raw/main/favicon/logo.png');
80
+ changeTitle('Arcade 4');
81
+
82
+ // Reset Theme
83
+ changetheme('https://gitlab.com/arcade_v/arcade_v_images/-/raw/main/backgrounds/void_theme.png');
84
+
85
+ // Reset Font
86
+ changeFont('Pixelify Sans, sans-serif');
87
+
88
+ // Reset Normal Text Color
89
+ changeTextColor('#ffffff');
90
+ const picker1 = document.getElementById('textColorPicker1');
91
+ if (picker1) picker1.value = '#ffffff';
92
+
93
+ // Reset Selected/Focus/Active Text Color
94
+ changeSelectedTextColor('#7F00FF');
95
+ changeFocusTextColor('#7F00FF');
96
+ changeActiveTextColor('#7F00FF');
97
+ const picker2 = document.getElementById('textColorPicker2');
98
+ if (picker2) picker2.value = '#7F00FF';
99
+
100
+ // Reset dropdown selections
101
+ document.getElementById('cloakDropdown').selectedIndex = 0;
102
+ document.getElementById('backgroundDropdown').selectedIndex = 0;
103
+ document.getElementById('fontDropdown').selectedIndex = 0;
182
104
  }
183
105
 
184
106
 
@@ -203,16 +125,18 @@ if (savedFont) changeFont(savedFont);
203
125
 
204
126
  const savedColor = localStorage.getItem('textColor');
205
127
  if (savedColor) {
206
- changeTextColor(savedColor);
207
- const picker1 = document.getElementById('textColorPicker1');
208
- if (picker1) picker1.value = savedColor;
128
+ changeTextColor(savedColor);
129
+ const picker1 = document.getElementById('textColorPicker1');
130
+ if (picker1) picker1.value = savedColor;
209
131
  }
210
132
 
211
133
  const selectedTextColor = localStorage.getItem('selectedTextColor');
212
134
  if (selectedTextColor) {
213
- changeSelectedTextColor(selectedTextColor);
214
- changeFocusTextColor(selectedTextColor);
215
- changeActiveTextColor(selectedTextColor);
216
- const picker2 = document.getElementById('textColorPicker2');
217
- if (picker2) picker2.value = selectedTextColor;
135
+ changeSelectedTextColor(selectedTextColor);
136
+ changeFocusTextColor(selectedTextColor);
137
+ changeActiveTextColor(selectedTextColor);
138
+ const picker2 = document.getElementById('textColorPicker2');
139
+ if (picker2) picker2.value = selectedTextColor;
218
140
  }
141
+
142
+