- Apr 30, 2017
- 266
- 403
Hey guys,
I've started working on twine sugarcube game, mainly just a side project for a bit of fun and a new learning experience. I'm fairly competent when it comes to HTML, CSS, Javascript and many other coding languages however twine seems to have its own syntaxing that befuddles me XD.
I'm having issues editing the navigation menu found at the side of the screen, I basically want to implement some links that can be used to get to specific passages containing stats information.
The passage i want the link to go to is titled: Logbook1, below i have pasted a snippet of code I'm using to insert the link into the side menu but no matter what I try the link does nothing.
Essentially I have two questions.... is there batter way to add stuff to the side menu rather then dom injection? and does anyone have experience in implementing working links in the nav menu that can help me out here?
I've started working on twine sugarcube game, mainly just a side project for a bit of fun and a new learning experience. I'm fairly competent when it comes to HTML, CSS, Javascript and many other coding languages however twine seems to have its own syntaxing that befuddles me XD.
I'm having issues editing the navigation menu found at the side of the screen, I basically want to implement some links that can be used to get to specific passages containing stats information.
The passage i want the link to go to is titled: Logbook1, below i have pasted a snippet of code I'm using to insert the link into the side menu but no matter what I try the link does nothing.
Essentially I have two questions.... is there batter way to add stuff to the side menu rather then dom injection? and does anyone have experience in implementing working links in the nav menu that can help me out here?
JavaScript:
setup.setupMenu = function setupMenu() {
var mc = document.getElementById("menuContainer");
var rlb = document.getElementById("logbook");
if(rlb) {
mc.removeChild(rlb)
}
//SET LOG BOOK
if(State.variables.logbook != undefined) {
var ms = document.createElement("SPAN");
ms.setAttribute("title", "[[Logbook->Logbook1]]")
ms.setAttribute("aria-label", "[[Logbook->Logbook1]]")
ms.setAttribute("data-type", "link-markup")
ms.setAttribute("data-name", "[[Logbook1]]")
ms.setAttribute("class", "debug")
var lb = document.createElement("A");
lb.setAttribute("id", "logbook");
lb.setAttribute("data-passage", "Logbook1");
lb.setAttribute("class", "link-internal");
lb.setAttribute("tabindex", "0");
ms.appendChild(lb);
mc.appendChild(ms);
document.getElementById("logbook").innerHTML = "Logbook";
}
}