appscms-tools-theme 5.2.0 → 5.2.1

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/_data/.DS_Store +0 -0
  3. data/_data/aitools/en/instagram-hashtag-generator.json +2 -17
  4. data/_data/contenttool/en/features.json +18 -243
  5. data/_includes/.DS_Store +0 -0
  6. data/_includes/aitools/instagram-hashtag-generator.html +0 -0
  7. data/assets/.DS_Store +0 -0
  8. data/assets/js/TopScroll.js +8 -0
  9. data/assets/js/adBlocker.js +68 -0
  10. data/assets/js/ads.js +8 -0
  11. data/assets/js/append-div.js +10 -0
  12. data/assets/js/appscms-infographics.js +0 -0
  13. data/assets/js/appscms-login.js +447 -0
  14. data/assets/js/appscms-search-home1.js +136 -0
  15. data/assets/js/appscms-search.js +133 -0
  16. data/assets/js/appscms-theme.js +459 -0
  17. data/assets/js/batch.js +219 -0
  18. data/assets/js/calculator-tooltip.js +3 -0
  19. data/assets/js/devtools.js +82 -0
  20. data/assets/js/face-api.js +38064 -0
  21. data/assets/js/face-detection.js +303 -0
  22. data/assets/js/faceSystem.js +0 -0
  23. data/assets/js/featureResult.js +48 -0
  24. data/assets/js/frame.js +264 -0
  25. data/assets/js/googledrive.js +158 -0
  26. data/assets/js/homeResult.js +37 -0
  27. data/assets/js/manifest.json +17 -0
  28. data/assets/js/models/age_gender_model-shard1 +0 -0
  29. data/assets/js/models/age_gender_model-weights_manifest.json +1 -0
  30. data/assets/js/models/face_expression_model-shard1 +0 -0
  31. data/assets/js/models/face_expression_model-weights_manifest.json +1 -0
  32. data/assets/js/models/face_landmark_68_model-shard1 +0 -0
  33. data/assets/js/models/face_landmark_68_model-weights_manifest.json +1 -0
  34. data/assets/js/models/face_landmark_68_tiny_model-shard1 +0 -0
  35. data/assets/js/models/face_landmark_68_tiny_model-weights_manifest.json +1 -0
  36. data/assets/js/models/face_recognition_model-shard1 +0 -0
  37. data/assets/js/models/face_recognition_model-shard2 +6 -0
  38. data/assets/js/models/face_recognition_model-weights_manifest.json +1 -0
  39. data/assets/js/models/mtcnn_model-shard1 +0 -0
  40. data/assets/js/models/mtcnn_model-weights_manifest.json +1 -0
  41. data/assets/js/models/ssd_mobilenetv1_model-shard1 +0 -0
  42. data/assets/js/models/ssd_mobilenetv1_model-shard2 +145 -0
  43. data/assets/js/models/ssd_mobilenetv1_model-weights_manifest.json +1 -0
  44. data/assets/js/models/tiny_face_detector_model-shard1 +0 -0
  45. data/assets/js/models/tiny_face_detector_model-weights_manifest.json +1 -0
  46. data/assets/js/multiselect.js +185 -0
  47. data/assets/js/partytown/debug/partytown-atomics.js +929 -0
  48. data/assets/js/partytown/debug/partytown-media.js +374 -0
  49. data/assets/js/partytown/debug/partytown-sandbox-sw.js +920 -0
  50. data/assets/js/partytown/debug/partytown-sw.js +59 -0
  51. data/assets/js/partytown/debug/partytown-ww-atomics.js +2699 -0
  52. data/assets/js/partytown/debug/partytown-ww-sw.js +2691 -0
  53. data/assets/js/partytown/debug/partytown.js +114 -0
  54. data/assets/js/partytown/partytown-atomics.js +600 -0
  55. data/assets/js/partytown/partytown-media.js +2 -0
  56. data/assets/js/partytown/partytown-sw.js +50 -0
  57. data/assets/js/perspective.min.js +182 -0
  58. data/assets/js/photo-effects.json +85 -0
  59. data/assets/js/redirectResult.js +10 -0
  60. data/assets/js/sharePage.js +65 -0
  61. data/assets/js/testing-batch.js +39 -0
  62. data/assets/js/theme.js +104 -0
  63. data/assets/js/usageTracking.js +143 -0
  64. data/assets/js/usageTrackingEvents.js +6 -0
  65. data/assets/js/userUsageCount.js +0 -0
  66. data/assets/js/webvitals.js +5 -0
  67. metadata +62 -2
