These are chat archives for UniversalViewer/universalviewer

19th
Oct 2015
Øystein Blixhavn
@blixhavn
Oct 19 2015 07:46
We figured it out, was missing a layer in the manifest :)
Btw: I'm encountering an error when trying to display the universalviewer in my application. It seems that the variable scriptUri has been highjacked by google maps somehow. If i set a breakpoint just above the error producing line, I get
> scriptUri
"https://maps.googleapis.com/maps-api-v3/api/js/22/9a/intl/no_ALL/main.js"
Any experience with that?
Edward Silverton
@edsilv
Oct 19 2015 08:25
ha, nope - first time I've seen that :-) maybe worth changing it to uvScriptUri?
Øystein Blixhavn
@blixhavn
Oct 19 2015 08:27
Tried it, seems like it jumped over to something else then.
Seems this JS is not managing to find the script source:
// get the script location.
        var s = document.getElementById('embedUV');

        if (!s){
            var scripts = document.getElementsByTagName('script');
            s = scripts[scripts.length - 1];
        }
Øystein Blixhavn
@blixhavn
Oct 19 2015 09:02
This seems to work:
if (!s){
            var scripts = document.getElementsByTagName('script');
            for(i=0; i<scripts.length; i++){
                if(scripts[i].outerHTML.match(/universalviewer/)){
            s = scripts[i]
        }
            }
        if(!s) {
                s = scripts[scripts.length - 1];
        }
        }
Edward Silverton
@edsilv
Oct 19 2015 09:20
your embed.js script definitely has the id 'embedUV'? seems weird that it wouldn't find it. could google maps be removing the id?
Øystein Blixhavn
@blixhavn
Oct 19 2015 09:21
hm
It doesn't actually, because I'm using require.js
<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="universalviewer" src="/vendors/universalviewer/dist/uv-1.5.8/lib/embed.js"></script>
also, how would universalviewer handle being compressed into a js file with other libraries?
Edward Silverton
@edsilv
Oct 19 2015 10:11

I've tried minifying the uv with r.js 'optimize' before and ran into problems. Perhaps give it a try and log any issues you find on github. See Gruntfile.js:

https://github.com/UniversalViewer/universalviewer/blob/master/Gruntfile.js#L24

I think concatenating it without minification in other files should be fine.

Perhaps this could be used to add an id to the script post-load and pre-execution?

http://requirejs.org/docs/api.html#config-callback