Action grpups from Javascript in Lectora Online
January 2, 2020 12:00 AM
@wheels
Hi Joe,
First of all...happy and creative 2020... Somewhere last year you created a script that can be used to 'Run ActionGroups from Javascript' by adding some prefix (EDU_ ) in front of it...and then in your Javascript you can just call that specific name without having to worry about HTMLnames of those actiongroups. I added that to my scripts-workflow and it works perfectly in Lectora Online..
Now however i am trying to use Seamless Play on a title... and your script now doesnot recognize the prefixes anymore. This is the function based on your setup i made and use....
function definePresetforActiongroups(){
// set whatever prefix you want to use for object names that will map to their HTML object
var objectPrefix = "ACT";
console.log("preset is "+objectPrefix);
var chlds = getDisplayDocument().head.childNodes;
for (var i=0;iundefined-1 undefined chlds[i].innerHTML.indexOf('trivWeb20Popups')>-1 )
{
var re = new RegExp("var\\s*([^\\s]*).*//("+objectPrefix+"[^\\s]*)",'g');
var s = chlds[i].innerHTML;
s.replace(re, function(match, g1, g2) {
eval("window."+g2+"="+g1);
});
}
}
}
If you can check whats causing this not to work in Seamless... would be great...
Thx,
Math
Discussion (5)
Hi Math! happy and creative 2020 to you also!
Well, here is a quick guess:
Change: eval("window."+g2+"="+g1);
To: getDisplayWindow()[g2] = g1;
Let me know.
@wheels
Hi Joe,
Alas this didnot fix it.
Getting this error in my console...
Uncaught (in promise) ReferenceError: ACT_changetextfields is not defined
at Array.forEach (undefined
Thx,
Math
In fact after proper check only the Action Groups call and a dynamic fill in of YouTube movies isnot working properly in Seamless Play... so if i can get that working that would be great...
undefined
This works properly in Seamless Play
//ACT_changetextfields.issueActions(1001);
og154956.issueActions(1001);
This doesnot work in Seamless Play
ACT_changetextfields.issueActions(1001);
//og154956.issueActions(1001);
In normal mode both work....
@mnotermans5114 This is way beyond what needs to be in the forum! You have my email, please email me directly about this.
Discussions have been disabled for this post