Skip to content

Commit

Permalink
commented out console logs for client browser
Browse files Browse the repository at this point in the history
  • Loading branch information
singharaj-usai committed Oct 1, 2024
1 parent 299fb70 commit a58d7e2
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 59 deletions.
4 changes: 2 additions & 2 deletions client/js/admin/forum.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function deleteForumPost(postId) {
'Authorization': `Bearer ${localStorage.getItem('token')}`
},
success: function(response) {
console.log('Delete post response:', response);
// console.log('Delete post response:', response);
showAlert('success', 'Post deleted successfully.');
loadForumPosts();
},
Expand All @@ -122,7 +122,7 @@ function deleteForumReply(replyId) {
'Authorization': `Bearer ${localStorage.getItem('token')}`
},
success: function(response) {
console.log('Delete reply response:', response);
// console.log('Delete reply response:', response);
showAlert('success', 'Reply deleted successfully.');
loadForumPosts();
},
Expand Down
50 changes: 8 additions & 42 deletions client/js/auth/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,49 +23,14 @@ const App = {
this.initLogout();
this.loadFooter();
this.updateAuthUI();
this.checkForAnnouncements();
this.initParticles();
// this.checkForAnnouncements();
// this.initParticles();
});
},

loadParticles: function () {
if (!document.getElementById('particles-js')) {
const particlesContainer = document.createElement('div');
particlesContainer.id = 'particles-js';
document.body.insertBefore(particlesContainer, document.body.firstChild);
}

if (typeof particlesJS === 'undefined') {
const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/[email protected]/particles.min.js';
script.onload = () => this.initParticles();
document.head.appendChild(script);
} else {
this.initParticles();
}
},

initParticles: function () {
particlesJS('particles-js', {
particles: {
number: { value: 80, density: { enable: true, value_area: 800 } },
color: { value: "#007bff" },
shape: { type: "circle" },
opacity: { value: 0.5, random: false },
size: { value: 3, random: true },
line_linked: { enable: true, distance: 150, color: "#007bff", opacity: 0.4, width: 1 },
move: { enable: true, speed: 6, direction: "none", random: false, straight: false, out_mode: "out", bounce: false }
},
interactivity: {
detect_on: "canvas",
events: { onhover: { enable: true, mode: "repulse" }, onclick: { enable: true, mode: "push" }, resize: true },
modes: { grab: { distance: 400, line_linked: { opacity: 1 } }, bubble: { distance: 400, size: 40, duration: 2, opacity: 8, speed: 3 }, repulse: { distance: 200, duration: 0.4 }, push: { particles_nb: 4 }, remove: { particles_nb: 2 } }
},
retina_detect: true
});
},


