appscms-tools-theme 5.1.9 → 5.2.0

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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/_data/.DS_Store +0 -0
  3. data/_data/aitools/en/all-in-one-social-post.json +217 -0
  4. data/_data/aitools/en/amazon-product-bullet-points-generator.json +2 -0
  5. data/_data/aitools/en/amazon-product-description-generator.json +15 -0
  6. data/_data/aitools/en/blog-conclusion-generator.json +253 -0
  7. data/_data/aitools/en/blog-content-calendar.json +232 -0
  8. data/_data/aitools/en/blog-introduction-generator.json +246 -0
  9. data/_data/aitools/en/blog-outline-generator.json +232 -0
  10. data/_data/aitools/en/blog-section-generator.json +253 -0
  11. data/_data/aitools/en/blog-title-generator.json +232 -0
  12. data/_data/aitools/en/blog-topic-ideas.json +232 -0
  13. data/_data/aitools/en/caption-generator.json +271 -0
  14. data/_data/aitools/en/engagement-post-generator.json +251 -0
  15. data/_data/aitools/en/facebook-post.json +232 -0
  16. data/_data/aitools/en/hidden-fact-finder.json +232 -0
  17. data/_data/aitools/en/human-written-blog-post.json +232 -0
  18. data/_data/aitools/en/instagram-bio-generator.json +246 -0
  19. data/_data/aitools/en/instagram-caption.json +232 -0
  20. data/_data/aitools/en/instagram-carousel.json +250 -0
  21. data/_data/aitools/en/instagram-hashtag-generator.json +246 -0
  22. data/_data/aitools/en/instagram-name-generator.json +239 -0
  23. data/_data/aitools/en/instagram-threads-generator.json +239 -0
  24. data/_data/aitools/en/interactive-content-creator.json +252 -0
  25. data/_data/aitools/en/linkedin-hashtag-generator.json +239 -0
  26. data/_data/aitools/en/linkedin-post.json +232 -0
  27. data/_data/aitools/en/motivational-posts.json +239 -0
  28. data/_data/aitools/en/pinterest-pin.json +217 -0
  29. data/_data/aitools/en/platform-specific-content-generator.json +246 -0
  30. data/_data/aitools/en/quick-article-writer.json +253 -0
  31. data/_data/aitools/en/replies-for-facebook.json +239 -0
  32. data/_data/aitools/en/replies-for-instagram.json +239 -0
  33. data/_data/aitools/en/replies-for-linkedin.json +239 -0
  34. data/_data/aitools/en/replies-for-twitter.json +239 -0
  35. data/_data/aitools/en/rewrite-article-with-keywords.json +246 -0
  36. data/_data/aitools/en/script-for-instagram-reel.json +246 -0
  37. data/_data/aitools/en/script-for-tiktok-video.json +246 -0
  38. data/_data/aitools/en/seo-optimized-blog-post.json +239 -0
  39. data/_data/aitools/en/snapchat-caption-maker.json +245 -0
  40. data/_data/aitools/en/social-media-bio-creator.json +274 -0
  41. data/_data/aitools/en/social-media-bio-generator.json +246 -0
  42. data/_data/aitools/en/social-media-calendar.json +250 -0
  43. data/_data/aitools/en/tiktok-caption.json +232 -0
  44. data/_data/aitools/en/tiktok-username-generator.json +239 -0
  45. data/_data/aitools/en/twitter-poll-generator.json +250 -0
  46. data/_data/aitools/en/twitter-post.json +272 -0
  47. data/_data/contenttool/en/features.json +217 -10
  48. data/_includes/.DS_Store +0 -0
  49. data/_layouts/appscms-feature.html +1 -1
  50. data/_layouts/content-tool-ai.html +38 -156
  51. data/assets/.DS_Store +0 -0
  52. data/assets/css/content-tool-ai.css +42 -12
  53. metadata +44 -78
  54. data/_includes/aitools/ai-article-writer.html +0 -0
  55. data/_includes/aitools/amazon-product-bullet-points-generator.html +0 -0
  56. data/_includes/aitools/amazon-product-description-generator.html +0 -0
  57. data/_includes/aitools/brand-name-generator.html +0 -0
  58. data/_includes/aitools/product-description.html +0 -0
  59. data/assets/js/.DS_Store +0 -0
  60. data/assets/js/TopScroll.js +0 -8
  61. data/assets/js/adBlocker.js +0 -68
  62. data/assets/js/ads.js +0 -8
  63. data/assets/js/ai-article-writer.js +0 -0
  64. data/assets/js/amazon-product-bullet-points-generator.js +0 -464
  65. data/assets/js/amazon-product-bullet-points-generator3.js +0 -176
  66. data/assets/js/amazon-product-description-generator.js +0 -309
  67. data/assets/js/append-div.js +0 -10
  68. data/assets/js/appscms-infographics.js +0 -0
  69. data/assets/js/appscms-login.js +0 -447
  70. data/assets/js/appscms-search-home1.js +0 -136
  71. data/assets/js/appscms-search.js +0 -133
  72. data/assets/js/appscms-theme.js +0 -459
  73. data/assets/js/batch.js +0 -219
  74. data/assets/js/blog-topic-ideas.js +0 -57
  75. data/assets/js/brand-name-generator.js +0 -127
  76. data/assets/js/calculator-tooltip.js +0 -3
  77. data/assets/js/devtools.js +0 -82
  78. data/assets/js/face-api.js +0 -38064
  79. data/assets/js/face-detection.js +0 -303
  80. data/assets/js/faceSystem.js +0 -0
  81. data/assets/js/featureResult.js +0 -48
  82. data/assets/js/frame.js +0 -264
  83. data/assets/js/googledrive.js +0 -158
  84. data/assets/js/homeResult.js +0 -37
  85. data/assets/js/human-written-blog-post.js +0 -57
  86. data/assets/js/instagram-caption.js +0 -57
  87. data/assets/js/instagram-hashtag-generator.js +0 -10
  88. data/assets/js/instagram-name-generator.js +0 -61
  89. data/assets/js/manifest.json +0 -17
  90. data/assets/js/models/age_gender_model-shard1 +0 -0
  91. data/assets/js/models/age_gender_model-weights_manifest.json +0 -1
  92. data/assets/js/models/face_expression_model-shard1 +0 -0
  93. data/assets/js/models/face_expression_model-weights_manifest.json +0 -1
  94. data/assets/js/models/face_landmark_68_model-shard1 +0 -0
  95. data/assets/js/models/face_landmark_68_model-weights_manifest.json +0 -1
  96. data/assets/js/models/face_landmark_68_tiny_model-shard1 +0 -0
  97. data/assets/js/models/face_landmark_68_tiny_model-weights_manifest.json +0 -1
  98. data/assets/js/models/face_recognition_model-shard1 +0 -0
  99. data/assets/js/models/face_recognition_model-shard2 +0 -6
  100. data/assets/js/models/face_recognition_model-weights_manifest.json +0 -1
  101. data/assets/js/models/mtcnn_model-shard1 +0 -0
  102. data/assets/js/models/mtcnn_model-weights_manifest.json +0 -1
  103. data/assets/js/models/ssd_mobilenetv1_model-shard1 +0 -0
  104. data/assets/js/models/ssd_mobilenetv1_model-shard2 +8 -137
  105. data/assets/js/models/ssd_mobilenetv1_model-weights_manifest.json +0 -1
  106. data/assets/js/models/tiny_face_detector_model-shard1 +0 -0
  107. data/assets/js/models/tiny_face_detector_model-weights_manifest.json +0 -1
  108. data/assets/js/multiselect.js +0 -185
  109. data/assets/js/partytown/debug/partytown-atomics.js +0 -929
  110. data/assets/js/partytown/debug/partytown-media.js +0 -374
  111. data/assets/js/partytown/debug/partytown-sandbox-sw.js +0 -920
  112. data/assets/js/partytown/debug/partytown-sw.js +0 -59
  113. data/assets/js/partytown/debug/partytown-ww-atomics.js +0 -2699
  114. data/assets/js/partytown/debug/partytown-ww-sw.js +0 -2691
  115. data/assets/js/partytown/debug/partytown.js +0 -114
  116. data/assets/js/partytown/partytown-atomics.js +0 -600
  117. data/assets/js/partytown/partytown-media.js +0 -2
  118. data/assets/js/partytown/partytown-sw.js +0 -50
  119. data/assets/js/perspective.min.js +0 -182
  120. data/assets/js/photo-effects.json +0 -85
  121. data/assets/js/product-description.js +0 -299
  122. data/assets/js/redirectResult.js +0 -10
  123. data/assets/js/sharePage.js +0 -65
  124. data/assets/js/testing-batch.js +0 -39
  125. data/assets/js/theme.js +0 -104
  126. data/assets/js/usageTracking.js +0 -143
  127. data/assets/js/usageTrackingEvents.js +0 -6
  128. data/assets/js/userUsageCount.js +0 -0
  129. data/assets/js/webvitals.js +0 -5
