Project

General

Profile

Revision b45a8503

IDb45a8503f8a46382726d0ab722c0ea4126ef97ed
Parent 3603b96e
Child 5c750190

Added by Andreas Kohlbecker 3 months ago

ref #5083 fixing jq-universalviewer.js for clean urls

View differences:

modules/cdm_dataportal/cdm_dataportal.module
379 379
      'preprocess' => FALSE
380 380
    )
381 381
  );
382
  // from UV 3.x documentation:
383
  // "root:
384
  // The path to the uv directory. Use a relative path e.g. root: '../../uv'
385
  // Don't start your path with a / otherwise requirejs will not append .js to
386
  // dependencies and they won't load."
387
  //
388
  // universalviewerPath will be used to build the root config variable.
389
  $folders_up = preg_replace('/[^\/]+/', '..', $_GET['q']);
390
  $folders_up = preg_replace('/\.\.$/', '', $folders_up);
391
  $config_file = 'uv-config.json';
382 392
  drupal_add_js('
383 393
      console.log(\'jQuery inline: \' + jQuery.fn.jquery);
384 394
      jQuery(window).on(\'uvLoaded\', function() {
385 395
        jQuery( "' . $jquery_selector . '" ).jqUniversalviewer(
386 396
        {
387
          universalviewer_path: \'' . $universalviewer_path . '\',
397
          root: \'' . $folders_up . $universalviewer_path . '/uv\',
398
          configUri: \'' . base_path() . $universalviewer_path . '/'. $config_file . '\',
388 399
          manifestUri: \'' . $manifest_uri . '\'
389 400
        }
390 401
        );
modules/cdm_dataportal/js/universalviewer/jq-universalviewer.js
22 22

  
23 23
    // Default options for the plugin
24 24
    var defaults = {
25
        universalviewer_path: undefined,
25
        root: undefined,
26
        configUri: undefined,
26 27
        manifestUri: 'http://wellcomelibrary.org/iiif/b18035723/manifest'
27 28
    };
28 29

  
......
88 89
        var collectionIndex = urlDataProvider.get('c');
89 90

  
90 91
        console.log("setupUV() with " + plugin.options.manifestUri);
91
        console.log("    collectionIndex: " + collectionIndex);
92

  
93
        var root = plugin.options.universalviewer_path + '/uv';
94
        var configUri = plugin.options.universalviewer_path + '/uv-config.json';
95 92

  
96 93
        var uvdata = {
97
            root: root,
94
            root: plugin.options.root,
95
            configUri: plugin.options.configUri,
98 96
            iiifResourceUri: plugin.options.manifestUri,
99
            configUri: configUri,
100 97
            collectionIndex: (collectionIndex !== undefined) ? Number(collectionIndex) : undefined,
101 98
            manifestIndex: Number(urlDataProvider.get('m', 0)),
102 99
            sequenceIndex: Number(urlDataProvider.get('s', 0)),

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)