thexerteproject / xerteonlinetoolkits

Xerte Online Toolkits
www.xerte.org.uk
Apache License 2.0
62 stars 61 forks source link

Flashcards and 360 pages do not work in offline export #1270

Closed torinfo closed 5 months ago

torinfo commented 5 months ago

Reported by clients of ours and on forum:

  1. The flashcards do not work anymore in an export zip. They used to work in previous versions
  2. The 360 page does not work in an offline export
torinfo commented 5 months ago

Solution for 1. It turns out that the flahscards used to use a script dependency loader $script. There were issues with that loader, so it was replaced by a new loader (loadjs). The problem is that the dependency laoder was loaded by xenith.js and only if the module was NOT an offline module.

I removed the dynamic loading of loadjs.min.js from xenith.js and moved it to plaver_html5/rloObject.htm (like the comment already suggested we should do anyway).

  1. now works,

Solution for 2. Basically the same problem. The dependency pannellum.js (the viewer we use) was not loaded properly. The model uses $.getScript to load the .js file, but that does not work in an offline context. So pannellum.js is now loaded using the loadjs dependency loader.

Regrettably, that still doesn't solve the issues with the media360 page, because pannellum.js internally uses also something similar as $.getScript and causes a CORS error. It is beyond the scope of this fix to try and remedy that.