Okay, to hopefully close this thread with a solution that can easily be reused and copy & pasted I’ll give it a hopefully final solution and mark it as solved. Copy&Paste the following into your Head-HTML
<script>
function extendHype(hypeDocument, element, event) {
/**
* currentSceneIndex
* @return {Number} gives you the current scene index
*/
hypeDocument.currentSceneIndex = function(){
var hc = document.getElementById(hypeDocument.documentId());
var sa = hc.getElementsByClassName("HYPE_scene");
for (i = 0; i < sa.length; i++) {
if (sa[i].style.display === "block") return parseInt(sa[i].getAttribute("hype_scene_index"));
}
}
/**
* currentSceneElement
* @return {HTMLDivElement} gives you the current scene element
*/
hypeDocument.currentSceneElement = function(){
var hc = document.getElementById(hypeDocument.documentId());
var sa = hc.getElementsByClassName("HYPE_scene");
for (i = 0; i < sa.length; i++) {
if (sa[i].style.display === "block") return sa[i];
}
}
/* add more extentions here */
return true;
}
if("HYPE_eventListeners" in window === false) {
window.HYPE_eventListeners = Array();
}
window.HYPE_eventListeners.push({"type":"HypeDocumentLoad", "callback":extendHype});
</script>
From there on you can use it in any hype function in your document as follows:
Get the scene index number (Number)
var nr = hypeDocument.currentSceneIndex();
Get the scene element (HTMLDivElement)
var elm = hypeDocument.currentSceneElement();
sceneNumber.zip (19.0 KB)