Skip to content

Releases: DDMAL/diva.js

v6.0.2

27 Aug 13:32
6aab3dd
Compare
Choose a tag to compare

This patch release fixes issues when using gotoPageByIndex (#478), clicking a search suggestion (#481), using the NPM package (#485), and when getting the active page (#475, #483).

v6.0.1

31 Mar 21:41
Compare
Choose a tag to compare

This minor update fixes a bug with rendering in Firefox. (#469)

It also updates package dependencies, a bit of code clean-up, and adjustments to the metadata plugin.

v6.0.0

24 Sep 20:25
8619ed1
Compare
Choose a tag to compare

Diva 6 is simultaneously our biggest, and our smallest, release yet! We have rewritten Diva as an ES6 module, have removed all external library dependencies, refreshed the public API, optimized and inlined UI images, refactored the CSS. These optimizations make Diva a lightweight, but fully-featured, IIIF viewer component, suitable for seamless integration into your web applications.

Additionally, we provide support for viewing images using the upcoming IIIF Presentation API version 3.0.

New Features

  • Compatibility with IIIF Presentation API version 2.1 and 3.0.
  • Small footprint, zero dependencies. Can be deployed with just a JavaScript and a CSS file.
  • Rewritten in ES6 for compatibility with the new JavaScript module system.
  • New plugins
    • IIIF Metadata
    • Image Manipulation
  • Viewport height change for better visibility
  • The 'page number' tool now displays page label names instead of page numbers, and page labels are affixed to the top right of every page.

Bug Fixes

  • Diva no longer just tracks a single page index for its public methods and page interaction, but rather an array of all the visible pages in the viewport.

Plugin System Changes

  • Register plugins by adding them to the plugins setting when instantiating Diva, instead of via window.diva.registerPlugin(...). See Plugins for more info.

Public Method Changes

New

  • getAllPageURIs: Gets all the page image URIs in the IIIF manifest.
  • getCurrentCanvas: Gets the canvas identifier for the currently visible page.
  • getCurrentPageURI: Gets the URI for the current page.
  • getGridPagesPerRow: Get the number of grid pages per row in grid mode.
  • getOtherImages: If a canvas has multiple images defined, gets the non-primary images.
  • getPageDimensions: Gets the page dimensions in the current view and zoom level.
  • getPageImageURL: Gets the URL for the image of the page at the given index. The optional size parameter supports setting the image width or height (default is full-sized).
  • gotoPageByURI: Jumps to a page based on its URI.
  • hasOtherImages: Whether the page canvas has other images to display.
  • isInFullscreen: Checks if the viewer is currently in fullscreen mode.
  • setGridPagesPerRow: Set the number of grid pages per row.

Deprecated

  • getAliasForPageIndex
  • getCurrentAliasedPageIndex
  • getPageIndex
  • getPageIndexForAlias
  • getPageIndicesForAlias
  • getURLHash
  • gotoPageByAliasedNumber
  • gotoPageByNumber
  • toggleGridView

Settings Changes

New

  • acceptHeader: A string which specifies what header to send off to the server in content negotiation (for IIIF manifests).

Deprecated

  • iipServerURL
  • imageDir

v5.1.2

09 Apr 17:12
Compare
Choose a tag to compare

This release exists because of a problem publishing 5.1.1 to npm.

v5.1.1

09 Apr 17:04
Compare
Choose a tag to compare

Fixed a couple problems with the new IIIF manifest parser.

v5.1.0

09 Apr 13:28
Compare
Choose a tag to compare

Version 5.1.0 features a new IIIF manifest parser containing preliminary support for multiple images per canvas (oa:Choice).

v5.0.4

25 Mar 13:13
Compare
Choose a tag to compare

This release adds the build directory to the repo so that projects that deploy it with npm have a pre-built version of diva available to their project.

Diva 5.0.3

06 Dec 20:52
Compare
Choose a tag to compare

Adds a new public method, isInFullscreen.

Version numbers incremented to sync up with some confusion on how to publish to npm.

Diva.js 5.0.0

25 Aug 15:04
Compare
Choose a tag to compare

New Features

  • Diva now uses canvas-based rendering.
    This also means that most DOM elements inside of .diva-inner have been removed and code relying on looking up those elements will fail.
  • Diva will now fill its parent height by default. This uses a flexbox layout and can be disabled with the setting fillParentHeight.
    In order to implement this and fix other issues, the DOM hierarchy has changed. See below for a detailed log of what has changed in the DOM.
  • Support for pages marked as 'non-paged' in IIIF manifests.
    A new button has been added to the toolbar to toggle the visibility of non-paged pages. If no non-paged pages are present in the document, the button will be hidden.
    The button can be hidden manually with the setting enableNonPagedVisibilityIcon, and non-paged pages can be shown on document load with the setting showNonPagedPages.
  • Usage of the older Diva JSON format is now officially deprecated, and will be completely removed in the next version of Diva. Consider switching to IIIF manifests (See http://iiif.io/ for more information).
  • The 'go to page' form in the toolbar now uses page labels to go to a specific page. Suggestions are also shown to help the user see what page labels are available. Also, a new hook is now available to override the behaviour of this form (See the onGotoSubmit setting).
    If no page label matches, Diva will try to parse a page index. The behaviour for this form can be overridden using the onGotoSubmit setting.
  • Continuous Zooming. Zoom levels can now be fractions. Also, the current images will be zoomed while waiting for the new higher resolution images to be loaded from the server.

Bug fixes

Multiple bug fixes are introduced in this version of Diva. Here are the biggest ones:

  • The Diva instance now correctly terminates if the destroy() method is called before the viewer finishes loading.
  • The size of the .diva-inner element is now properly updated when the viewer is resized. It used to only be set when a view was loaded.
  • The gotoPageBy__ methods now also work in Grid view.

Plugin System Changes

  • Register plugins via window.diva.registerPlugin(...), instead of pushing to window.divaPlugins.

Public Methods Changes

New Methods:

  • getPageDimensionsAtCurrentZoomLevel(pageIndex): Returns the dimensions of a given page at the current zoom level, no matter what view the document is in.
  • isPageIndexValid(pageIndex): Returns true if a page index is within the range of the document and, if the page is marked as 'non-paged', if the non-paged pages are currently visible.
  • toggleNonPagedPagesVisibility(): Shows/Hides pages tagged as 'non-paged' in the (IIIF only) manifest.
  • showNonPagedPages(): Shows pages tagged as 'non-paged'.
  • hideNonPagedPages(): Hides pages tagged as 'non-paged'.
  • getAliasForPageIndex: Returns the first of these three that resolves to boolean true (Else the function will return false):
    -Explicit alias as defined in pageAliases
    -Result of pageAliasFunction
    -originalPageIndex + 1 (to simulate the original mapping)
  • getPageIndexForAlias: Returns the first page index found for a given aliased number or false if not found.
  • getPageIndicesForAlias: Returns array of page indices for a given aliased number. Returns an empty array if none are found.
  • getCurrentAliasedPageIndex: Same as getAliasForPageIndex but uses the current page index automatically.
  • gotoPageByAliasedNumber: Go to a specific page based on its alias.

Changes to Existing Methods:

  • getSettings(): The settings object returned is now read-only.
  • inViewport(): Has been renamed isRegionInViewport().
  • getCurrentPageDimensionsAtCurrentZoomLevel(): Now also works in grid view.
  • isRegionInViewport (previously called inViewport): Now accepts a page index instead of a page number as an argument.
  • getPageIndexForPageXYValues(pageX, pageY): Now returns -1 (instead of false) if no page was found.
  • getCurrentPageFilename(): For IIIF manifests, this method now returns the URL of the image for that page.

Deprecated Methods:

  • gotoPageByNumber(pageNumber): Use gotoPageByIndex(pageIndex) instead.
  • getCurrentPageNumber(): Use getCurrentPageIndex() instead.
  • isPageLoaded(pageIndex): Use isPageInViewport(pageIndex) instead.
  • getPageDimensionsAtCurrentGridLevel(pageIndex): Use getPageDimensionsAtCurrentZoomLevel(pageIndex) instead.

Settings Changes

New Settings:

  • onGotoSubmit: When set to a function that takes a string and returns a page index, this will override the default behaviour of the 'go to page' form submission. If the function returns false or null, a message is displayed to the user saying that the page was not found. By default Diva uses the public method gotoPageByLabel.
  • enableGotoSuggestions: Controls whether suggestions are shown when a user is typing in the 'go to page' form. Default: true
  • fillParentHeight: When set to true, Diva will use a flexbox layout to fill its parent's height. Default: true
  • enableNonPagedVisibilityIcon: show or hide the icon in the toolbar that toggles visibility of non-paged pages. Note that the icon is automatically hidden if there are no non-paged pages in the current document. Default: true
  • showNonPagedPages: Whether pages tagged as ‘non-paged’ (in IIIF manifests only) should be visible after initial load. Default: false
  • hashParamSuffix: Allows customization of the hash params used to generate a custom URL to recreate the current view. Useful when a single page application deletes and re-instantiates multiple Diva viewers. Default: ''
  • pageAliases: An object mapping specific page indices to their alias. (Has priority over the 'pageAliasFunction' setting.
  • pageAliasFunction: A function mapping page indices to an alias. If false is returned, default page number is displayed.
    If none of the above two settings are specified when instantiating Diva, the regular page number will be displayed in the toolbar.

Removed Settings:

  • rowLoadTimeout

Events Changes

New Events:

  • ViewerWillTerminate [settings]: Similarly to 'ViewerDidTerminate', fires when the destroy() method is called on a Diva instance. The difference is that this method fires at the start of the 'destroy' process, rather then at the end.
    Useful to access diva elements and data attached to them before it all gets destroyed.

DOM Changes

  • A new element now wraps all other elements created by Diva: .diva-wrapper
  • A new element now sits in between .diva-outer and .diva-inner: .diva-viewport
  • Most DOM elements that used to contain image tiles in .diva-inner do not exist anymore, since those are now all rendered on a canvas.
  • All IDs of DOM elements generated by Diva are now of the form diva-n-foo, where 'n' is the ID of the Diva instance.

The global DOM hierarchy thus now looks like this:
.diva-wrapper > .diva-outer > .diva-viewport > .diva-inner. The canvas is a child of .diva-outer and the toolbar is (by default) a child of .diva-wrapper

Diva.js 4.1.0

08 Feb 23:15
Compare
Choose a tag to compare

New features in Diva.js v4.1.0:

Note: Some existing features from v4.0.0 have changed. The breaking changes are as follows (see links for more information):

  • Events system - Subscribers are now scoped to the Diva instance in question, to support hooking into one or multiple Diva instances on the same page (see Events System documentation for details)
  • Simplified CSS stylesheet structure (potentially breaking previously-written external CSS overrides)