Forum Discussion

AntoninEtienne's avatar
AntoninEtienne
Community Member
5 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

  • No Javascript I've tried since the update will work, and working Javascript - the "mute all" others have referenced - is also no longer working. This is unfortunate. Yes, I could achieve the same thing using triggers, but A) I don't want the user to have to press a button on all 267 slides to hear or not hear audio, and B) With a large course it is too clunky to try and add that many triggers. 

    If there is an existing feature request for Mute all, I'd like to be added to it. 

  • TravisJackson's avatar
    TravisJackson
    Community Member

    I use extensive js in my publishes - no problems. I use a custom player, maybe this will help? 

     

    • Kristin_Hatcher's avatar
      Kristin_Hatcher
      Community Member

      Travis (or anyone) can you provide an example of Javascript that works for you in the latest build. I can't get anything to work but I'm new to Java so maybe I'm doing something wrong. 

      • PhilMayor's avatar
        PhilMayor
        Super Hero

        Kristin, you likely have a javascript error, it could be that you are using jQuery (do you have $). 

        Have you checked the developer console? One error will break them all.

         

  • TravisJackson's avatar
    TravisJackson
    Community Member

    let btnNext = document.querySelector(".slide-control-button-next");
    if (!btnNext.hasAttribute("onmouseup")) {
    btnNext.setAttribute("onmouseup", "window.parent.ChildNav('Next');");
    }
    let btnPrev = document.querySelector(".slide-control-button-previous");
    if (!btnPrev.hasAttribute("onmouseup")) {
    btnPrev.setAttribute("onmouseup", "window.parent.ChildNav('Previous');");
    }
    let topicLinks = [...document.querySelectorAll(".item-collapsible li:nth-child(1) .cs-listitem")];
    let slideLinks = document.querySelectorAll(".cs-listitem");
    if (!slideLinks[0].hasAttribute("onmouseup")) {
    let slideCount = 0;
    let titlesArr = [];
    [...slideLinks].forEach(slideLink => {
    if (topicLinks.indexOf(slideLink) === -1) {
    titlesArr.push(slideLink.getAttribute("title"));
    slideLink.setAttribute("onmouseup", "window.parent.ChildNav(" + slideCount + ");");
    slideCount++;
    } else if (slideCount !== 0) {
    slideLink.setAttribute("onmouseup", "window.parent.ChildNav(" + (slideCount + 1) + ");");
    } else {
    slideLink.setAttribute("onmouseup", "window.parent.ChildNav(" + slideCount + ");");
    }
    });
    window.parent.SetTitlesArr(titlesArr);
    window.parent.SetSlideCount(slideCount);
    window.parent.CreateInstructWindow();
    }

  • 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();
  • 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.