checkForAnnouncements: function () {
/* checkForAnnouncements: function () {
$.ajax({
url: "/api/announcements",
method: "GET",
Expand All @@ -78,7 +43,7 @@ const App = {
console.error("Error fetching announcements:", xhr.responseText);
},
});
},
},
showAnnouncement: function (message, type = 'info') {
$("#announcement-message").text(message);
Expand All @@ -91,6 +56,7 @@ const App = {
hideAnnouncement: function () {
$("#site-wide-announcement").hide();
},
*/

// Load navbar
loadNavbar: function () {
Expand Down Expand Up @@ -169,10 +135,10 @@ const App = {
"Authorization": `Bearer ${token}`,
},
success: (response) => {
console.log("User status updated:", response.isOnline);
// console.log("User status updated:", response.isOnline);
},
error: (xhr, status, error) => {
console.error("Error updating user status:", error);
// console.error("Error updating user status:", error);
if (xhr.status === 401) {
// Token is invalid or expired, log out the user
this.logout();
Expand Down
4 changes: 2 additions & 2 deletions client/js/forum/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $(document).ready(function() {
});

function initHomePage() {
console.log('Initializing home page');
// console.log('Initializing home page');
loadForumSections('all');
const urlParams = new URLSearchParams(window.location.search);
const page = parseInt(urlParams.get('page')) || 1;
Expand All @@ -32,7 +32,7 @@ function initHomePage() {

function initSectionPage() {
const section = window.location.pathname.split('/').pop();
console.log('Initializing section page for:', section);
// console.log('Initializing section page for:', section);
updateSectionTitle(section);
loadForumSections(section);
const urlParams = new URLSearchParams(window.location.search);
Expand Down
4 changes: 2 additions & 2 deletions client/js/forum/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ function getSectionIconClass(sectionId) {
}

function loadSectionPosts(section, page = 1) {
console.log('Loading posts for section:', section);
// console.log('Loading posts for section:', section);
const apiUrl = section === 'all' ? '/api/forum/sections' : `/api/forum/sections/${section}`;
$.ajax({
url: apiUrl,
method: 'GET',
data: { page: page, limit: postsPerPage },
success: function(response) {
console.log('Received posts:', response.posts);
// console.log('Received posts:', response.posts);
displayPosts(response.posts, '#section-posts');
displayPagination(response.totalPages, page, section);
updateSectionTitle(section);
Expand Down
2 changes: 1 addition & 1 deletion client/js/friends/init.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$(document).ready(function() {
console.log('Friends page initialized');
//console.log('Friends page initialized');
const token = localStorage.getItem('token');

if (!token) {
Expand Down
4 changes: 2 additions & 2 deletions client/js/friends/list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function fetchFriendsList() {
console.log('Fetching friends list');
//console.log('Fetching friends list');
const token = localStorage.getItem('token');
$.ajax({
url: '/api/friends',
Expand All @@ -8,7 +8,7 @@ function fetchFriendsList() {
"Authorization": `Bearer ${token}`
},
success: function(friends) {
console.log('Friends list received:', friends);
// console.log('Friends list received:', friends);
displayFriendsList(friends);
},
error: function(xhr, status, error) {
Expand Down
4 changes: 2 additions & 2 deletions client/js/friends/requests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function fetchFriendRequests() {
console.log('Fetching friend requests');
// console.log('Fetching friend requests');
const token = localStorage.getItem('token');
$.ajax({
url: '/api/friend-requests',
Expand All @@ -8,7 +8,7 @@ function fetchFriendRequests() {
"Authorization": `Bearer ${token}`
},
success: function(requests) {
console.log('Friend requests received:', requests);
// console.log('Friend requests received:', requests);
displayFriendRequests(requests);
},
error: function(xhr, status, error) {
Expand Down
2 changes: 1 addition & 1 deletion client/js/games/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const GamesDisplay = {
},

createGameElement: function(game) {
console.log('Game thumbnailUrl:', game.thumbnailUrl);
// console.log('Game thumbnailUrl:', game.thumbnailUrl);
return `
<div class="col-md-3 col-sm-6 mb-4">
<div class="thumbnail" style="position: relative;">
Expand Down
6 changes: 2 additions & 4 deletions client/js/places.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ $(document).ready(function () {
</div>
<div class="panel-body">
<div style="position: relative; width: 100%; padding-top: 56.25%;">
${console.log('Game year:', game.year)}
${game.year ? `<span class="badge" style="position: absolute; top: 10px; left: 10px; z-index: 1; background-color: #337ab7;">${game.year}</span>` : ''}
<img src="${game.thumbnailUrl}" alt="${escapeHtml(game.title)}" class="img-responsive" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover;">
</div>
Expand Down Expand Up @@ -133,7 +132,6 @@ $(document).ready(function () {
function openEditModal(gameId) {
const game = games.find(g => g._id === gameId);
if (game) {
console.log('Game being edited:', game);
$('#edit-game-id').val(game._id);
$('#edit-title').val(game.title);
$('#edit-description').val(game.description);
Expand All @@ -152,7 +150,7 @@ $(document).ready(function () {
return;
}

console.log(`Sending DELETE request for game ID: ${gameId}`);
// console.log(`Sending DELETE request for game ID: ${gameId}`);

$.ajax({
url: `/api/games/${gameId}`,
Expand All @@ -161,7 +159,7 @@ $(document).ready(function () {
'Authorization': `Bearer ${token}`
},
success: function (response) {
console.log('Game deleted successfully:', response);
// console.log('Game deleted successfully:', response);
fetchUserGames(); // Refresh the games list
showSuccess('Game deleted successfully');
},
Expand Down
2 changes: 1 addition & 1 deletion client/js/user-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ $(document).ready(function () {
// Initialize Bootstrap tabs
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
// You can add logic here to load items dynamically if needed
console.log('Tab switched to: ' + $(e.target).attr('href'));
// console.log('Tab switched to: ' + $(e.target).attr('href'));
});
}

Expand Down

0 comments on commit a58d7e2

Please sign in to comment.