Explore the community Forums Lectora Tips and tricks Navigation with java Script and variables Reply To: Navigation with java Script and variables

#401434 Score: 0
Profile photo of Math Notermans
Math Notermans
Member
contributor
intermediate
advanced
friend finder
junior moderator
advocate
LUC16 Attendee
LUC16
wise owl
curious george
129 pts
@mnotermans5114

Basically this function now works with a few caveats i have to fix somehow.

function createLastPageName(){
lastPageVisited = VarSummaryGoBack.getValue().toLowerCase().replace(/\s+/g, ‘_’);
//lastSectionVisited = VarLastSectionName.getValue().toLowerCase().replace(/\s+/g, ‘_’);
lastChapterVisited = VarLastChapterName.getValue().toLowerCase().replace(/\s+/g, ‘_’);
constructedPageName = lastChapterVisited+”_”+lastPageVisited+”.html”;
console.log(“createLastPageName: “+constructedPageName);
trivExitPage(constructedPageName,true);
}

I only have Chapters in my title, so no need for the Sections.
In any Chapters or Sections you need to have an action setting the LastChapter/LastSection variable.

Issues i would need to solve.
– When you have pages outside Chapters and Sections i do have to find a solution for that. Probably nulling it.
– When using shortnames when publishing, i dont have a clue about the pageNames, have to test that… and figure out how to check and process that.
– Not sure how Tests are working. Would need to check that.
– All now in Lectora Online, have to see if there is a difference when using it in Inspire or Publisher

Quickly did a testrun with publishing as Short-ID named, and that looked promising. I do think Lectora uses the earlier mentioned CurrentPageId to create names for the pages. Something like pageCurrentPageId. So setting your publishing to Short-ID probably simplifies things…no need for worrying about Chapters and Sections..just add the CurrentPageId and your good..

Testing that now.