mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2025-09-09 15:38:44 +00:00
fixed bug in hash view URL calling
This commit is contained in:
13
js/app.js
13
js/app.js
@@ -207,8 +207,19 @@ class bitvidApp {
|
|||||||
this.setupEventListeners();
|
this.setupEventListeners();
|
||||||
disclaimerModal.show();
|
disclaimerModal.show();
|
||||||
|
|
||||||
// 6. Load the default view (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");
|
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
|
// 7. Once loaded, get a reference to #videoList
|
||||||
this.videoList = document.getElementById("videoList");
|
this.videoList = document.getElementById("videoList");
|
||||||
|
@@ -305,6 +305,7 @@ function handleQueryParams() {
|
|||||||
* Handle #view=... in the hash and load the correct partial view.
|
* Handle #view=... in the hash and load the correct partial view.
|
||||||
*/
|
*/
|
||||||
function handleHashChange() {
|
function handleHashChange() {
|
||||||
|
console.log("handleHashChange called, current hash =", window.location.hash);
|
||||||
const hash = window.location.hash || "";
|
const hash = window.location.hash || "";
|
||||||
// Expecting something like #view=most-recent-videos
|
// Expecting something like #view=most-recent-videos
|
||||||
const match = hash.match(/^#view=(.+)/);
|
const match = hash.match(/^#view=(.+)/);
|
||||||
|
Reference in New Issue
Block a user