diff --git a/index.html b/index.html index 1ebe4be..211b5c8 100644 --- a/index.html +++ b/index.html @@ -219,12 +219,12 @@
Dan segala sesuatu Kami ciptakan berpasang-pasangan agar kamu mengingat (kebesaran Allah).
-QS. Az-Zariyat: Ayat 49
+ QS. Adh-Dhariyat: 49dan sesungguhnya Dialah yang menciptakan pasangan laki-laki dan perempuan,
-QS. An-Najm: Ayat 45
+ QS. An-Najm: 45Bestieee!!!
Cobain like seperti Instagram, dengan tap tap bagian komentarnya
diff --git a/js/admin.js b/js/admin.js index d03927f..dc61880 100644 --- a/js/admin.js +++ b/js/admin.js @@ -255,15 +255,14 @@ export const admin = (() => { if (!session.isAdmin() || !session.getToken() || (JSON.parse(window.atob(session.getToken().split('.')[1]))?.exp ?? 0) < (Date.now() / 1000)) { throw new Error('invalid token'); } + + getUserDetail(); + comment.comment(); } catch { bootstrap.Modal.getOrCreateInstance('#loginModal').show(); session.logout(); user.clear(); - return; } - - getUserDetail(); - comment.comment(); }; return { diff --git a/js/audio.js b/js/audio.js index 16bcc09..8694b66 100644 --- a/js/audio.js +++ b/js/audio.js @@ -1,9 +1,20 @@ export const audio = (() => { + /** + * @type {HTMLElement|null} + */ let music = null; + + /** + * @type {HTMLAudioElement|null} + */ let audio = null; + let isPlay = false; + const statePlay = ''; + const statePause = ''; + const init = () => { music = document.getElementById('button-music'); @@ -25,7 +36,7 @@ export const audio = (() => { try { await audio.play(); isPlay = true; - music.innerHTML = ''; + music.innerHTML = statePlay; } catch (err) { isPlay = false; alert(err); @@ -36,7 +47,7 @@ export const audio = (() => { const pause = () => { isPlay = false; audio.pause(); - music.innerHTML = ''; + music.innerHTML = statePause; }; const showButton = () => { diff --git a/js/request.js b/js/request.js index 446cbb3..49e9e22 100644 --- a/js/request.js +++ b/js/request.js @@ -15,7 +15,7 @@ export const request = (method, path) => { let url = document.body.getAttribute('data-url'); let req = { - method: method, + method: String(method).toUpperCase(), headers: new Headers({ 'Accept': 'application/json', 'Content-Type': 'application/json' diff --git a/js/session.js b/js/session.js index 1a8c625..ca120bc 100644 --- a/js/session.js +++ b/js/session.js @@ -23,13 +23,9 @@ export const session = (() => { .then((res) => res.code === 200, () => false); }; - const logout = () => { - session.unset('token'); - }; + const logout = () => session.unset('token'); - const isAdmin = () => { - return (getToken() ?? '.').split('.').length === 3; - }; + const isAdmin = () => String(getToken() ?? '.').split('.').length === 3; const guest = () => { progress.add(); diff --git a/js/util.js b/js/util.js index 7f1db7f..741171f 100644 --- a/js/util.js +++ b/js/util.js @@ -24,7 +24,7 @@ export const util = (() => { }; const escapeHtml = (unsafe) => { - return unsafe + return String(unsafe) .replace(/&/g, '&') .replace(//g, '>') @@ -118,14 +118,11 @@ export const util = (() => { return decoder.decode(decodedBytes); }; - const close = () => { - storage('information').set('info', true); - }; + const closeInformation = () => storage('information').set('info', true); return { open, copy, - close, modal, timeOut, opacity, @@ -134,6 +131,7 @@ export const util = (() => { base64Encode, base64Decode, disableButton, + closeInformation, addLoadingCheckbox, }; })(); \ No newline at end of file