Action grpups from Javascript in Lectora Online

mnotermans5114
mnotermans5114 Community Member Posts: 916 ☆ Roadie ☆
@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;i<chlds.length;i++) { if (chlds[i].tagName && chlds[i].tagName.toLowerCase().indexOf('script')>-1 && chlds[i].innerHTML && 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

Comments

  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 636 eLearning ROCKSTAR Admin Team
    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.
  • mnotermans5114
    mnotermans5114 Community Member Posts: 916 ☆ Roadie ☆
    @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 (<anonymous>)

    Too bad i get quite some more errors in Seamless Play on my setup... and for now i cannot share my project because its quite complex. Either i forget SP for now, or build a SPA like approach for it..

     

    Thx,

    Math
  • mnotermans5114
    mnotermans5114 Community Member Posts: 916 ☆ Roadie ☆
    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...

     

    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....
  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 636 eLearning ROCKSTAR Admin Team
    @mnotermans5114 This is way beyond what needs to be in the forum! You have my email, please email me directly about this.
  • mnotermans5114
    mnotermans5114 Community Member Posts: 916 ☆ Roadie ☆
    Your right..will do...