mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2025-09-08 06:58:43 +00:00
fixed bug in hash view URL calling
This commit is contained in:
15
js/app.js
15
js/app.js
@@ -207,8 +207,19 @@ class bitvidApp {
|
||||
this.setupEventListeners();
|
||||
disclaimerModal.show();
|
||||
|
||||
// 6. Load the default view (most-recent-videos.html)
|
||||
await loadView("views/most-recent-videos.html");
|
||||
// 6) Load the default view ONLY if there's no #view= already
|
||||
if (!window.location.hash || !window.location.hash.startsWith("#view=")) {
|
||||
console.log(
|
||||
"[app.init()] No #view= in the URL, loading default home view"
|
||||
);
|
||||
await loadView("views/most-recent-videos.html");
|
||||
} else {
|
||||
console.log(
|
||||
"[app.init()] Found hash:",
|
||||
window.location.hash,
|
||||
"so skipping default load"
|
||||
);
|
||||
}
|
||||
|
||||
// 7. Once loaded, get a reference to #videoList
|
||||
this.videoList = document.getElementById("videoList");
|
||||
|
@@ -305,6 +305,7 @@ function handleQueryParams() {
|
||||
* Handle #view=... in the hash and load the correct partial view.
|
||||
*/
|
||||
function handleHashChange() {
|
||||
console.log("handleHashChange called, current hash =", window.location.hash);
|
||||
const hash = window.location.hash || "";
|
||||
// Expecting something like #view=most-recent-videos
|
||||
const match = hash.match(/^#view=(.+)/);
|
||||
|
Reference in New Issue
Block a user