Forum Discussion

AntoninEtienne's avatar
AntoninEtienne
Community Member
6 years ago

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

  • TravisJackson's avatar
    TravisJackson
    Community 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!

  • 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();
  • @Jimmi, works like a charm (so far) and does not require JQuery :) THX !!

    var appState = window.DS ? DS.appState : require("helpers/appState");
    appState.onToggleVolume();

     

  • Just to explain that bit of code, it checks if there's a global DS variable (added in update 36). If it's there, it uses that to get to appState. If there's no DS, it assumes it's running in an older version of Storyline, and uses the require function instead (removed in update 36).

    As mentioned in the other thread, that DS variable 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 calling onToggleVolume in 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.