Explore the community Forums Lectora Online Lectora Online Questions & Answers Action grpups from Javascript in Lectora Online

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #436521 Score: 0
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    129 pts
    @mnotermans5114

    @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

    #436569 Score: 0
    Profile photo of Joe Wieloch
    Joe Wieloch
    Moderator
    beginner
    intermediate
    friend finder
    contributor
    LUC16 Attendee
    verified member
    wise owl
    LUC17 Attendee
    advanced
    picture perfect
    60 pts
    @wheels

    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.

    #436591 Score: 0
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    129 pts
    @mnotermans5114

    @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

    #436593 Score: 0
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    129 pts
    @mnotermans5114

    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….

    #436685 Score: 0
    Profile photo of Joe Wieloch
    Joe Wieloch
    Moderator
    beginner
    intermediate
    friend finder
    contributor
    LUC16 Attendee
    verified member
    wise owl
    LUC17 Attendee
    advanced
    picture perfect
    60 pts
    @wheels

    @mnotermans5114 This is way beyond what needs to be in the forum! You have my email, please email me directly about this.

    #436687 Score: 0
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    129 pts
    @mnotermans5114

    Your right..will do…

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.