Skip to content
Snippets Groups Projects
Select Git revision
  • 100ef2e871b98f6718101c0d21a5b1eb3f2a8bc3
  • master default protected
  • multiprocessing
  • experiment/clara
  • experiment/spec2B-poc
  • experiment/qivalio-poc
  • experiment/ertms
  • MAY-2023
  • FEB-2023
  • EGC-2023
  • 0.2.1
  • v0.2.0
  • v0.1.2
13 results

semantic-net.ttl

Blame
  • index.js 1.55 KiB
    
    /**
    * Return the manifest that belongs to a certain window.
    * @param {object} state
    * @param {String} windowId
    * @return {object}
    */
    export function getWindowManifest(state, windowId) {
      return state.windows[windowId]
        && state.windows[windowId].manifestId
        && state.manifests[state.windows[windowId].manifestId];
    }
    
    /**
    * Return the logo of a manifest or null
    * @param {object} manifest
    * @return {String|null}
    */
    export function getManifestLogo(manifest) {
      return manifest.manifestation
        && manifest.manifestation.getLogo();
    }
    
    /**
    * Return the logo of a manifest or null
    * @param {object} manifest
    * @return {String|null}
    */
    export function getManifestCanvases(manifest) {
      if (!manifest.manifestation) {
        return [];
      }
    
      return manifest.manifestation.getSequences()[0].getCanvases();
    }
    
    /** Return position of thumbnail navigation in a certain window.
    * @param {object} state
    * @param {String} windowId
    * @param {String}
    */
    export function getThumbnailNavigationPosition(state, windowId) {
      return state.windows[windowId]
        && state.windows[windowId].thumbnailNavigationPosition;
    }
    
    /**
    * Return manifest title
    * @param {object} manifest
    * @return {String}
    */
    export function getManifestTitle(manifest) {
      return manifest
        && manifest.manifestation
        && manifest.manifestation.getLabel().map(label => label.value)[0];
    }
    
    /** Return type of view in a certain window.
    * @param {object} state
    * @param {String} windowId
    * @param {String}
    */
    export function getWindowViewType(state, windowId) {
      return state.windows[windowId] && state.windows[windowId].view;
    }