Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
119 lines (98 loc) · 3.28 KB
/
Copy pathscript.js
File metadata and controls
119 lines (98 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
const hashnavbarcor = {
'': 'home-navbtn',
home: 'home-navbtn',
search: 'search-navbtn',
library: 'library-navbtn',
settings: 'settings-navbtn',
profile: 'profile-navbtn'
};
const wireframes = {
'': 'wireframe-home',
home: 'wireframe-home',
search: 'wireframe-search',
library: 'wireframe-library',
settings: 'wireframe-settings',
profile: 'wireframe-profile'
};
const isMobile = () => { return window.matchMedia('(max-width: 768px)').matches; };
let currentnav = hashnavbarcor['home'];
let currentnavelement = document.getElementById(currentnav);
let currentwire = wireframes['home'];
let currentwireelement = document.getElementById(currentwire);
window.onhashchange = () => {
const hash = window.location.hash;
const hashsanitized = hash.replace('#', '');
let elem;
if (hashsanitized in hashnavbarcor) {
currentnavelement.classList.remove('bg-red-500/35', 'text-white');
currentnavelement.classList.add(
'hover:bg-red-500/10',
'hover:text-white',
'text-zinc-300'
);
elem = document.getElementById(hashnavbarcor[hashsanitized]);
elem.classList.remove(
'hover:bg-red-500/10',
'hover:text-white',
'text-zinc-300'
);
elem.classList.add('bg-red-500/35', 'text-white');
currentnavelement = elem;
currentnav = hashnavbarcor[hashsanitized];
const wireframeelement = document.getElementById(wireframes[hashsanitized]);
currentwireelement.classList.add('hidden');
wireframeelement.classList.remove('hidden');
currentwire = wireframes[hashsanitized];
currentwireelement = document.getElementById(currentwire);
if (isMobile()) window.closeMenuMobile();
return;
} else {
const homebtnelem = document.getElementById(hashnavbarcor['home']);
homebtnelem.classList.remove(
'hover:bg-red-500/10',
'hover:text-white',
'text-zinc-300'
);
homebtnelem.classList.add('bg-red-500/35', 'text-white');
if (isMobile()) window.closeMenuMobile();
return;
}
const homebtnelem = document.getElementById(hashnavbarcor['home']);
homebtnelem.classList.remove(
'hover:bg-red-500/10',
'hover:text-white',
'text-zinc-300'
);
homebtnelem.classList.add('bg-red-500/35', 'text-white');
};
lucide.createIcons();
window.location.hash = 'home';
const homebtnelem = document.getElementById(hashnavbarcor['home']);
homebtnelem.classList.remove(
'hover:bg-red-500/10',
'hover:text-white',
'text-zinc-300'
);
homebtnelem.classList.add('bg-red-500/35', 'text-white');
function searchLRCRED(title, artist) { }
window.closeMosaicPopup = function (element) {
element.parentElement.style.opacity = "0";
document.getElementById("mosaicpopupblur").style.opacity = "0";
setTimeout(() => {
element.parentElement.remove();
document.getElementById("mosaicpopupblur")?.remove();
}, 150);
}
window.menuButtonClick = function () {
const sidebar = document.getElementById("sidebar");
const mainPage = document.getElementById("mainPage");
sidebar.classList.remove("hidden");
mainPage.classList.add("hidden");
sidebar.style.opacity = "1";
}
window.closeMenuMobile = function () {
const sidebar = document.getElementById("sidebar");
const mainPage = document.getElementById("mainPage");
sidebar.classList.add("hidden");
mainPage.classList.remove("hidden");
}