-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deactivate functionality #63
base: main
Are you sure you want to change the base?
Conversation
@@ -339,6 +340,10 @@ | |||
else if (match.dec) { | |||
section = this.addAttribute(match.dec[1] + '-=' + (match.dec[2] === undefined ? '1' : match.dec[2]), story, section, passage, isFirst, inputFilename, lineCount); | |||
} | |||
else if (match.deactivate) { | |||
section = this.addJS('$("[data-passage|=' + match.deactivate[1] + ']").addClass("disabled"); $("[data-passage|=' + match.deactivate[1] + ']").attr("tabindex", -1); squiffy.set("_turncount", squiffy.get("_turncount") + 1)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer this to be handled by calling a function in squiffy.template.js
, rather than having JavaScript inside a string here.
The way I'd implement this would be to add a new data attribute on the generated link, then the handleLink
function in squiffy.template.js
does the deactivating. This also means everything that updates the turncount happens in the same function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that's fair enough. I haven't looked at this since that Pull request 28 days ago but I will try and refresh my mind of how all this works and see what I can do.
Hi, I have moved the function to squiffy.template.js. I haven't moved it to handleLink because I couldn't make sense of how that would work, all the functions currently within that function are about manipulating the link that has been clicked by the reader, whereas this deals with another passage link of the writer's choosing. |
Enables deactivate functionality as per issue 13 on the log.