Sha256: 9caf5a3ed7c4f741637890cd3fd886c9334113ffd4711735f97eff7c3609d980

Contents?: true

Size: 979 Bytes

Versions: 3

Compression:

Stored size: 979 Bytes

Contents

import Iiif from 'iiif'

export function addImageSelector(input, panel, manifestUrl, initialize) {
  if (!manifestUrl) {
    showNonIiifAlert(input);
    return;
  }
  var cropper = input.data('iiifCropper');
  $.ajax(manifestUrl).done(
    function(manifest) {
      var iiifManifest = new Iiif(manifestUrl, manifest);

      var thumbs = iiifManifest.imagesArray();

      hideNonIiifAlert(input);

      if (initialize) {
        cropper.setIiifFields(thumbs[0]);
        panel.multiImageSelector(); // Clears out existing selector
      }

      if(thumbs.length > 1) {
        panel.show();
        panel.multiImageSelector(thumbs, function(selectorImage) {
          cropper.setIiifFields(selectorImage);
        }, cropper.iiifImageField.val());
      }
    }
  );
}

function showNonIiifAlert(input){
  input.parent().prev('[data-behavior="non-iiif-alert"]').show();
}

function hideNonIiifAlert(input){
  input.parent().prev('[data-behavior="non-iiif-alert"]').hide();
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight-spotlight-3.6.0.beta4 app/javascript/spotlight/admin/add_image_selector.es6
blacklight-spotlight-3.6.0.beta3 app/javascript/spotlight/admin/add_image_selector.es6
blacklight-spotlight-3.6.0.beta1 app/javascript/spotlight/admin/add_image_selector.es6