Skip to content

Commit

Permalink
use id for presentation 3 thumbnail uri
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Apr 28, 2018
1 parent bd70944 commit eee9bce
Show file tree
Hide file tree
Showing 10 changed files with 385 additions and 14 deletions.
7 changes: 6 additions & 1 deletion dist/client/manifesto.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,12 @@ var Manifesto;
return thumbnail;
}
else {
return thumbnail['@id'];
if (thumbnail['@id']) {
return thumbnail['@id'];
}
else if (thumbnail.length) {
return thumbnail[0].id;
}
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions dist/client/manifesto.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// manifesto v2.2.20 https://github.com/iiif-commons/manifesto
// manifesto v2.2.21 https://github.com/iiif-commons/manifesto
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.manifesto = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
(function (global){

Expand Down Expand Up @@ -867,7 +867,12 @@ var Manifesto;
return thumbnail;
}
else {
return thumbnail['@id'];
if (thumbnail['@id']) {
return thumbnail['@id'];
}
else if (thumbnail.length) {
return thumbnail[0].id;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/manifesto.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// manifesto v2.2.20 https://github.com/iiif-commons/manifesto
// manifesto v2.2.21 https://github.com/iiif-commons/manifesto

declare namespace Manifesto {
class StringValue {
Expand Down
9 changes: 7 additions & 2 deletions dist/server/manifesto.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "manifesto.js",
"version": "2.2.20",
"version": "2.2.21",
"description": "IIIF Presentation API utility library for client and server",
"main": "./dist/server/manifesto.js",
"types": "./dist/manifesto.d.ts",
Expand Down
6 changes: 5 additions & 1 deletion src/Canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ namespace Manifesto {
if (typeof(thumbnail) === 'string') {
return thumbnail;
} else {
return thumbnail['@id'];
if (thumbnail['@id']) {
return thumbnail['@id'];
} else if (thumbnail.length) {
return thumbnail[0].id;
}
}
}

Expand Down
324 changes: 324 additions & 0 deletions test/fixtures/cats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json",
"type": "Manifest",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/0",
"type": "Canvas",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/0/annotationpage/0",
"type": "AnnotationPage",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/0/annotation/0",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://edsilv.github.io/biiif-workshop/collection/_abyssinian/abyssinian.jpg",
"type": "Image",
"format": "image/jpeg",
"label": {
"@none": [
"_abyssinian"
]
}
},
"target": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/0"
}
]
}
],
"label": {
"@none": [
"_abyssinian"
]
},
"thumbnail": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/_abyssinian/thumb.jpeg",
"type": "Image"
}
]
},
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/1",
"type": "Canvas",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/1/annotationpage/0",
"type": "AnnotationPage",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/1/annotation/0",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://edsilv.github.io/biiif-workshop/collection/_balinese/balinese.jpg",
"type": "Image",
"format": "image/jpeg",
"label": {
"@none": [
"_balinese"
]
}
},
"target": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/1"
}
]
}
],
"label": {
"@none": [
"_balinese"
]
},
"thumbnail": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/_balinese/thumb.jpeg",
"type": "Image"
}
]
},
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/2",
"type": "Canvas",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/2/annotationpage/0",
"type": "AnnotationPage",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/2/annotation/0",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://edsilv.github.io/biiif-workshop/collection/_chartreux/chartreux.jpg",
"type": "Image",
"format": "image/jpeg",
"label": {
"@none": [
"_chartreux"
]
}
},
"target": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/2"
}
]
}
],
"label": {
"@none": [
"_chartreux"
]
},
"thumbnail": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/_chartreux/thumb.jpeg",
"type": "Image"
}
]
},
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/3",
"type": "Canvas",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/3/annotationpage/0",
"type": "AnnotationPage",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/3/annotation/0",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://edsilv.github.io/biiif-workshop/collection/_egyptian-mau/egyptian-mau.jpg",
"type": "Image",
"format": "image/jpeg",
"label": {
"@none": [
"_egyptian-mau"
]
}
},
"target": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/3"
}
]
}
],
"label": {
"@none": [
"_egyptian-mau"
]
},
"thumbnail": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/_egyptian-mau/thumb.jpeg",
"type": "Image"
}
]
},
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/4",
"type": "Canvas",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/4/annotationpage/0",
"type": "AnnotationPage",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/4/annotation/0",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://edsilv.github.io/biiif-workshop/collection/_himalayan/himalayan.jpg",
"type": "Image",
"format": "image/jpeg",
"label": {
"@none": [
"_himalayan"
]
}
},
"target": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/4"
}
]
}
],
"label": {
"@none": [
"_himalayan"
]
},
"thumbnail": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/_himalayan/thumb.jpeg",
"type": "Image"
}
]
},
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/5",
"type": "Canvas",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/5/annotationpage/0",
"type": "AnnotationPage",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/5/annotation/0",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://edsilv.github.io/biiif-workshop/collection/_norwegian-forest-cat/norwegian-forest-cat.jpg",
"type": "Image",
"format": "image/jpeg",
"label": {
"@none": [
"_norwegian-forest-cat"
]
}
},
"target": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/5"
}
]
}
],
"label": {
"@none": [
"_norwegian-forest-cat"
]
},
"thumbnail": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/_norwegian-forest-cat/thumb.jpeg",
"type": "Image"
}
]
},
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/6",
"type": "Canvas",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/6/annotationpage/0",
"type": "AnnotationPage",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/6/annotation/0",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://edsilv.github.io/biiif-workshop/collection/_persian/persian.jpg",
"type": "Image",
"format": "image/jpeg",
"label": {
"@none": [
"_persian"
]
}
},
"target": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/6"
}
]
}
],
"label": {
"@none": [
"_persian"
]
},
"thumbnail": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/_persian/thumb.jpeg",
"type": "Image"
}
]
},
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/7",
"type": "Canvas",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/7/annotationpage/0",
"type": "AnnotationPage",
"items": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/7/annotation/0",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://edsilv.github.io/biiif-workshop/collection/_somali/somali.jpg",
"type": "Image",
"format": "image/jpeg",
"label": {
"@none": [
"_somali"
]
}
},
"target": "https://edsilv.github.io/biiif-workshop/collection/index.json/canvas/7"
}
]
}
],
"label": {
"@none": [
"_somali"
]
},
"thumbnail": [
{
"id": "https://edsilv.github.io/biiif-workshop/collection/_somali/thumb.jpeg",
"type": "Image"
}
]
}
],
"label": {
"@none": [
"Cats"
]
},
"description": "Cat Breeds"
}
1 change: 1 addition & 0 deletions test/fixtures/manifests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
"biocrats": "http://localhost:3001/biocrats.json",
"canvasMetadata": "http://localhost:3001/canvas-metadata.json",
"cardiganshire": "http://localhost:3001/cardiganshire.json",
"cats": "http://localhost:3001/cats.json",
"chemistdruggist": "http://localhost:3001/chemistdruggist.json",
"collectionwiththumbnail": "http://localhost:3001/collection-with-thumbnail.json",
"correspondance": "http://localhost:3001/correspondance.json",
Expand Down
Loading

0 comments on commit eee9bce

Please sign in to comment.