@@ -0,0 +1,133 @@
1
+ let features = [];
2
+ let featureshi = [];
3
+ let featuresar = [];
4
+ let featuresda = [];
5
+ let featuresde = [];
6
+ let featureses = [];
7
+ let featuresfr = [];
8
+ let featuresid = [];
9
+ let featuresit = [];
10
+ let featuresja = [];
11
+ let featuresko = [];
12
+ let featuresnl = [];
13
+ let featurespl = [];
14
+ let featurespt = [];
15
+ let featuresru = [];
16
+ let featuressv = [];
17
+ let featuresth = [];
18
+ let featurestr = [];
19
+ let featuresuk = [];
20
+ let featuresvi = [];
21
+ let featureszh = [];
22
+ let featureszhtw = [];
23
+
24
+ // Fetch data from searchbar.json
25
+ const fetchFeatures = async () => {
26
+ try {
27
+ const response = await fetch('/searchbar.json');
28
+ const data = await response.json();
29
+ features = data.features;
30
+ featureshi = data.featureshi;
31
+ featuresar = data.featuresar;
32
+ featuresda = data.featuresda;
33
+ featuresde = data.featuresde;
34
+ featureses = data.featureses;
35
+ featuresfr = data.featuresfr;
36
+ featuresid = data.featuresid;
37
+ featuresit = data.featuresit;
38
+ featuresja = data.featuresja;
39
+ featuresko = data.featuresko;
40
+ featuresnl = data.featuresnl;
41
+ featurespl = data.featurespl;
42
+ featurespt = data.featurespt;
43
+ featuresru = data.featuresru;
44
+ featuressv = data.featuressv;
45
+ featuresth = data.featuresth;
46
+ featurestr = data.featurestr;
47
+ featuresuk = data.featuresuk;
48
+ featuresvi = data.featuresvi;
49
+ featureszh = data.featureszh;
50
+ featureszhtw = data.featureszhtw;
51
+ } catch (error) {
52
+ console.error('Error loading features:', error);
53
+ featureList.innerHTML = '<div class="error-msg">Error loading features</div>';
54
+ }
55
+ };
56
+
57
+ const getFeatureSet = () => {
58
+ const currentUrl = window.location.pathname;
59
+ if (currentUrl.includes('/hi')) return featureshi;
60
+ if (currentUrl.includes('/ar')) return featuresar;
61
+ if (currentUrl.includes('/da')) return featuresda;
62
+ if (currentUrl.includes('/de')) return featuresde;
63
+ if (currentUrl.includes('/es')) return featureses;
64
+ if (currentUrl.includes('/fr')) return featuresfr;
65
+ if (currentUrl.includes('/id')) return featuresid;
66
+ if (currentUrl.includes('/it')) return featuresit;
67
+ if (currentUrl.includes('/ja')) return featuresja;
68
+ if (currentUrl.includes('/ko')) return featuresko;
69
+ if (currentUrl.includes('/nl')) return featuresnl;
70
+ if (currentUrl.includes('/pl')) return featurespl;
71
+ if (currentUrl.includes('/pt')) return featurespt;
72
+ if (currentUrl.includes('/ru')) return featuresru;
73
+ if (currentUrl.includes('/sv')) return featuressv;
74
+ if (currentUrl.includes('/th')) return featuresth;
75
+ if (currentUrl.includes('/tr')) return featurestr;
76
+ if (currentUrl.includes('/uk')) return featuresuk;
77
+ if (currentUrl.includes('/vi')) return featuresvi;
78
+ if (currentUrl.includes('/zh')) return featureszh;
79
+ if (currentUrl.includes('/zh-tw')) return featureszhtw;
80
+ return features;
81
+ };
82
+ const featureList = document.querySelector('#appscms-tools-section-row');
83
+ const renderFeatures = (query) => {
84
+ featureList.innerHTML = "";
85
+ const currentFeatures = getFeatureSet();
86
+ const filteredFeatures = currentFeatures.filter(currentFeatures =>
87
+ currentFeatures.name.toLowerCase().includes(query.toLowerCase())
88
+ );
89
+
90
+ if (filteredFeatures.length > 0) {
91
+ filteredFeatures.forEach(item => {
92
+ const listItem = document.createElement("div");
93
+ const classNames = "col-xl-4 col-lg-6 col-md-6 appscms-tool-container";
94
+ let classList = classNames.split(" ");
95
+ classList.forEach(function (className) {
96
+ listItem.classList.add(className);
97
+ });
98
+ listItem.innerHTML = `
99
+ <a href="${item.url}">
100
+ <div class="appscms-tool">
101
+ <div class="tool-top" style="background: ${item.color};">
102
+ <div class="tool-img">
103
+ <img crossorigin="anonymous" src="${item.icon}" alt="img" />
104
+ </div>
105
+ <div class="tool-text">${truncate(item.description, 67, '..')}</div>
106
+ </div>
107
+ <div class="tool-heading">${truncate(item.name, 33, '..')}</div>
108
+ </div>
109
+ </a>
110
+ `;
111
+ featureList.appendChild(listItem);
112
+ });
113
+ }
114
+ else {
115
+ let msg = document.createElement('div')
116
+ msg.classList.add('no-result-found-msg')
117
+ msg.innerHTML = "No search results found!"
118
+ featureList.appendChild(msg)
119
+ }
120
+ };
121
+ function truncate(str, length, ending = '..') {
122
+ if (!str) return '';
123
+ return str.length > length ? str.substring(0, length) + ending : str;
124
+ }
125
+
126
+ const searchInput = document.querySelector('#search-features');
127
+ searchInput.addEventListener("input", function () {
128
+ const query = searchInput.value.trim();
129
+ renderFeatures(query);
130
+ });
131
+
132
+ // Initialize by fetching data
133
+ fetchFeatures();
@@ -0,0 +1,459 @@
1
+ ---
2
+ ---
3
+ console.log(document.querySelectorAll('*').length);
4
+
5
+ if ("{{ site.safeui }}"==="true") {
6
+ document.addEventListener("DOMContentLoaded", function () {
7
+ var safuiAlert = document.querySelector("#safeui-alert");
8
+ if (safuiAlert) {
9
+ setTimeout(function () {
10
+ safuiAlert.style.transition = "1s";
11
+ safuiAlert.style.height = "0";
12
+ safuiAlert.style.paddingTop = "0";
13
+ safuiAlert.style.paddingBottom = "0";
14
+ safuiAlert.style.marginTop = "0";
15
+ safuiAlert.style.marginBottom = "0";
16
+ setTimeout(function () {
17
+ safuiAlert.parentNode.removeChild(safuiAlert);
18
+ }, 1000);
19
+ }, 7000);
20
+ }
21
+ });
22
+ }
23
+ const hamburger = document.querySelector("#hamburger");
24
+ const closeNavHam = document.querySelector("#close-nav-ham");
25
+ const appscmsToolbar = document.querySelector(".appscms-toolbar");
26
+ const appscmsToolbarListItems = document.querySelectorAll(
27
+ ".appscms-toolbar-list-item-span"
28
+ );
29
+ closeNavHam.addEventListener("click", () => {
30
+ if (hamburger.dataset.open === "1") {
31
+ hamburger.dataset.open = "0";
32
+ appscmsToolbar.style.right = "-272px";
33
+ appscmsToolbar.style.display = "none";
34
+ hamburger.innerHTML = ` <svg
35
+ style="font-size:25px"
36
+ stroke="currentColor"
37
+ fill="currentColor"
38
+ stroke-width="0"
39
+ viewBox="0 0 512 512"
40
+ aria-hidden="true"
41
+ focusable="false"
42
+ height="50px"
43
+ width="1em"
44
+ xmlns="http://www.w3.org/2000/svg"
45
+ >
46
+ <path
47
+ fill="none"
48
+ stroke-linecap="round"
49
+ stroke-miterlimit="10"
50
+ stroke-width="48"
51
+ d="M88 152h336M88 256h336M88 360h336"
52
+ ></path>
53
+ </svg>`;
54
+ }
55
+ })
56
+ hamburger.addEventListener("click", () => {
57
+ if (hamburger.dataset.open === "1") {
58
+ hamburger.dataset.open = "0";
59
+ appscmsToolbar.style.right = "-272px";
60
+ appscmsToolbar.style.display = "none";
61
+ hamburger.innerHTML = ` <svg
62
+ style="font-size:25px"
63
+ stroke="currentColor"
64
+ fill="currentColor"
65
+ stroke-width="0"
66
+ viewBox="0 0 512 512"
67
+ aria-hidden="true"
68
+ focusable="false"
69
+ height="50px"
70
+ width="1em"
71
+ xmlns="http://www.w3.org/2000/svg"
72
+ >
73
+ <path
74
+ fill="none"
75
+ stroke-linecap="round"
76
+ stroke-miterlimit="10"
77
+ stroke-width="48"
78
+ d="M88 152h336M88 256h336M88 360h336"
79
+ ></path>
80
+ </svg>`;
81
+ } else {
82
+ hamburger.dataset.open = "1";
83
+ appscmsToolbar.style.right = "0px";
84
+ appscmsToolbar.style.display = "block";
85
+ hamburger.innerHTML = `<svg height="50px"
86
+ width="1em" style="font-size:25px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g clip-path="url(#clip0_429_11083)"> <path d="M7 7.00006L17 17.0001M7 17.0001L17 7.00006" stroke="#ffffff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"></path> </g> <defs> <clipPath id="clip0_429_11083"> <rect width="24" height="24" fill="white"></rect> </clipPath> </defs> </g></svg>`;
87
+ }
88
+ });
89
+ Array.from(appscmsToolbarListItems).map((item) => {
90
+ item.addEventListener("click", (e) => {
91
+ e.preventDefault();
92
+ var style = window.getComputedStyle(item.nextElementSibling);
93
+ var maxHeight = style.getPropertyValue("max-height");
94
+ console.log(maxHeight)
95
+ if (maxHeight && maxHeight !== "0px") {
96
+ // If the item is expanded, collapse it
97
+ item.nextElementSibling.style.maxHeight = "0";
98
+ item.nextElementSibling.style.opacity = "0";
99
+ item.nextElementSibling.style.height = "0";
100
+ } else {
101
+ // If the item is collapsed, expand it
102
+ item.nextElementSibling.style.maxHeight =
103
+ item.nextElementSibling.scrollHeight + "px";
104
+ item.nextElementSibling.style.opacity = "1";
105
+ item.nextElementSibling.style.height = "auto";
106
+ }
107
+ });
108
+ });
109
+
110
+ if ("{{ site.removeBootstrapJs }}" === "true") {
111
+ const languagesModal = document.querySelector("#staticBackdrop");
112
+ const intModalBtn = document.querySelector("#int-modal-btn");
113
+ const closeBtn = document.querySelector("#close-modal");
114
+
115
+ if (intModalBtn) {
116
+ intModalBtn.addEventListener("click", () => {
117
+ languagesModal.style.display = "block";
118
+ languagesModal.classList.add("show");
119
+ let modal = document.createElement("div");
120
+ modal.classList.add("modal-backdrop", "show");
121
+ document.body.appendChild(modal);
122
+ });
123
+ closeBtn.addEventListener("click", () => {
124
+ languagesModal.style.display = "none";
125
+ languagesModal.classList.remove("show");
126
+ let modal = document.querySelector(".modal-backdrop");
127
+ document.body.removeChild(modal);
128
+ });
129
+ }
130
+ }
131
+
132
+ document.addEventListener("DOMContentLoaded", function() {
133
+ const downloadButton = document.getElementById("download-button");
134
+
135
+ if (downloadButton) {
136
+ const loader = document.querySelector(".button-loader");
137
+ const downloadSvg = downloadButton.querySelector("#download-svg");
138
+ const savingData = document.getElementById("saving-data");
139
+
140
+ downloadButton.addEventListener("click", function() {
141
+
142
+ loader.style.display = "block";
143
+ downloadSvg.style.visibility = "hidden";
144
+
145
+
146
+ // Show saving data message
147
+ savingData.style.display = "flex";
148
+
149
+ // Your additional code can go here
150
+ // Add your code logic here to execute when the button is clicked
151
+
152
+ });
153
+ }
154
+
155
+ });
156
+
157
+ // Check if the button exists
158
+ const processingBtn = document.getElementById('processing-btn');
159
+ const buttonLoader = document.querySelector('.button-loader');
160
+ if (processingBtn && buttonLoader) {
161
+ processingBtn.addEventListener('click', (event) => {
162
+ buttonLoader.style.display = 'block';
163
+ requestAnimationFrame(() => {
164
+ requestAnimationFrame(() => {
165
+ history.back();
166
+ });
167
+ });
168
+ }, { passive: true });
169
+ }
170
+
171
+
172
+ // if ("{{ site.navigationSearch }}" === "true") {
173
+ // // Fetch data directly from alllinks.json
174
+ // fetch("/alllinks.json")
175
+ // .then((response) => response.json())
176
+ // .then((data) => {
177
+ // // Check if the URL includes "/hi" to determine the language
178
+ // if (window.location.pathname.includes("/hi")) {
179
+ // window.fetchedData = data.featuredLinkshi; // Use Hindi data
180
+ // } else {
181
+ // window.fetchedData = data.featuredLinks; // Use English data
182
+ // }
183
+ // })
184
+ // .catch((error) => {
185
+ // console.error("Error fetching data:", error);
186
+ // });
187
+
188
+ // // Filter data based on search query
189
+ // function filterData(data, query) {
190
+ // return data.filter((item) =>
191
+ // item.name.toLowerCase().includes(query.toLowerCase())
192
+ // );
193
+ // }
194
+
195
+ // // Display filtered results
196
+ // function displayResults(results) {
197
+ // const resultsContainer = document.getElementById("results");
198
+ // resultsContainer.style.display = results.length ? "block" : "none";
199
+ // resultsContainer.innerHTML = results.length
200
+ // ? results
201
+ // .map(
202
+ // (result) =>
203
+ // `<div class="result-item"><a href="${result.url}" target="_blank">${result.name}</a></div>`
204
+ // )
205
+ // .join("")
206
+ // : "<p>No results found</p>";
207
+ // }
208
+
209
+ // function mobileDisplayResults(results) {
210
+ // const mobileResultsContainer = document.querySelector(
211
+ // ".mobile-searchbarResults"
212
+ // );
213
+ // mobileResultsContainer.style.display = results.length ? "block" : "none";
214
+ // mobileResultsContainer.innerHTML = results.length
215
+ // ? results
216
+ // .map(
217
+ // (result) =>
218
+ // `<div class="mobile-result-item"><a href="${result.url}" target="_blank">${result.name}</a></div>`
219
+ // )
220
+ // .join("")
221
+ // : "<p>No results found</p>";
222
+ // }
223
+
224
+ // // Handle search input
225
+ // const searchInput = document.querySelector(".search-input");
226
+
227
+ // searchInput.addEventListener("input", (event) => {
228
+ // const query = event.target.value;
229
+ // const data = window.fetchedData || [];
230
+ // const filteredResults = filterData(data, query);
231
+ // displayResults(filteredResults);
232
+
233
+ // gtag("event", "search", {
234
+ // event_category: "engagement",
235
+ // event_label: "Search Box",
236
+ // value: query,
237
+ // });
238
+ // });
239
+
240
+ // const mobileSearchInput = document.querySelector(".mobile-search-input");
241
+ // mobileSearchInput.addEventListener("input", (event) => {
242
+ // const query = event.target.value;
243
+ // const data = window.fetchedData || [];
244
+ // const filteredResults = filterData(data, query);
245
+ // mobileDisplayResults(filteredResults);
246
+
247
+ // gtag("event", "search", {
248
+ // event_category: "engagement",
249
+ // event_label: "Search Box",
250
+ // value: query,
251
+ // });
252
+ // });
253
+
254
+ // // Hide results when clicking outside search input and results container
255
+ // document.addEventListener("click", (event) => {
256
+ // const resultsContainer = document.getElementById("results");
257
+
258
+ // if (
259
+ // !searchInput.contains(event.target) &&
260
+ // !resultsContainer.contains(event.target)
261
+ // ) {
262
+ // resultsContainer.style.display = "none";
263
+ // }
264
+ // if (!window.location.pathname.includes("/hi")) {
265
+ // const mobileResultsContainer = document.querySelector(
266
+ // ".mobile-searchbarResults"
267
+ // );
268
+ // if (
269
+ // !mobileSearchInput.contains(event.target) &&
270
+ // !mobileResultsContainer.contains(event.target)
271
+ // ) {
272
+ // mobileResultsContainer.style.display = "none";
273
+ // }
274
+ // }
275
+ // });
276
+ // }
277
+
278
+ if ("{{ site.navigationSearch }}" === "true") {
279
+ // Define supported languages and their corresponding data keys
280
+ const SUPPORTED_LANGUAGES = {
281
+ de: 'featuredLinksde',
282
+ da: 'featuredLinksda',
283
+ es: 'featuredLinkses',
284
+ id: 'featuredLinksid',
285
+ it: 'featuredLinksit',
286
+ nl: 'featuredLinksnl',
287
+ pl: 'featuredLinkspl',
288
+ pt: 'featuredLinkspt',
289
+ sv: 'featuredLinkssv',
290
+ tr: 'featuredLinkstr',
291
+ vi: 'featuredLinksvi',
292
+ hi: 'featuredLinkshi',
293
+ fr: 'featuredLinksfr',
294
+ };
295
+
296
+ // Helper function to get current language from URL
297
+ function getCurrentLanguage() {
298
+ const path = window.location.pathname;
299
+ return Object.keys(SUPPORTED_LANGUAGES).find(lang =>
300
+ path.includes(`/${lang}`)
301
+ ) || 'en';
302
+ }
303
+
304
+ // Fetch data directly from alllinks.json
305
+ fetch("/alllinks.json")
306
+ .then((response) => response.json())
307
+ .then((data) => {
308
+ // Store all data globally
309
+ window.allData = data;
310
+ const currentLang = getCurrentLanguage();
311
+ // Set initial data based on current language
312
+ window.fetchedData = currentLang === 'en'
313
+ ? data.featuredLinks
314
+ : data[SUPPORTED_LANGUAGES[currentLang]];
315
+ })
316
+ .catch((error) => {
317
+ console.error("Error fetching data:", error);
318
+ });
319
+
320
+ // Filter data based on search query
321
+ function filterData(data, query) {
322
+ return data ? data.filter((item) =>
323
+ item.name.toLowerCase().includes(query.toLowerCase())
324
+ ) : [];
325
+ }
326
+
327
+ // Display filtered results
328
+ function displayResults(primaryResults, secondaryResults = [], container) {
329
+ const resultsContainer = container || document.getElementById("results");
330
+ const currentLang = getCurrentLanguage();
331
+
332
+ // Combine results, with primary results first
333
+ const combinedResults = [...primaryResults];
334
+ if (primaryResults.length < 4) {
335
+ // Only add secondary results if primary results are less than 4
336
+ secondaryResults.forEach(result => {
337
+ // Check if this result isn't already in primary results
338
+ if (!primaryResults.some(pr => pr.url === result.url)) {
339
+ combinedResults.push(result);
340
+ }
341
+ });
342
+ }
343
+
344
+ resultsContainer.style.display = combinedResults.length ? "block" : "none";
345
+
346
+ if (combinedResults.length === 0) {
347
+ resultsContainer.innerHTML = "<p>No results found</p>";
348
+ return;
349
+ }
350
+
351
+ // Get language display name for the indicator
352
+ const getLanguageDisplayName = () => {
353
+ try {
354
+ return new Intl.DisplayNames(['en'], { type: 'language' }).of('en');
355
+ } catch (e) {
356
+ return 'English';
357
+ }
358
+ };
359
+
360
+ // Display results with language indicators
361
+ resultsContainer.innerHTML = combinedResults
362
+ .map((result, index) => {
363
+ const isSecondary = index >= primaryResults.length;
364
+ return `
365
+ <div class="result-item ${isSecondary ? 'secondary-result' : ''}">
366
+ <a href="${result.url}" target="_blank">${result.name}</a>
367
+ ${isSecondary ? `<span class="language-indicator"></span>` : ''}
368
+ </div>
369
+ `;
370
+ })
371
+ .join("");
372
+ }
373
+
374
+ function handleSearch(event, isDesktop = true) {
375
+ const query = event.target.value.trim();
376
+ const container = isDesktop ?
377
+ document.getElementById("results") :
378
+ document.querySelector(".mobile-searchbarResults");
379
+
380
+ if (!query) {
381
+ container.style.display = "none";
382
+ return;
383
+ }
384
+
385
+ const currentLang = getCurrentLanguage();
386
+ const currentLangData = currentLang === 'en'
387
+ ? window.allData.featuredLinks
388
+ : window.allData[SUPPORTED_LANGUAGES[currentLang]];
389
+
390
+ // First, search in current language data
391
+ const primaryResults = filterData(currentLangData, query);
392
+
393
+ // If primary results are less than 4, also search in English data
394
+ const englishResults = primaryResults.length < 4 ?
395
+ filterData(window.allData.featuredLinks, query) :
396
+ [];
397
+
398
+ // Display results with current language first, then English if needed
399
+ displayResults(primaryResults, englishResults, container);
400
+
401
+ gtag("event", "search", {
402
+ event_category: "engagement",
403
+ event_label: "Search Box",
404
+ value: query,
405
+ });
406
+ }
407
+
408
+ // Set up desktop search
409
+ const searchInput = document.querySelector(".search-input");
410
+ searchInput.addEventListener("input", (event) => handleSearch(event, true));
411
+
412
+ // Set up mobile search
413
+ const mobileSearchInput = document.querySelector(".mobile-search-input");
414
+ mobileSearchInput.addEventListener("input", (event) => handleSearch(event, false));
415
+
416
+ // Hide results when clicking outside
417
+ document.addEventListener("click", (event) => {
418
+ const resultsContainer = document.getElementById("results");
419
+ const mobileResultsContainer = document.querySelector(".mobile-searchbarResults");
420
+
421
+ if (!searchInput.contains(event.target) && !resultsContainer.contains(event.target)) {
422
+ resultsContainer.style.display = "none";
423
+ }
424
+
425
+ if (!mobileSearchInput.contains(event.target) && !mobileResultsContainer.contains(event.target)) {
426
+ mobileResultsContainer.style.display = "none";
427
+ }
428
+ });
429
+ }
430
+ document.addEventListener("DOMContentLoaded", function () {
431
+ const scrollContainer = document.querySelector(".appscms-toolbar-list");
432
+ const scrollLeft = document.querySelector(".scroll-left");
433
+ const scrollRight = document.querySelector(".scroll-right");
434
+
435
+ function updateScrollButtons() {
436
+ scrollLeft.style.display =
437
+ scrollContainer.scrollLeft > 0 ? "block" : "none";
438
+ scrollRight.style.display =
439
+ scrollContainer.scrollWidth >
440
+ scrollContainer.clientWidth + scrollContainer.scrollLeft
441
+ ? "block"
442
+ : "none";
443
+ }
444
+
445
+ scrollLeft.addEventListener("click", function () {
446
+ scrollContainer.scrollLeft -= 120; // Adjust this value as needed
447
+ updateScrollButtons();
448
+ });
449
+
450
+ scrollRight.addEventListener("click", function () {
451
+ scrollContainer.scrollLeft += 120; // Adjust this value as needed
452
+ updateScrollButtons();
453
+ });
454
+
455
+ scrollContainer.addEventListener("scroll", updateScrollButtons);
456
+
457
+ // Initial check to hide buttons if necessary
458
+ updateScrollButtons();
459
+ });