Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

RoperNo1
Copy link
Contributor

@RoperNo1 RoperNo1 commented Jan 9, 2016

Enables deactivate functionality as per issue 13 on the log.

@@ -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)',
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@RoperNo1
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants