Forum Discussion
Javascript problem due to the update ?
Hi,
I use a javascript code to do a "mute" tricks in my articulate courses.
After the update, this option doesn't work anymore. I can't mute the sound anymore...
It's because of the update ?
Thx
21 Replies
- TravisJacksonCommunity Member
The above .js is a simple call to execute a notes page for my Instructors; try it. You'll need to add the base files to the zip, of course.
Hi there, folks!
We created an article that explains how to make jQuery work in JavaScript triggers after its removal in Storyline 360 on January 21, 2020.
You can learn about the three ways to reference the jQuery library directly right here!
- AndreasNeubergCommunity Member
Thx Katie, but that does not seem to solve the JavaScript ToggleVolume code situation, right? Or is there something equivalent in JQuery?
var appState = require("helpers/appState");
appState.onToggleVolume(); - JimmiThøgersenCommunity Member
Hi Andreas (and others)
The onToggleVolume issue isn't actually related to jQuery, but to other changes in how the player javascript is now compiled. This might help:
- AndreasNeubergCommunity Member
@Jimmi, works like a charm (so far) and does not require JQuery :) THX !!
var appState = window.DS ? DS.appState : require("helpers/appState");
appState.onToggleVolume(); - JimmiThøgersenCommunity Member
Just to explain that bit of code, it checks if there's a global
DSvariable (added in update 36). If it's there, it uses that to get toappState. If there's noDS, it assumes it's running in an older version of Storyline, and uses therequirefunction instead (removed in update 36).As mentioned in the other thread, that
DSvariable may disappear again in update 37 - or at any time after that. By definition, it's not future proof, since it uses internal undocumented features. But that's also the case for just callingonToggleVolumein the first place. :-) I wanted to update this discussion related to an issue reported where using jQuery selectors / jQuery's $.ajax() function in JavaScript trigger no longer works.
We're always on the lookout for new security concerns and ways to counteract them. Since jQuery has the potential to be exploited and Storyline no longer uses it, we removed jQuery from Storyline 360 and Storyline 3. If you're comfortable, you can still reference the jQuery library directly to write custom JavaScript. Here's how:
https://articulate.com/support/article/Storyline-How-to-Reference-the-jQuery-Library
However, keep in mind that some JavaScript triggers, like the one you mentioned, that worked before might not work in newer versions of Storyline.