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
Hi Antonin and welcome to E-Learning Heroes :)
Are you using jQuery with your JavaScript? To improve security for our customers, we removed jQuery from Storyline 360. You can still use it to write custom JavaScript. You'll just need to reference the jQuery library directly.
- AntoninEtienneCommunity Member
I'm not using jQuery, my question is about Javascript only, see yourself :
I just wanted to know if this "mute" code is not working because of the update. Thx
var player = GetPlayer();
var value = player.GetVar("volumeSlider");
var appState = require("helpers/appState");
appState.onToggleVolume(); - PhilMayorSuper Hero
The player changed in the latest update I have found a lot of code no longer works jQuery or not
- AndreasNeubergCommunity Member
I have the same issue with JavaScript and onToggleVolume() on the most recent build of SL360 which is super annoying .. so, is it a feature or a bug?
- PhilMayorSuper Hero
player has changed, the code I used to hide the lightbox close button no longer works
- AntoninEtienneCommunity Member
So it's not an isolated problem. This is due to the update...
My solution for now is to revert to version 3.35.21017.0 of SL360.
But for the future, this is a big problem and Storyline must find a solution, I hope.
- PhilMayorSuper Hero
As Articulate never exposed this functionality to us and to be very fair have always stated that functions like this may change which is why they have not been made public as a feature, I think the onus is not on Articulate here.
Hi, everyone. Thank you for your insight!
Since we don't support editing the published output, referenced system variables and ids for JavaScript that worked in earlier versions of Storyline might not work in later ones.
Could you share more about your needs and how you used the mute code? I'll see if I can help find another way!
- AndreasNeubergCommunity Member
The JS trick (un)muted all audio/video clips irrespective from their location on the timeline and layer in one shot. Especially useful with the chromeless player skin and multiple, distributed audio tracks. There is also a case open on this, see #02133078. Probably again time, to raise a feature request for a trigger "Mute all" ;-) Thx
- Kristin_HatcherCommunity Member
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.
- TravisJacksonCommunity Member
I use extensive js in my publishes - no problems. I use a custom player, maybe this will help?
- Kristin_HatcherCommunity 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.
- PhilMayorSuper 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.
- TravisJacksonCommunity 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();
}