Javascript from an imported package
October 11, 2015 12:00 AM
Hi,
I made a L11 with quite some Javascript. In preview mode and published as html in L11 it works as expected. Now exported that title as package. Next step importing it in L12 online. All the assets, graphics groups and actions, including the additional JS-files are all nicely added. But the javascript doesnot work??
Anyone any clues to what i might be missing ?
Discussion (6)
Hi sergey, both are used. Actions are properly present. All imported js libraries too... The scripts themselves are fine too... Only thing different is that in L11 i use 'Custom div' and that gets converted to 'other' ( have to doublecheck that, cause i now am at a clients )... So actually the same issue as in the other post i did. Lack of 'custom div' i might be overseeing something simple though....
How is the JS executed? If it is run via "Run JS" actions, check if actions are there after import. If it is included via external HTML objects, check if the objects are there after import.
Interesting. Seems like "Other" is Lectora Online's name for "Custom DIV" after all. However, since it is all wrapped in DIVs in the middle of the page, scripts might not always work. Try setting it to META TAGS and make sure the script is wrapped in script tags and no errors are reported in developer console in your browser.
Also, feel free to share the files with me so I can have a look.
Yep, that was what i am suspecting too. Gonna give it a try with metatags... Will let you know....
Update on my own reply:
Yes, indeed the convention of htmlnames changed.
Tested the #image321363
Changed my javascript to use 'tobj' instead of 'image' and indeed all image-related elements work as before.
Too bad they skipped the 'text' part in textobjects, because i used that to detect something was a text ;-)
Well, will find another solution for that for sure ....
Thanks Sergey for the 'Metatags'-part
undefined
@ Sergey, changed my coding habits to use Metatags. And indeed that solves some issues when importing a project from L11 to Lectora Online or L12.
But one issue remains, but i guess thats easy to solve by refactoring my code a bit ( should not be needed, but well if this is all thats needed to get it to work ;-)
In L11 i call ( as you can see in the OOP sample i uploaded ) images and texts in Lectora by using:
#image321363 or $('.text322541Font1') or #text322548
In L11 either using JQuery or DOM , both methods work fine.
L12 and Lectora Online however have changed the convention they used for their html-names. Now they are called:
tobj321363 or tobj322541 or tobj322548.
Can someone confirm that for me ? If thats true just a refactoring of my code when exporting to L12 or Online will do.
Discussions have been disabled for this post