appscms-tools-theme 5.5.6 → 5.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11a30c530b43ceeda373ab902544b171ebb7d38dc1e2856bb729e647478e9cba
4
- data.tar.gz: eda228c7a0a43937a1f01d3387946160d59f2fb7e5a834949d6602ebfc17b9f3
3
+ metadata.gz: 762a50a4599b91e418dfdcf830c4a790a2283ba54755fb0de0a84723f38ac498
4
+ data.tar.gz: e5b5fde5a25d385a16599addd9e1ef95c60c62d2fe80f3100c8f727cf999ed1e
5
5
  SHA512:
6
- metadata.gz: 98f120e9b376036ef0e66a822a8fe57424058fd351a0e0dcd3aa257e2ae656120337c1fbe2b2bd01021e912b334fbba3b5ac92ca51f9cc495e269c2603d95fdc
7
- data.tar.gz: 3b38ef027545aaff62106eb741b2fdf1cb248be39c1be8f12103df23321b20f55408bdb657026a92fd4395f46aac6d60a345c59dfa086c5cda2b3205d2656706
6
+ metadata.gz: 283a39cdec6460736f73d4b2d9a82965948f99987a89c8a5c85a24637ce72c0c4d2cac91f03839c615a61f1f82e1449bc791d03eead6ba2023ee0f5cc7b6765a
7
+ data.tar.gz: b7d370f14de8ca2a903ad703000dfb46def07544745a40c0653f772071eeb89f0b7a57690e386d3cdb33ad4cdc3ebd51671e56d89ec2842f662faa06e920f749
data/_includes/.DS_Store CHANGED
Binary file
Binary file
data/assets/.DS_Store CHANGED
Binary file
@@ -168,265 +168,118 @@ if (processingBtn && buttonLoader) {
168
168
  }, { passive: true });
169
169
  }
170
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
171
  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
- };
172
+ const SUPPORTED_LANGUAGES = [
173
+ 'zh-tw', 'de', 'da', 'es', 'id', 'it', 'nl', 'pl', 'pt', 'sv', 'tr', 'vi', 'hi', 'fr', 'ar', 'ja', 'ko', 'ru', 'th', 'uk', 'zh'
174
+ ];
295
175
 
296
176
  // Helper function to get current language from URL
297
177
  function getCurrentLanguage() {
298
178
  const path = window.location.pathname;
299
- return Object.keys(SUPPORTED_LANGUAGES).find(lang =>
300
- path.includes(`/${lang}`)
301
- ) || 'en';
179
+ for (const lang of SUPPORTED_LANGUAGES) {
180
+ if (path.includes(`/${lang}/`) || path.endsWith(`/${lang}`)) {
181
+ return lang;
182
+ }
183
+ }
184
+ return 'en';
302
185
  }
303
186
 
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
187
  // Filter data based on search query
321
188
  function filterData(data, query) {
322
- return data ? data.filter((item) =>
323
- item.name.toLowerCase().includes(query.toLowerCase())
324
- ) : [];
189
+ if (!Array.isArray(data)) return [];
190
+ const q = query.toLowerCase();
191
+ return data.filter((item) =>
192
+ item && item.name && item.name.toLowerCase().includes(q)
193
+ );
325
194
  }
326
195
 
327
196
  // Display filtered results
328
- function displayResults(primaryResults, secondaryResults = [], container) {
197
+ function displayResults(results, container) {
329
198
  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
- }
199
+ if (!resultsContainer) return;
343
200
 
344
- resultsContainer.style.display = combinedResults.length ? "block" : "none";
345
-
346
- if (combinedResults.length === 0) {
201
+ resultsContainer.style.display = results.length ? "block" : "none";
202
+
203
+ if (results.length === 0) {
347
204
  resultsContainer.innerHTML = "<p>No results found</p>";
348
205
  return;
349
206
  }
350
207
 
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;
208
+ resultsContainer.innerHTML = results
209
+ .map((result) => {
364
210
  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>` : ''}
211
+ <div class="result-item">
212
+ <a href="${result.url}">${result.name}</a>
368
213
  </div>
369
214
  `;
370
215
  })
371
216
  .join("");
372
217
  }
373
218
 
374
- function handleSearch(event, isDesktop = true) {
219
+ // Cache loaded language JSON files to prevent re-fetching on every keystroke
220
+ const langDataCache = {};
221
+
222
+ async function fetchLanguageFile(langCode) {
223
+ if (langDataCache[langCode]) {
224
+ return langDataCache[langCode];
225
+ }
226
+ const response = await fetch(`/search_data/home_tools_${langCode}.json`);
227
+ if (!response.ok) throw new Error(`Failed to load home_tools_${langCode}.json`);
228
+ const json = await response.json();
229
+ const dataArray = (json && Array.isArray(json.featuredLinks))
230
+ ? json.featuredLinks
231
+ : (Array.isArray(json) ? json : []);
232
+ langDataCache[langCode] = dataArray;
233
+ return dataArray;
234
+ }
235
+
236
+ async function handleSearch(event, isDesktop = true) {
375
237
  const query = event.target.value.trim();
376
- const container = isDesktop ?
377
- document.getElementById("results") :
238
+ const container = isDesktop ?
239
+ document.getElementById("results") :
378
240
  document.querySelector(".mobile-searchbarResults");
379
241
 
242
+ if (!container) return;
243
+
244
+ // Clear container and hide if input is empty
380
245
  if (!query) {
381
246
  container.style.display = "none";
382
247
  return;
383
248
  }
384
249
 
385
250
  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
251
 
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));
252
+ try {
253
+ // Load ONLY the JSON file for the current language from missing_links/
254
+ const langData = await fetchLanguageFile(currentLang);
255
+ const results = filterData(langData, query);
415
256
 
416
- // Hide results when clicking outside
417
- document.addEventListener("click", (event) => {
418
- const resultsContainer = document.getElementById("results");
419
- const mobileResultsContainer = document.querySelector(".mobile-searchbarResults");
257
+ displayResults(results, container);
420
258
 
421
- if (!searchInput.contains(event.target) && !resultsContainer.contains(event.target)) {
422
- resultsContainer.style.display = "none";
259
+ if (typeof gtag === "function") {
260
+ gtag("event", "search", {
261
+ event_category: "engagement",
262
+ event_label: "Search Box",
263
+ value: query,
264
+ });
265
+ }
266
+ } catch (error) {
267
+ console.error("Error fetching language search data:", error);
423
268
  }
269
+ }
424
270
 
425
- if (!mobileSearchInput.contains(event.target) && !mobileResultsContainer.contains(event.target)) {
426
- mobileResultsContainer.style.display = "none";
427
- }
428
- });
271
+ const themeSearchInput = document.querySelector(".search-input");
272
+ if (themeSearchInput) {
273
+ themeSearchInput.addEventListener("input", (event) => handleSearch(event, true));
274
+ }
275
+
276
+ // Set up mobile search
277
+ const mobileSearchInput = document.querySelector(".mobile-search-input");
278
+ if (mobileSearchInput) {
279
+ mobileSearchInput.addEventListener("input", (event) => handleSearch(event, false));
280
+ }
429
281
  }
282
+
430
283
  document.addEventListener("DOMContentLoaded", function () {
431
284
  const scrollContainer = document.querySelector(".appscms-toolbar-list");
432
285
  const scrollLeft = document.querySelector(".scroll-left");
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appscms-tools-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.6
4
+ version: 5.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vivek-appscms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-30 00:00:00.000000000 Z
11
+ date: 2026-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll