ruven / iipmooviewer

IIPMooViewer is an advanced javascript HTML5 image viewer for streaming high resolution scientific images
https://iipimage.sourceforge.io
125 stars 49 forks source link

"Uncaught TypeError: Illegal constructor" when using uncompressed src #83

Closed abubelinha closed 11 months ago

abubelinha commented 11 months ago

In the context described in #81, I am trying to use the uncompressed js files to see if I can modify something.

I successfully changed mootools.min.js by mootools.js and things keep working. My src path contains all 10 .js files in repo iipmooviewer/src (iipmooviewer-2.0.js, mootols core & more, etc) plus lang and protocols subpaths. But when I change from js/iipmooviewer-2.0-min.js to src/iipmooviewer-2.0.js I get this error:

Uncaught TypeError: Illegal constructor at Object.initialize (iipmooviewer-2.0.js:163:25) at wrapper.extend.$owner (ajax.googleapis.com_ajax_libs_mootools_1.6.0_mootools.js:1723:23) at new (ajax.googleapis.com_ajax_libs_mootools_1.6.0_mootools.js:1681:51) at iiipmooviewer.htm:99:5

This is iipmooviewer-2.0.js:162 (error raised in line 163: this.navigation = Navigation(...):

    if( (typeof(Navigation)==="function") ){
      this.navigation = Navigation({ showNavWindow:options.showNavWindow,
                     showNavButtons: options.showNavButtons,
                     navWinSize: options.navWinSize,
                         showCoords: options.showCoords,
                     prefix: this.prefix,
                     navigation: options.navigation
                       });
    }

This is iipmooviewer.htm:99 from #81:

    new IIPMooViewer( "viewer", {
    server: server,
    image: image,
    protocol: "IIIF",
    credit: credit,
    scale: 23.0
    });

Sorry @ruven I guess this must be some stupid mistake I am doing. I tried with both mootools.js alone and later combining src/mootools-core-1.6.0.js+src/mootools-more-1.6.0.js, but nothing changes.

Thanks in advance @abubelinha

abubelinha commented 11 months ago

OK, I realized there is a different index-dev.html file with many lines I was missing:

  <!-- Load our protocols -->  
  <script src="src/protocols/deepzoom.js"></script>
  <script src="src/protocols/djatoka.js"></script>
  <script src="src/protocols/iip.js"></script>
  <script src="src/protocols/zoomify.js"></script>
  <script src="src/protocols/iiif.js"></script>

  <!-- Load our various components -->
  <script src="src/blending.js"></script>
  <script src="src/navigation.js"></script>
  <script src="src/scale.js"></script>
  <script src="src/touch.js"></script>
  <script src="src/annotations.js"></script>
  <script src="src/annotations-edit.js"></script>

  <!-- Load our language files -->
  <script src="src/lang/help.de.js"></script>
  <script src="src/lang/help.en.js"></script>
  <script src="src/lang/help.es.js"></script>
  <script src="src/lang/help.et.js"></script>
  <script src="src/lang/help.fr.js"></script>
  <script src="src/lang/help.gr.js"></script>
  <script src="src/lang/help.it.js"></script>
  <script src="src/lang/help.nl.js"></script>
  <script src="src/lang/help.pt.js"></script>
  <script src="src/lang/help.ru.js"></script>
  <script src="src/lang/help.se.js"></script>
  <script src="src/lang/help.tr.js"></script>
  <script src="src/lang/help.zh.js"></script>  

Regarding those language files, I understand only one is needed. In case I include all/some of them, the last one overrides previous defined languages.

I take the opportunity to suggest a new feature, so iipmooviewer adds a way to handle more than one language and change between them using a select menu option.