Skip to content

Commit

Permalink
refactor: init module
Browse files Browse the repository at this point in the history
  • Loading branch information
dewanakl committed Dec 23, 2024
1 parent 44566ef commit d188a42
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
3 changes: 3 additions & 0 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { navbar } from './navbar.js';
import { storage } from './storage.js';
import { session } from './session.js';
import { comment } from './comment.js';
import { offline } from './offline.js';
import { bootstrap } from './bootstrap.js';
import { request, HTTP_GET, HTTP_PATCH, HTTP_PUT } from './request.js';

Expand Down Expand Up @@ -235,7 +236,9 @@ export const admin = (() => {
};

const init = () => {
theme.init();
session.init();
offline.init();
user = storage('user');

if (!session.isAdmin()) {
Expand Down
5 changes: 0 additions & 5 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@ import { like } from './like.js';
import { guest } from './guest.js';
import { theme } from './theme.js';
import { audio } from './audio.js';
import { offline } from './offline.js';
import { comment } from './comment.js';
import { pagination } from './pagination.js';

document.addEventListener('DOMContentLoaded', () => {
audio.init();
guest.init();
theme.init();
offline.init();
pagination.init();
window.AOS.init();

window.like = like;
Expand Down
1 change: 1 addition & 0 deletions js/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ export const comment = (() => {
const init = () => {
like.init();
card.init();
pagination.init();

owns = storage('owns');
user = storage('user');
Expand Down
4 changes: 0 additions & 4 deletions js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ import { like } from './like.js';
import { util } from './util.js';
import { admin } from './admin.js';
import { theme } from './theme.js';
import { offline } from './offline.js';
import { comment } from './comment.js';
import { pagination } from './pagination.js';

document.addEventListener('DOMContentLoaded', () => {
admin.init();
theme.init();
offline.init();
pagination.init();

window.util = util;
window.like = like;
Expand Down
4 changes: 4 additions & 0 deletions js/guest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { theme } from './theme.js';
import { session } from './session.js';
import { storage } from './storage.js';
import { comment } from './comment.js';
import { offline } from './offline.js';
import { progress } from './progress.js';
import { confetti } from './confetti.js';
import { bootstrap } from './bootstrap.js';
Expand Down Expand Up @@ -162,7 +163,10 @@ export const guest = (() => {
const closeInformation = () => information.set('info', true);

const init = () => {
audio.init();
theme.init();
session.init();
offline.init();
countDownDate();
information = storage('information');

Expand Down

0 comments on commit d188a42

Please sign in to comment.