appscms-tools-theme 5.0.7 → 5.0.9
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 +4 -4
- data/_data/.DS_Store +0 -0
- data/_data/home/en/en.json +238 -69
- data/_includes/.DS_Store +0 -0
- data/_includes/appscms/.DS_Store +0 -0
- data/_includes/appscms/navbars/navbar.html +209 -0
- data/_includes/appscms/scripts/script.html +107 -24
- data/_layouts/profile.html +561 -0
- data/assets/.DS_Store +0 -0
- data/assets/css/appscms-theme.css +511 -0
- data/assets/js/appscms-auth.js +9 -0
- data/assets/js/appscms-login.js +349 -0
- metadata +5 -2
@@ -0,0 +1,349 @@
|
|
1
|
+
const profileButton = document.getElementById("profileButton");
|
2
|
+
const userModal = document.getElementById("userModal");
|
3
|
+
let isModalOpen = false;
|
4
|
+
|
5
|
+
profileButton.addEventListener("click", () => {
|
6
|
+
if (isModalOpen) {
|
7
|
+
userModal.style.display = "none";
|
8
|
+
isModalOpen = false;
|
9
|
+
} else {
|
10
|
+
userModal.style.display = "block";
|
11
|
+
isModalOpen = true;
|
12
|
+
}
|
13
|
+
});
|
14
|
+
|
15
|
+
// Close modal when clicking outside
|
16
|
+
document.addEventListener("click", (event) => {
|
17
|
+
if (
|
18
|
+
!profileButton.contains(event.target) &&
|
19
|
+
!userModal.contains(event.target)
|
20
|
+
) {
|
21
|
+
userModal.style.display = "none";
|
22
|
+
isModalOpen = false;
|
23
|
+
}
|
24
|
+
});
|
25
|
+
// Get the modal elements
|
26
|
+
const modal = document.getElementById("sideModal");
|
27
|
+
const modalOverlay = document.getElementById("modalOverlay");
|
28
|
+
const openModalBtn = document.querySelector(".open-modal-btn");
|
29
|
+
const closeModalBtn = document.querySelector(".close-modal-btn");
|
30
|
+
|
31
|
+
// Function to open the modal
|
32
|
+
function openModal() {
|
33
|
+
modalOverlay.style.display = "block";
|
34
|
+
// Slight delay for the overlay to appear before the modal slides in
|
35
|
+
setTimeout(() => {
|
36
|
+
modal.style.right = "0";
|
37
|
+
}, 50);
|
38
|
+
}
|
39
|
+
|
40
|
+
// Function to close the modal
|
41
|
+
function closeModal() {
|
42
|
+
modal.style.right = "-90%";
|
43
|
+
// Wait for the animation to complete before hiding the overlay
|
44
|
+
setTimeout(() => {
|
45
|
+
modalOverlay.style.display = "none";
|
46
|
+
}, 300);
|
47
|
+
}
|
48
|
+
|
49
|
+
// Event listeners
|
50
|
+
openModalBtn.addEventListener("click", openModal);
|
51
|
+
closeModalBtn.addEventListener("click", closeModal);
|
52
|
+
modalOverlay.addEventListener("click", closeModal);
|
53
|
+
|
54
|
+
// Prevent closing when clicking inside the modal
|
55
|
+
modal.addEventListener("click", function (event) {
|
56
|
+
event.stopPropagation();
|
57
|
+
});
|
58
|
+
if (window.location.pathname === "/profile") {
|
59
|
+
document.querySelector(".login-button").addEventListener("click", openModal);
|
60
|
+
}
|
61
|
+
|
62
|
+
// Firebase configuration - Replace with your own Firebase config
|
63
|
+
|
64
|
+
// Initialize Firebase
|
65
|
+
firebase.initializeApp(firebaseConfig);
|
66
|
+
const auth = firebase.auth();
|
67
|
+
|
68
|
+
// Check for redirect result immediately when page loads
|
69
|
+
document.addEventListener("DOMContentLoaded", function () {
|
70
|
+
console.log("Checking for auth redirect...");
|
71
|
+
auth
|
72
|
+
.getRedirectResult()
|
73
|
+
.then((result) => {
|
74
|
+
if (result && result.user) {
|
75
|
+
console.log("Redirect authentication successful:", result.user);
|
76
|
+
// Twitter or other redirect login was successful
|
77
|
+
// Auth state observer will handle the UI update
|
78
|
+
} else if (result) {
|
79
|
+
console.log("Redirect completed but no user");
|
80
|
+
}
|
81
|
+
})
|
82
|
+
.catch((error) => {
|
83
|
+
console.error("Redirect result error:", error);
|
84
|
+
if (error.code !== "auth/credential-already-in-use") {
|
85
|
+
alert(`Authentication error: ${error.message}`);
|
86
|
+
}
|
87
|
+
});
|
88
|
+
});
|
89
|
+
|
90
|
+
// DOM Elements
|
91
|
+
const loginForm = document.getElementById("loginForm");
|
92
|
+
const signupForm = document.getElementById("signupForm");
|
93
|
+
const forgotPasswordForm = document.getElementById("forgotPasswordForm");
|
94
|
+
const authContainer = document.getElementById("authContainer");
|
95
|
+
const userAvatar = document.getElementById("userAvatar");
|
96
|
+
const profileUserAvatar = document.querySelector(".profile-user-avatar");
|
97
|
+
|
98
|
+
// Switch between login and signup
|
99
|
+
document.getElementById("showSignup").addEventListener("click", (e) => {
|
100
|
+
e.preventDefault();
|
101
|
+
loginForm.style.display = "none";
|
102
|
+
signupForm.style.display = "block";
|
103
|
+
forgotPasswordForm.style.display = "none";
|
104
|
+
});
|
105
|
+
|
106
|
+
document.getElementById("showLogin").addEventListener("click", (e) => {
|
107
|
+
e.preventDefault();
|
108
|
+
signupForm.style.display = "none";
|
109
|
+
loginForm.style.display = "block";
|
110
|
+
forgotPasswordForm.style.display = "none";
|
111
|
+
});
|
112
|
+
|
113
|
+
// Show forgot password form
|
114
|
+
document.getElementById("forgotPassword").addEventListener("click", (e) => {
|
115
|
+
e.preventDefault();
|
116
|
+
loginForm.style.display = "none";
|
117
|
+
forgotPasswordForm.style.display = "block";
|
118
|
+
});
|
119
|
+
|
120
|
+
// Back to login from forgot password
|
121
|
+
document.getElementById("backToLogin").addEventListener("click", () => {
|
122
|
+
forgotPasswordForm.style.display = "none";
|
123
|
+
loginForm.style.display = "block";
|
124
|
+
document.getElementById("resetSuccess").style.display = "none";
|
125
|
+
});
|
126
|
+
|
127
|
+
// Handle reset password form submission
|
128
|
+
document.getElementById("resetPasswordForm").addEventListener("submit", (e) => {
|
129
|
+
e.preventDefault();
|
130
|
+
const email = document.getElementById("resetEmail").value;
|
131
|
+
|
132
|
+
auth
|
133
|
+
.sendPasswordResetEmail(email)
|
134
|
+
.then(() => {
|
135
|
+
// Show success message
|
136
|
+
document.getElementById("resetSuccess").style.display = "block";
|
137
|
+
document.getElementById("resetPasswordForm").reset();
|
138
|
+
|
139
|
+
// Redirect after 3 seconds
|
140
|
+
setTimeout(() => {
|
141
|
+
window.location.href = window.location.origin; // Redirect to domain root
|
142
|
+
}, 3000);
|
143
|
+
})
|
144
|
+
.catch((error) => {
|
145
|
+
alert(`Error: ${error.message}`);
|
146
|
+
});
|
147
|
+
});
|
148
|
+
|
149
|
+
// Toggle password visibility
|
150
|
+
document.getElementById("toggleLoginPassword").addEventListener("click", () => {
|
151
|
+
const passwordInput = document.getElementById("loginPassword");
|
152
|
+
passwordInput.type = passwordInput.type === "password" ? "text" : "password";
|
153
|
+
});
|
154
|
+
|
155
|
+
document
|
156
|
+
.getElementById("toggleSignupPassword")
|
157
|
+
.addEventListener("click", () => {
|
158
|
+
const passwordInput = document.getElementById("signupPassword");
|
159
|
+
passwordInput.type =
|
160
|
+
passwordInput.type === "password" ? "text" : "password";
|
161
|
+
});
|
162
|
+
|
163
|
+
// Email/Password Login
|
164
|
+
document.getElementById("emailLoginForm").addEventListener("submit", (e) => {
|
165
|
+
e.preventDefault();
|
166
|
+
const email = document.getElementById("loginEmail").value;
|
167
|
+
const password = document.getElementById("loginPassword").value;
|
168
|
+
|
169
|
+
auth
|
170
|
+
.signInWithEmailAndPassword(email, password)
|
171
|
+
.then((userCredential) => {
|
172
|
+
// Signed in
|
173
|
+
const user = userCredential.user;
|
174
|
+
console.log("User logged in:", user);
|
175
|
+
})
|
176
|
+
.catch((error) => {
|
177
|
+
alert(`Login error: ${error.message}`);
|
178
|
+
});
|
179
|
+
});
|
180
|
+
|
181
|
+
// Email/Password Signup
|
182
|
+
document.getElementById("emailSignupForm").addEventListener("submit", (e) => {
|
183
|
+
e.preventDefault();
|
184
|
+
const email = document.getElementById("signupEmail").value;
|
185
|
+
const password = document.getElementById("signupPassword").value;
|
186
|
+
|
187
|
+
auth
|
188
|
+
.createUserWithEmailAndPassword(email, password)
|
189
|
+
.then((userCredential) => {
|
190
|
+
// Signed up
|
191
|
+
const user = userCredential.user;
|
192
|
+
console.log("User created:", user);
|
193
|
+
})
|
194
|
+
.catch((error) => {
|
195
|
+
alert(`Signup error: ${error.message}`);
|
196
|
+
});
|
197
|
+
});
|
198
|
+
|
199
|
+
// Google Login
|
200
|
+
document.getElementById("googleLogin").addEventListener("click", () => {
|
201
|
+
const provider = new firebase.auth.GoogleAuthProvider();
|
202
|
+
auth
|
203
|
+
.signInWithPopup(provider)
|
204
|
+
.then((result) => {
|
205
|
+
console.log("Google login successful");
|
206
|
+
})
|
207
|
+
.catch((error) => {
|
208
|
+
alert(`Google login error: ${error.message}`);
|
209
|
+
});
|
210
|
+
});
|
211
|
+
|
212
|
+
document.getElementById("googleSignup").addEventListener("click", () => {
|
213
|
+
const provider = new firebase.auth.GoogleAuthProvider();
|
214
|
+
auth
|
215
|
+
.signInWithPopup(provider)
|
216
|
+
.then((result) => {
|
217
|
+
console.log(result);
|
218
|
+
console.log("Google signup successful");
|
219
|
+
})
|
220
|
+
.catch((error) => {
|
221
|
+
alert(`Google signup error: ${error.message}`);
|
222
|
+
});
|
223
|
+
});
|
224
|
+
|
225
|
+
// Facebook Login
|
226
|
+
document.getElementById("facebookLogin").addEventListener("click", () => {
|
227
|
+
const provider = new firebase.auth.FacebookAuthProvider();
|
228
|
+
provider.addScope("email");
|
229
|
+
|
230
|
+
// Try popup instead of redirect for Facebook
|
231
|
+
auth
|
232
|
+
.signInWithPopup(provider)
|
233
|
+
.then((result) => {
|
234
|
+
console.log("Facebook login successful");
|
235
|
+
})
|
236
|
+
.catch((error) => {
|
237
|
+
console.error("Facebook login error:", error);
|
238
|
+
alert(`Facebook login error: ${error.message}`);
|
239
|
+
});
|
240
|
+
});
|
241
|
+
|
242
|
+
// Twitter Login - Try using popup method first
|
243
|
+
document.getElementById("twitterLogin").addEventListener("click", () => {
|
244
|
+
console.log("Starting Twitter login...");
|
245
|
+
const provider = new firebase.auth.TwitterAuthProvider();
|
246
|
+
|
247
|
+
try {
|
248
|
+
// Try popup method first as it provides better error feedback
|
249
|
+
auth
|
250
|
+
.signInWithPopup(provider)
|
251
|
+
.then((result) => {
|
252
|
+
console.log("Twitter login successful via popup");
|
253
|
+
})
|
254
|
+
.catch((error) => {
|
255
|
+
console.error("Twitter popup error:", error);
|
256
|
+
|
257
|
+
// If popup fails, fallback to redirect
|
258
|
+
if (
|
259
|
+
error.code === "auth/popup-blocked" ||
|
260
|
+
error.code === "auth/popup-closed-by-user"
|
261
|
+
) {
|
262
|
+
console.log("Popup blocked, trying redirect instead");
|
263
|
+
auth.signInWithRedirect(provider).catch((redirectError) => {
|
264
|
+
console.error("Twitter redirect error:", redirectError);
|
265
|
+
alert(`Twitter login error: ${redirectError.message}`);
|
266
|
+
});
|
267
|
+
} else {
|
268
|
+
alert(`Twitter login error: ${error.message}`);
|
269
|
+
}
|
270
|
+
});
|
271
|
+
} catch (e) {
|
272
|
+
console.error("Exception during Twitter login:", e);
|
273
|
+
}
|
274
|
+
});
|
275
|
+
|
276
|
+
// Logout
|
277
|
+
document.getElementById("logoutBtn").addEventListener("click", () => {
|
278
|
+
auth
|
279
|
+
.signOut()
|
280
|
+
.then(() => {
|
281
|
+
document.querySelector(".user-profile-header").style.display = "none";
|
282
|
+
window.location.reload();
|
283
|
+
console.log("User signed out");
|
284
|
+
})
|
285
|
+
.catch((error) => {
|
286
|
+
alert(`Logout error: ${error.message}`);
|
287
|
+
});
|
288
|
+
});
|
289
|
+
|
290
|
+
// Auth state observer
|
291
|
+
auth.onAuthStateChanged((user) => {
|
292
|
+
console.log(
|
293
|
+
"Auth state changed:",
|
294
|
+
user ? "User logged in" : "User logged out"
|
295
|
+
);
|
296
|
+
|
297
|
+
if (user) {
|
298
|
+
console.log(user);
|
299
|
+
|
300
|
+
const email = user.email || "No email available";
|
301
|
+
document.querySelector(".logged-in-user-email").textContent = email;
|
302
|
+
let displayName =
|
303
|
+
user.displayName || (user.email ? user.email.split("@")[0] : "User");
|
304
|
+
|
305
|
+
// Special handling for Twitter users who might not have email
|
306
|
+
if (
|
307
|
+
user.providerData[0].providerId === "twitter.com" &&
|
308
|
+
!user.displayName
|
309
|
+
) {
|
310
|
+
displayName = user.providerData[0].uid;
|
311
|
+
}
|
312
|
+
|
313
|
+
console.log("Provider:", user.providerData[0].providerId);
|
314
|
+
console.log("Display name:", displayName);
|
315
|
+
modal.style.display = "none";
|
316
|
+
modal.style.right = "-90%";
|
317
|
+
modalOverlay.style.display = "none";
|
318
|
+
document.querySelector(".logged-in-username").textContent = displayName;
|
319
|
+
document.querySelector(".login-modal-button").style.display = "none";
|
320
|
+
|
321
|
+
// Set initials for avatar
|
322
|
+
const initials = displayName
|
323
|
+
.split(" ")
|
324
|
+
.map((n) => n[0])
|
325
|
+
.join("")
|
326
|
+
.toUpperCase()
|
327
|
+
.substring(0, 2);
|
328
|
+
document.getElementById("profileButton").textContent = initials;
|
329
|
+
profileUserAvatar.textContent = initials;
|
330
|
+
document.querySelector(".user-profile-header").style.display = "block";
|
331
|
+
|
332
|
+
userAvatar.textContent = initials;
|
333
|
+
userAvatar.style.display = "flex";
|
334
|
+
if (window.location.pathname === "/profile") {
|
335
|
+
document.querySelector(".user-profile-section").style.display = "flex";
|
336
|
+
document.querySelector(".profile-login-container").style.display = "none";
|
337
|
+
document.querySelector(".avatar-large").textContent = initials;
|
338
|
+
document.querySelector("#user-email-input").value = email;
|
339
|
+
document.querySelector(".username-input").value = displayName;
|
340
|
+
|
341
|
+
console.log("You are on the profile page.");
|
342
|
+
}
|
343
|
+
} else {
|
344
|
+
userAvatar.style.display = "none";
|
345
|
+
loginForm.style.display = "block";
|
346
|
+
signupForm.style.display = "none";
|
347
|
+
forgotPasswordForm.style.display = "none";
|
348
|
+
}
|
349
|
+
});
|
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.0.
|
4
|
+
version: 5.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vivek-appscms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -259,6 +259,7 @@ files:
|
|
259
259
|
- _layouts/photo-effects-home.html
|
260
260
|
- _layouts/post.html
|
261
261
|
- _layouts/privacyPolicy.html
|
262
|
+
- _layouts/profile.html
|
262
263
|
- _layouts/termAndCondition.html
|
263
264
|
- _layouts/video.html
|
264
265
|
- assets/.DS_Store
|
@@ -542,7 +543,9 @@ files:
|
|
542
543
|
- assets/js/adBlocker.js
|
543
544
|
- assets/js/ads.js
|
544
545
|
- assets/js/append-div.js
|
546
|
+
- assets/js/appscms-auth.js
|
545
547
|
- assets/js/appscms-infographics.js
|
548
|
+
- assets/js/appscms-login.js
|
546
549
|
- assets/js/appscms-search-home1.js
|
547
550
|
- assets/js/appscms-search.js
|
548
551
|
- assets/js/appscms-theme.js
|