Sha256: 50aac395949a28daed55f3b3417b6ebc891232d81451efe10fa6012543de6c6a

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

import OpenSeadragon from 'openseadragon'

(function($) {
  $.fn.openseadragon = function() {
    console.warn("openseadragon/jquery.js is deprecated. Use openseadragon/dom.js instead.")
    var __osd_counter = 0;
    function generateOsdId() {
      __osd_counter++;

      return "Openseadragon" + __osd_counter;
    }

    $(this).each(function() {
      var $picture = $(this);
      $picture.addClass('openseadragon-viewer');

      if (typeof $picture.attr('id') === "undefined") {
        $picture.attr('id', generateOsdId());
      }

      var collectionOptions = $picture.data('openseadragon');

      var sources = $picture.find('source[media="openseadragon"]');

      var tilesources = $.map(sources, function(e) {
        if ($(e).data('openseadragon')) {
          return $(e).data('openseadragon');
        } else {
          return $(e).attr('src');
        }
      });

      $picture.css('height', $picture.css('height'));

      $picture.data('osdViewer', OpenSeadragon(
        $.extend({ id: $picture.attr('id') }, collectionOptions, { tileSources: tilesources })
      ));
    });

    return this;
  };
})(jQuery);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
openseadragon-1.0.16 app/javascript/openseadragon-rails/jquery.js
openseadragon-1.0.15 app/javascript/openseadragon-rails/jquery.js
openseadragon-1.0.14 app/javascript/openseadragon-rails/jquery.js
openseadragon-1.0.13 app/javascript/openseadragon-rails/jquery.js