mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-28 01:33:23 +00:00
assets/scripts.js: Allow jumping to a chapter by setting the hash
This commit is contained in:
parent
b4e04bccd1
commit
c5fafb4c16
1 changed files with 16 additions and 3 deletions
|
@ -382,9 +382,11 @@ window.onload = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (location.hash) {
|
window.onhashchange = function() {
|
||||||
var segmentId = location.hash.slice(1);
|
playHash(window.location.hash);
|
||||||
playSegment(segmentId);
|
};
|
||||||
|
if (window.location.hash) {
|
||||||
|
playHash(window.location.hash);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -427,3 +429,14 @@ function playSegment(segmentId, noSeek) {
|
||||||
seek(ms);
|
seek(ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function playHash(hash) {
|
||||||
|
if (hash) {
|
||||||
|
let loc = hash.slice(1).split('/');
|
||||||
|
let segmentId = loc[0];
|
||||||
|
if (loc.length > 1)
|
||||||
|
seek(momentsBySegment[segmentId][loc[1]].startMs);
|
||||||
|
else
|
||||||
|
seek(getSegmentMs(segmentId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue