Skip to content

Commit

Permalink
Merge pull request #1372 from ProjectMirador/2.4.0
Browse files Browse the repository at this point in the history
Merge 2.4.0 development branch into master
  • Loading branch information
aeschylus authored Apr 6, 2017
2 parents 632bcce + d9ec129 commit f86812b
Show file tree
Hide file tree
Showing 30 changed files with 25,268 additions and 69 deletions.
4 changes: 3 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = function(grunt) {
'node_modules/i18next/i18next.min.js',
'node_modules/i18next-browser-languagedetector/i18nextBrowserLanguageDetector.min.js',
'node_modules/i18next-xhr-backend/i18nextXHRBackend.min.js',
'bower_components/simplePagination.js/jquery.simplePagination.js',
'js/lib/modernizr.custom.js',
'js/lib/sanitize-html.min.js'
],
Expand Down Expand Up @@ -93,7 +94,8 @@ module.exports = function(grunt) {
'css/jquery.qtip.min.css',
'node_modules/spectrum-colorpicker/spectrum.css',
'css/mirador.css',
'css/material-icons.css'
'css/material-icons.css',
'bower_components/simplePagination.js/simplePagination.css'
],
dest: 'build/mirador/css/mirador-combined.css'
}
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#Mirador
![mirador banner](http://projectmirador.github.io/mirador/img/banner.jpg)
**Mirador is a multi-repository, configurable, extensible, and easy-to-integrate viewer and annotation creation and comparison environment for IIIF resources, ranging from deep-zooming artwork, to complex manuscript objects. It provides a tiling windowed environment for comparing multiple image-based resources, synchronised structural and visual navigation of content using openSeadragon, Open Annotation compliant annotation creation and viewing on deep-zoomable canvases, metadata display, bookreading, and bookmarking.**
###[See a Demo](http://projectmirador.org/demo/)
###[Getting Started](http://projectmirador.org/docs/docs/getting-started.html)

### [See a Demo](http://projectmirador.org/demo/)
### [Getting Started](http://projectmirador.org/docs/docs/getting-started.html)

### Run in Development
Mirador uses [node.js](http://nodejs.org/) and a build system to assemble, test, and manage the development resources. If you have never used these tools before, you may need to install them.
Expand Down
25 changes: 25 additions & 0 deletions bin/create_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# remove previous packages
rm -rf build/mirador*

# build package
node_modules/.bin/grunt package

# mk tmp release dir
mkdir -p build/tmp/build/mirador

# unzip build
unzip build/mirador.zip -d build/tmp/build

# add example
cp examples/example.html build/tmp/build

cd build/tmp

# zip it up
zip -r build/build.zip build/
mv build/build.zip ../

tar -czvf build/build.tar.gz build/
mv build/build.tar.gz ../

cd -
43 changes: 43 additions & 0 deletions bin/update_demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# remove previous packages
rm -rf build/mirador*

# build package
node_modules/.bin/grunt package

# mk tmp release dir
mkdir build/tmp

# unzip build
unzip build/mirador.zip -d build/tmp

# checkout github pages
git checkout gh-pages

# remove directories
rm -rf demo/css demo/fonts demo/images demo/locales demo/plugins demo/skins demo/themes

# copy over new directories
cp -R build/tmp/mirador/css demo
cp -R build/tmp/mirador/fonts demo
cp -R build/tmp/mirador/images demo
cp -R build/tmp/mirador/locales demo
cp -R build/tmp/mirador/plugins demo
cp -R build/tmp/mirador/skins demo
cp -R build/tmp/mirador/themes demo

# Copy over files
cp build/tmp/mirador/mirador.min.js demo
cp build/tmp/mirador/ZeroClipboard.swf demo

# Clean up extra files
rm demo/css/mirador-combined.css

# Clean up unpacked build
rm -rf build/tmp

# Add and commit demo files
git add demo/
git commit -m 'update demo'
git push origin gh-pages

git checkout -
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
],
"dependencies": {
"sanitize-html": "~1.11.4",
"qtip2": "~2.2.1"
"qtip2": "~2.2.1",
"simplePagination.js": "*"
},
"resolutions": {
"jquery": ">=1.7.2"
Expand Down
21 changes: 19 additions & 2 deletions css/mirador.less/panels/side-panel.less
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

.tabContentArea {
position: relative;
width:280px;
width:270px;
height:100%;
float: left;
background-color: @gray-ef;
Expand All @@ -127,10 +127,27 @@
margin:0;
}

.search-results {
padding:0 5px 0 0;
margin:0;
position:absolute;
height: 100%;

.search-results-container {
overflow-y: scroll;
position: absolute;
height: 70%;
}

.search-results-list .result-wrapper .result-paragraph .highlight {
background-color: rgb(255, 255, 0);
}
}

.toc {
margin:0;
overflow-y: scroll;
width: 280px;
width: 270px;
padding:0;
position:absolute;
box-sizing: border-box;
Expand Down
80 changes: 80 additions & 0 deletions examples/example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" type="text/css" href="mirador/css/mirador-combined.css">
<title>Mirador Viewer</title>
<style type="text/css">
#viewer {
width: 100%;
height: 100%;
position: fixed;
}
</style>
</head>
<body>
<div id="viewer"></div>

<script src="mirador/mirador.min.js"></script>
<script type="text/javascript">

$(function() {
myMiradorInstance = Mirador({
id: "viewer",
layout: "1x1",
buildPath: "mirador/",
data: [
{ manifestUri: "https://iiif.lib.harvard.edu/manifests/drs:48309543", location: "Harvard University"},
{ manifestUri: "https://iiif.lib.harvard.edu/manifests/drs:5981093", location: "Harvard University"},
{ manifestUri: "https://iiif.lib.harvard.edu/manifests/via:olvwork576793", location: "Harvard University"},
{ manifestUri: "https://iiif.lib.harvard.edu/manifests/drs:14033171", location: "Harvard University"},
{ manifestUri: "https://iiif.lib.harvard.edu/manifests/drs:46909368", location: "Harvard University"},
{ manifestUri: "https://iiif.lib.harvard.edu/manifests/drs:48331776", location: "Harvard University"},
{ manifestUri: "http://iiif.harvardartmuseums.org/manifests/object/299843", location: "Harvard University"},
{ manifestUri: "http://iiif.harvardartmuseums.org/manifests/object/304136", location: "Harvard University"},
{ manifestUri: "http://iiif.harvardartmuseums.org/manifests/object/198021", location: "Harvard University"},
{ manifestUri: "http://iiif.harvardartmuseums.org/manifests/object/320567", location: "Harvard University"},
{ manifestUri: "https://purl.stanford.edu/qm670kv1873/iiif/manifest.json", location: "Stanford University"},
{ manifestUri: "https://purl.stanford.edu/jr903ng8662/iiif/manifest.json", location: "Stanford University"},
{ manifestUri: "https://purl.stanford.edu/ch264fq0568/iiif/manifest.json", location: "Stanford University"},
{ manifestUri: "https://purl.stanford.edu/wh234bz9013/iiif/manifest.json", location: "Stanford University"},
{ manifestUri: "https://purl.stanford.edu/rd447dz7630/iiif/manifest.json", location: "Stanford University"},
{ manifestUri: "http://dms-data.stanford.edu/data/manifests/Stanford/ege1/manifest.json", location: "Stanford University"},
{ manifestUri: "http://dams.llgc.org.uk/iiif/4574752/manifest.json", location: "National Library of Wales"},
{ manifestUri: "http://dev.llgc.org.uk/iiif/ww1posters.json", location: "National Library of Wales"},
{ manifestUri: "http://dams.llgc.org.uk/iiif/newspaper/issue/3320640/manifest.json", location: "National Library of Wales"},
{ manifestUri: "http://dams.llgc.org.uk/iiif/2.0/1465298/manifest.json", location: "National Library of Wales"},
{ manifestUri: "http://manifests.ydc2.yale.edu/manifest/Admont23", location: "Yale University"},
{ manifestUri: "http://manifests.ydc2.yale.edu/manifest/Admont43", location: "Yale University"},
{ manifestUri: "http://manifests.ydc2.yale.edu/manifest/BeineckeMS10", location: "Yale University"},
{ manifestUri: "http://manifests.britishart.yale.edu/manifest/5005", location: "Yale Center For British Art"},
{ manifestUri: "http://manifests.britishart.yale.edu/manifest/1474", location: "Yale Center For British Art"},
{ manifestUri: "http://iiif.bodleian.ox.ac.uk/iiif/manifest/51a65464-6408-4a78-9fd1-93e1fa995b9c.json", location: "Bodleian Libraries"},
{ manifestUri: "http://iiif.bodleian.ox.ac.uk/iiif/manifest/f19aeaf9-5aba-4cee-be32-584663ff1ef1.json", location: "Bodleian Libraries"},
{ manifestUri: "http://iiif.bodleian.ox.ac.uk/iiif/manifest/3b31c0a9-3dab-4801-b3dc-f2a3e3786d34.json", location: "Bodleian Libraries"},
{ manifestUri: "http://iiif.bodleian.ox.ac.uk/iiif/manifest/e32a277e-91e2-4a6d-8ba6-cc4bad230410.json", location: "Bodleian Libraries"},
{ manifestUri: "http://gallica.bnf.fr/iiif/ark:/12148/btv1b84539771/manifest.json", location: 'BnF'},
{ manifestUri: "http://gallica.bnf.fr/iiif/ark:/12148/btv1b10500687r/manifest.json", location: 'BnF'},
{ manifestUri: "http://gallica.bnf.fr/iiif/ark:/12148/btv1b55002605w/manifest.json", location: 'BnF'},
{ manifestUri: "http://gallica.bnf.fr/iiif/ark:/12148/btv1b55002481n/manifest.json", location: 'BnF'},
{ manifestUri: "http://www.e-codices.unifr.ch/metadata/iiif/sl-0002/manifest.json", location: 'e-codices'},
{ manifestUri: "http://www.e-codices.unifr.ch/metadata/iiif/bge-cl0015/manifest.json", location: 'e-codices'},
{ manifestUri: "http://www.e-codices.unifr.ch/metadata/iiif/fmb-cb-0600a/manifest.json", location: 'e-codices'},
{ manifestUri: "https://data.ucd.ie/api/img/manifests/ucdlib:33064", location: "University College Dublin"},
{ manifestUri: "https://data.ucd.ie/api/img/manifests/ucdlib:40851", location: "University College Dublin"},
{ manifestUri: "https://data.ucd.ie/api/img/manifests/ucdlib:30708", location: "University College Dublin"},
{ manifestUri: "http://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/manifest.json", location: "University of Tokyo"},
{ manifestUri: "http://www2.dhii.jp/nijl/NIJL0018/099-0014/manifest_tags.json", location: "NIJL"},
{ manifestUri: "http://digi.vatlib.it/iiif/MSS_Vat.lat.3225/manifest.json", location: "Vatican Library"},
{ manifestUri: "http://media.nga.gov/public/manifests/nga_highlights.json", location: "National Gallery of Art"}
],
windowObjects: [],
annotationEndpoint: {
name:"Local Storage",
module: "LocalStorageEndpoint" }
});
});
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions js/src/annotations/annotationTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,11 @@
//if it is a manifest annotation, don't allow editing or deletion
//otherwise, check annotation in endpoint
var showUpdate = false;
if (annotation.endpoint !== 'manifest') {
if (typeof annotation.endpoint !== 'undefined' && annotation.endpoint !== 'manifest') {
showUpdate = annotation.endpoint.userAuthorize('update', annotation);
}
var showDelete = false;
if (annotation.endpoint !== 'manifest') {
if (typeof annotation.endpoint !== 'undefined' && annotation.endpoint !== 'manifest') {
showDelete = annotation.endpoint.userAuthorize('delete', annotation);
}
htmlAnnotations.push({
Expand Down
57 changes: 54 additions & 3 deletions js/src/manifests/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,19 @@

this.request.done(function(jsonLd) {
_this.jsonLd = jsonLd;
_this.buildCanvasMap();
});
},
buildCanvasMap: function() {
var _this = this;
this.canvasMap = {};

if (this.getCanvases()) {
this.getCanvases().forEach(function(canvas) {
_this.canvasMap[canvas['@id']] = canvas;
});
}
},
initFromInfoJson: function(infoJsonUrl) {
var _this = this;
this.request = jQuery.ajax({
Expand Down Expand Up @@ -96,10 +107,10 @@
} else if (canvas.thumbnail.hasOwnProperty('service')) {
service = canvas.thumbnail.service;
if(service.hasOwnProperty('profile')) {
compliance = $.Iiif.getComplianceLevelFromProfile(service.profile);
compliance = $.Iiif.getComplianceLevelFromProfile(service.profile);
}
if(compliance === 0){
// don't change existing behaviour unless compliance is explicitly 0
// don't change existing behaviour unless compliance is explicitly 0
thumbnailUrl = canvas.thumbnail['@id'];
} else {
// Get the IIIF Image API via the @context
Expand Down Expand Up @@ -133,7 +144,7 @@
},
getCanvases : function() {
var _this = this;
return _this.jsonLd.sequences[0].canvases;
return _this.jsonLd.sequences && _this.jsonLd.sequences[0].canvases;
},
getAnnotationsListUrls: function(canvasId) {
var _this = this;
Expand Down Expand Up @@ -202,6 +213,46 @@
};

return dummyManifest;
},
getSearchWithinService: function(){
var _this = this;
var serviceProperty = _this.jsonLd.service;
var service = [];
if (serviceProperty === undefined){
service = null;
}
else if (serviceProperty.constructor === Array){
for (var i = 0; i < serviceProperty.length; i++){
//TODO: should we be filtering search by context
if (serviceProperty[i]["@context"] === "http://iiif.io/api/search/0/context.json" ||
serviceProperty[i]["@context"] === "http://iiif.io/api/search/1/context.json") {
//returns the first service object with the correct context
service.push(serviceProperty[i]);
}
}
}
else if (_this.jsonLd.service["@context"] === "http://iiif.io/api/search/0/context.json" ||
serviceProperty["@context"] === "http://iiif.io/api/search/1/context.json"){
service.push(_this.jsonLd.service);
}
else {
//no service object with the right context is found
service = null;
}
return service;
},

/**
* Get the label of the a canvas by ID
* @param {[type]} canvasId ID of desired canvas
* @return {[type]} string
*/
getCanvasLabel: function(canvasId) {
console.assert(canvasId && canvasId !== '', "No canvasId was specified.");
if (this.canvasMap && canvasId.indexOf('#') >= 0) {
var canvas = this.canvasMap[canvasId.split('#')[0]];
return canvas ? canvas.label : undefined;
}
}
};

Expand Down
5 changes: 4 additions & 1 deletion js/src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@
//control what is available in the side panel. if "sidePanel" is false, these options won't be applied
"sidePanelOptions" : {
"toc" : true,
"annotations" : false
"annotations" : false,
"tocTabAvailable": true,
// "layersTabAvailable": true,
"searchTabAvailable": false,
},
"sidePanelVisible" : true, //whether or not to make the side panel visible in this window on load. This setting is dependent on sidePanel being true
"overlay" : true, //whether or not to make the metadata overlay available/visible in this window
Expand Down
2 changes: 1 addition & 1 deletion js/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@

$.sanitizeHtml = function(dirty) {
return sanitizeHtml(dirty, {
allowedTags: ['a', 'b', 'br', 'i', 'img', 'p', 'span', 'strong', 'em'],
allowedTags: ['a', 'b', 'br', 'i', 'img', 'p', 'span', 'strong', 'em', 'ul', 'ol', 'li'],
allowedAttributes: {
'a': ['href', 'target'],
'img': ['src', 'alt'],
Expand Down
1 change: 1 addition & 0 deletions js/src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
// add main menu
if (showMainMenu) {
this.mainMenu = new $.MainMenu({ appendTo: this.element, state: this.state, eventEmitter: this.eventEmitter });
this.eventEmitter.publish('mainMenuInitialized');
}

// add viewer area
Expand Down
16 changes: 16 additions & 0 deletions js/src/widgets/annotationsLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
init: function() {
var _this = this;
_this.eventEmitter.unsubscribe(('modeChange.' + _this.windowId));
_this.eventEmitter.unsubscribe(('slotLeave.' + _this.windowId));
_this.eventEmitter.unsubscribe(('slotEnter.' + _this.windowId));

this.createStateMachine();
this.createRenderer();
Expand All @@ -43,6 +45,20 @@
_this.annotationsList = _this.state.getWindowAnnotationsList(_this.windowId);
_this.updateRenderer();
});

_this.eventEmitter.subscribe('slotLeave.' + _this.windowId, function(event, eventData) {
if (_this.layerState.current == "display") {
_this.layerState.defaultState();
_this.modeSwitch();
}
});

_this.eventEmitter.subscribe('slotEnter.' + _this.windowId, function(event, eventData) {
if (_this.element.showAnno && _this.layerState.current == "display") {
_this.layerState.defaultState();
_this.modeSwitch();
}
});
},

bindEvents: function() {
Expand Down
Loading

0 comments on commit f86812b

Please sign in to comment.