@@ -1,447 +0,0 @@
1
- ---
2
- ---
3
-
4
- const profileButton = document.getElementById("profileButton");
5
- const userModal = document.getElementById("userModal");
6
- let isModalOpen = false;
7
-
8
- if (profileButton && userModal) {
9
- profileButton.addEventListener("click", () => {
10
- if (isModalOpen) {
11
- userModal.style.display = "none";
12
- isModalOpen = false;
13
- } else {
14
- userModal.style.display = "block";
15
- isModalOpen = true;
16
- }
17
- });
18
-
19
- // Close modal when clicking outside
20
- document.addEventListener("click", (event) => {
21
- if (
22
- profileButton &&
23
- userModal &&
24
- !profileButton.contains(event.target) &&
25
- !userModal.contains(event.target)
26
- ) {
27
- userModal.style.display = "none";
28
- isModalOpen = false;
29
- }
30
- });
31
- }
32
-
33
- // Get the modal elements
34
- const sideModal = document.getElementById("sideModal");
35
- const modalOverlayy = document.getElementById("modalOverlay");
36
- const openModalBtn = document.querySelector(".open-modal-btn");
37
- const closeModalBtn = document.querySelector(".close-modal-btn");
38
-
39
- // Function to open the modal
40
- function openModal() {
41
- if (modalOverlayy && sideModal) {
42
- modalOverlayy.style.display = "block";
43
- setTimeout(() => {
44
- sideModal.style.right = "0";
45
- }, 50);
46
- }
47
- }
48
-
49
- // Function to close the modal
50
- function closeModal() {
51
- if (sideModal && modalOverlayy) {
52
- sideModal.style.right = "-90%";
53
- setTimeout(() => {
54
- modalOverlayy.style.display = "none";
55
- }, 300);
56
- }
57
- }
58
-
59
- // Event listeners
60
- if (openModalBtn) {
61
- openModalBtn.addEventListener("click", openModal);
62
- }
63
-
64
- if (closeModalBtn) {
65
- closeModalBtn.addEventListener("click", closeModal);
66
- }
67
-
68
- if (modalOverlayy) {
69
- modalOverlayy.addEventListener("click", closeModal);
70
- }
71
-
72
- if (sideModal) {
73
- sideModal.addEventListener("click", function (event) {
74
- event.stopPropagation();
75
- });
76
- }
77
-
78
- if (
79
- window.location.pathname === "/profile" &&
80
- document.querySelector(".login-button")
81
- ) {
82
- document.querySelector(".login-button").addEventListener("click", openModal);
83
- }
84
-
85
- // Firebase configuration
86
- let firebaseConfig;
87
-
88
- async function loadFirebaseConfig() {
89
- try {
90
- const hostname = window.location.hostname;
91
- let baseUrl = "";
92
-
93
- if (hostname === "localhost" || hostname === "127.0.0.1") {
94
- baseUrl = "http://localhost:9000";
95
- }
96
-
97
- const response = await fetch(
98
- `${baseUrl}/.netlify/functions/get-firebase-config`
99
- );
100
-
101
- if (response.ok) {
102
- firebaseConfig = await response.json();
103
-
104
- if (
105
- firebaseConfig.apiKey &&
106
- firebaseConfig.authDomain &&
107
- firebaseConfig.projectId
108
- ) {
109
- if (typeof firebase !== "undefined") {
110
- initializeFirebase();
111
- } else {
112
- console.error("Firebase SDK not loaded");
113
- }
114
- } else {
115
- console.error("Incomplete Firebase configuration received");
116
- }
117
- } else {
118
- console.error("Failed to load Firebase config:", response.status);
119
- }
120
- } catch (error) {
121
- console.log(error);
122
- console.error("Error loading Firebase config:", error);
123
- }
124
- }
125
-
126
- function initializeFirebase() {
127
- if (!firebase.apps.length) {
128
- firebase.initializeApp(firebaseConfig);
129
- setupAuthListeners();
130
- }
131
- }
132
-
133
- function setupAuthListeners() {
134
- const auth = firebase.auth();
135
-
136
- auth
137
- .getRedirectResult()
138
- .then((result) => {
139
- if (result && result.user) {
140
- // Successful redirect login
141
- }
142
- })
143
- .catch((error) => {
144
- console.error("Redirect result error:", error);
145
- if (error.code !== "auth/credential-already-in-use") {
146
- alert(`Authentication error: ${error.message}`);
147
- }
148
- });
149
-
150
- const loginForm = document.getElementById("loginForm");
151
- const signupForm = document.getElementById("signupForm");
152
- const forgotPasswordForm = document.getElementById("forgotPasswordForm");
153
- const userAvatar = document.getElementById("userAvatar");
154
- const profileUserAvatar = document.querySelector(".profile-user-avatar");
155
-
156
- const showSignupBtn = document.getElementById("showSignup");
157
- if (showSignupBtn) {
158
- showSignupBtn.addEventListener("click", (e) => {
159
- e.preventDefault();
160
- if (loginForm) loginForm.style.display = "none";
161
- if (signupForm) signupForm.style.display = "block";
162
- if (forgotPasswordForm) forgotPasswordForm.style.display = "none";
163
- });
164
- }
165
-
166
- const showLoginBtn = document.getElementById("showLogin");
167
- if (showLoginBtn) {
168
- showLoginBtn.addEventListener("click", (e) => {
169
- e.preventDefault();
170
- if (signupForm) signupForm.style.display = "none";
171
- if (loginForm) loginForm.style.display = "block";
172
- if (forgotPasswordForm) forgotPasswordForm.style.display = "none";
173
- });
174
- }
175
-
176
- const forgotPasswordBtn = document.getElementById("forgotPassword");
177
- if (forgotPasswordBtn) {
178
- forgotPasswordBtn.addEventListener("click", (e) => {
179
- e.preventDefault();
180
- if (loginForm) loginForm.style.display = "none";
181
- if (forgotPasswordForm) forgotPasswordForm.style.display = "block";
182
- });
183
- }
184
-
185
- const backToLoginBtn = document.getElementById("backToLogin");
186
- if (backToLoginBtn) {
187
- backToLoginBtn.addEventListener("click", () => {
188
- if (forgotPasswordForm) forgotPasswordForm.style.display = "none";
189
- if (loginForm) loginForm.style.display = "block";
190
- const resetSuccess = document.getElementById("resetSuccess");
191
- if (resetSuccess) resetSuccess.style.display = "none";
192
- });
193
- }
194
-
195
- const resetPasswordForm = document.getElementById("resetPasswordForm");
196
- if (resetPasswordForm) {
197
- resetPasswordForm.addEventListener("submit", (e) => {
198
- e.preventDefault();
199
- const resetEmail = document.getElementById("resetEmail");
200
- if (!resetEmail) return;
201
-
202
- const email = resetEmail.value;
203
-
204
- const actionCodeSettings = {
205
- url: "https://pdftoolkit-develop.netlify.app/",
206
- handleCodeInApp: false,
207
- };
208
-
209
- auth
210
- .sendPasswordResetEmail(email, actionCodeSettings)
211
- .then(() => {
212
- const resetSuccess = document.getElementById("resetSuccess");
213
- if (resetSuccess) resetSuccess.style.display = "block";
214
- resetPasswordForm.reset();
215
- })
216
- .catch((error) => {
217
- alert(`Error: ${error.message}`);
218
- });
219
- });
220
- }
221
-
222
- const toggleLoginPassword = document.getElementById("toggleLoginPassword");
223
- if (toggleLoginPassword) {
224
- toggleLoginPassword.addEventListener("click", () => {
225
- const passwordInput = document.getElementById("loginPassword");
226
- if (passwordInput) {
227
- passwordInput.type =
228
- passwordInput.type === "password" ? "text" : "password";
229
- }
230
- });
231
- }
232
-
233
- const toggleSignupPassword = document.getElementById("toggleSignupPassword");
234
- if (toggleSignupPassword) {
235
- toggleSignupPassword.addEventListener("click", () => {
236
- const passwordInput = document.getElementById("signupPassword");
237
- if (passwordInput) {
238
- passwordInput.type =
239
- passwordInput.type === "password" ? "text" : "password";
240
- }
241
- });
242
- }
243
-
244
- const emailLoginForm = document.getElementById("emailLoginForm");
245
- if (emailLoginForm) {
246
- emailLoginForm.addEventListener("submit", (e) => {
247
- e.preventDefault();
248
- const loginEmail = document.getElementById("loginEmail");
249
- const loginPassword = document.getElementById("loginPassword");
250
- if (!loginEmail || !loginPassword) return;
251
-
252
- auth
253
- .signInWithEmailAndPassword(loginEmail.value, loginPassword.value)
254
- .then(() => {})
255
- .catch((error) => {
256
- alert(`Login error: ${error.message}`);
257
- });
258
- });
259
- }
260
-
261
- const emailSignupForm = document.getElementById("emailSignupForm");
262
- if (emailSignupForm) {
263
- emailSignupForm.addEventListener("submit", (e) => {
264
- e.preventDefault();
265
- const signupEmail = document.getElementById("signupEmail");
266
- const signupPassword = document.getElementById("signupPassword");
267
- if (!signupEmail || !signupPassword) return;
268
-
269
- auth
270
- .createUserWithEmailAndPassword(signupEmail.value, signupPassword.value)
271
- .then(() => {})
272
- .catch((error) => {
273
- alert(`Signup error: ${error.message}`);
274
- });
275
- });
276
- }
277
-
278
- const googleLoginBtn = document.getElementById("googleLogin");
279
- if (googleLoginBtn) {
280
- googleLoginBtn.addEventListener("click", () => {
281
- const provider = new firebase.auth.GoogleAuthProvider();
282
- auth
283
- .signInWithPopup(provider)
284
- .then(() => {})
285
- .catch((error) => {
286
- alert(`Google login error: ${error.message}`);
287
- });
288
- });
289
- }
290
-
291
- const googleSignupBtn = document.getElementById("googleSignup");
292
- if (googleSignupBtn) {
293
- googleSignupBtn.addEventListener("click", () => {
294
- const provider = new firebase.auth.GoogleAuthProvider();
295
- auth
296
- .signInWithPopup(provider)
297
- .then(() => {})
298
- .catch((error) => {
299
- alert(`Google signup error: ${error.message}`);
300
- });
301
- });
302
- }
303
-
304
- const facebookLoginBtn = document.getElementById("facebookLogin");
305
- if (facebookLoginBtn) {
306
- facebookLoginBtn.addEventListener("click", () => {
307
- const provider = new firebase.auth.FacebookAuthProvider();
308
- provider.addScope("email");
309
-
310
- auth
311
- .signInWithPopup(provider)
312
- .then(() => {})
313
- .catch((error) => {
314
- console.error("Facebook login error:", error);
315
- alert(`Facebook login error: ${error.message}`);
316
- });
317
- });
318
- }
319
-
320
- const twitterLoginBtn = document.getElementById("twitterLogin");
321
- if (twitterLoginBtn) {
322
- twitterLoginBtn.addEventListener("click", () => {
323
- const provider = new firebase.auth.TwitterAuthProvider();
324
- auth
325
- .signInWithPopup(provider)
326
- .then(() => {})
327
- .catch((error) => {
328
- console.error("Twitter popup error:", error);
329
- if (
330
- error.code === "auth/popup-blocked" ||
331
- error.code === "auth/popup-closed-by-user"
332
- ) {
333
- auth.signInWithRedirect(provider).catch((redirectError) => {
334
- console.error("Twitter redirect error:", redirectError);
335
- alert(`Twitter login error: ${redirectError.message}`);
336
- });
337
- } else {
338
- alert(`Twitter login error: ${error.message}`);
339
- }
340
- });
341
- });
342
- }
343
-
344
- const logoutBtn = document.getElementById("logoutBtn");
345
- if (logoutBtn) {
346
- logoutBtn.addEventListener("click", () => {
347
- auth
348
- .signOut()
349
- .then(() => {
350
- const userProfileHeader = document.querySelector(
351
- ".user-profile-header"
352
- );
353
- if (userProfileHeader) userProfileHeader.style.display = "none";
354
- window.location.reload();
355
- })
356
- .catch((error) => {
357
- alert(`Logout error: ${error.message}`);
358
- });
359
- });
360
- }
361
-
362
- auth.onAuthStateChanged((user) => {
363
- if (user) {
364
- const email = user.email || "No email available";
365
- const loggedInUserEmail = document.querySelector(".logged-in-user-email");
366
- if (loggedInUserEmail) loggedInUserEmail.textContent = email;
367
-
368
- let displayName =
369
- user.displayName || (user.email ? user.email.split("@")[0] : "User");
370
-
371
- if (
372
- user.providerData[0].providerId === "twitter.com" &&
373
- !user.displayName
374
- ) {
375
- displayName = user.providerData[0].uid;
376
- }
377
-
378
- if (sideModal) {
379
- sideModal.style.display = "none";
380
- sideModal.style.right = "-90%";
381
- }
382
-
383
- if (modalOverlayy) {
384
- modalOverlayy.style.display = "none";
385
- }
386
-
387
- const loggedInUsername = document.querySelector(".logged-in-username");
388
- if (loggedInUsername) loggedInUsername.textContent = displayName;
389
-
390
- const loginModalButton = document.querySelector(".login-modal-button");
391
- if (loginModalButton) loginModalButton.style.display = "none";
392
-
393
- const initials = displayName
394
- .split(" ")
395
- .map((n) => n[0])
396
- .join("")
397
- .toUpperCase()
398
- .substring(0, 2);
399
-
400
- if (profileButton) profileButton.textContent = initials;
401
- if (profileUserAvatar) profileUserAvatar.textContent = initials;
402
-
403
- const userProfileHeader = document.querySelector(".user-profile-header");
404
- if (userProfileHeader) userProfileHeader.style.display = "block";
405
-
406
- if (userAvatar) {
407
- userAvatar.textContent = initials;
408
- userAvatar.style.display = "flex";
409
- }
410
-
411
- if (window.location.pathname === "/profile") {
412
- const userProfileSection = document.querySelector(
413
- ".user-profile-section"
414
- );
415
- if (userProfileSection)
416
- userProfileSection.style.display = "flex";
417
-
418
- const profileLoginContainer = document.querySelector(
419
- ".profile-login-container"
420
- );
421
- if (profileLoginContainer)
422
- profileLoginContainer.style.display = "none";
423
-
424
- const avatarLarge = document.querySelector(".avatar-large");
425
- if (avatarLarge) avatarLarge.textContent = initials;
426
-
427
- const userEmailInput = document.querySelector("#user-email-input");
428
- if (userEmailInput) userEmailInput.value = email;
429
-
430
- const usernameInput = document.querySelector(".username-input");
431
- if (usernameInput) usernameInput.value = displayName;
432
- }
433
- } else {
434
- if (userAvatar) userAvatar.style.display = "none";
435
- if (loginForm) loginForm.style.display = "block";
436
- if (signupForm) signupForm.style.display = "none";
437
- if (forgotPasswordForm) forgotPasswordForm.style.display = "none";
438
- }
439
- });
440
- }
441
-
442
- // Initialize the app
443
- if (document.readyState === "loading") {
444
- document.addEventListener("DOMContentLoaded", loadFirebaseConfig);
445
- } else {
446
- loadFirebaseConfig();
447
- }
@@ -1,136 +0,0 @@
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('/searchbar1.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
-
83
- const featureList = document.querySelector('.home1-features');
84
- const renderFeatures = (query) => {
85
- featureList.innerHTML = "";
86
- const currentFeatures = getFeatureSet();
87
- const filteredFeatures = currentFeatures.filter(currentFeatures =>
88
- currentFeatures.name.toLowerCase().includes(query.toLowerCase())
89
- );
90
-
91
- if (filteredFeatures.length > 0) {
92
- filteredFeatures.forEach(item => {
93
- const listItem = document.createElement("li");
94
- listItem.classList.add("home1-features-box");
95
-
96
- listItem.innerHTML = `
97
- <div class="home1-inner-box">
98
- <a class="home1-feature-name" href="${item.url}">
99
- <div class="home1-feature-text">${truncate(item.name, 33, '..')}</div>
100
- </a>
101
- <div style="background: ${item.color};" class="home1-feature-img" height="30px" width="30px">
102
- <img style="padding:5px;" src="${item.icon}" height="32px" width="32px" alt="home1-feature-icon" crossorigin="">
103
- </div>
104
- <div class="home1-right-arrow-icon">
105
- <div style="width:24px;height:24px">
106
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
107
- <path d="M9 7L10 6L16 12L10 18L9 17L14.17 12L9 7Z"></path>
108
- </svg>
109
- </div>
110
- </div>
111
- <p class="home1-feature-desc">${truncate(item.description, 67, '..')}</p>
112
- </div>
113
- `;
114
- featureList.appendChild(listItem);
115
- });
116
- } else {
117
- let msg = document.createElement('div');
118
- msg.classList.add('no-result-found-msg');
119
- msg.innerHTML = "No search results found!";
120
- featureList.appendChild(msg);
121
- }
122
- };
123
-
124
- function truncate(str, length, ending = '..') {
125
- if (!str) return '';
126
- return str.length > length ? str.substring(0, length) + ending : str;
127
- }
128
-
129
- const searchInput = document.querySelector('#search-features');
130
- searchInput.addEventListener("input", function () {
131
- const query = searchInput.value.trim();
132
- renderFeatures(query);
133
- });
134
-
135
- // Initialize by fetching data
136
- fetchFeatures();