Skip to content

Commit

Permalink
Merge branch '2.1.2' into remove-awesome
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschylus committed Nov 11, 2016
2 parents 77b614d + aa62247 commit 317c329
Show file tree
Hide file tree
Showing 28 changed files with 954 additions and 126 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
language: node_js
node_js:
- '0.10'
- '5'
before_install:
- npm install
- npm install -g bower
- bower install
# before-script:
# - grunt test cover
script:
Expand Down
24 changes: 6 additions & 18 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = function(grunt) {
// libraries/plugins
vendors = [
'js/lib/jquery.min.js',
'js/lib/jquery-migrate-3.0.0.min.js',
'js/lib/jquery-ui.min.js',
'js/lib/modal.js',
'js/lib/bootbox.js',
Expand All @@ -42,12 +43,6 @@ module.exports = function(grunt) {
'js/lib/modernizr.custom.js'
],

// libraries/plugins for running tests
specJs = [
'bower_components/jasmine-jquery/lib/jasmine-jquery.js',
'bower_components/sinon-server/index.js'
],

// source files
sources = [
'js/src/*.js',
Expand Down Expand Up @@ -82,14 +77,6 @@ module.exports = function(grunt) {
},

concat: {
js: {
options: {
banner: '//! <%= pkg.name %> <%= pkg.version %>\n' + '//! Built on <%= grunt.template.today("yyyy-mm-dd") %>\n',
process: true
},
src: [ "<banner>" ].concat(vendors, sources),
dest: distribution
},
css: {
src: [
'css/bootstrap.modals.css',
Expand All @@ -116,10 +103,11 @@ module.exports = function(grunt) {
uglify: {
options: {
preserveComments: 'some',
mangle: false
mangle: false,
sourceMap: true
},
mirador: {
src: [ distribution ],
src: [ vendors, sources ],
dest: minified
}
},
Expand Down Expand Up @@ -239,7 +227,7 @@ module.exports = function(grunt) {

githooks: {
all: {
'pre-commit': 'jshint cover'
'pre-commit': 'jshint'
// 'post-checkout':
}
},
Expand Down Expand Up @@ -271,7 +259,7 @@ module.exports = function(grunt) {
// ----------
// Build task.
// Cleans out the build folder and builds the code and images into it, checking lint.
grunt.registerTask('build', [ 'clean:build', 'git-describe', 'jshint', 'concat', 'cssmin', 'copy' ]);
grunt.registerTask('build', [ 'clean:build', 'git-describe', 'jshint', 'concat', 'uglify', 'cssmin', 'copy' ]);

// ----------
// Dev Build task.
Expand Down
4 changes: 0 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
"spectrum": "git://github.com/bgrins/spectrum.git#*",
"qtip2": "~2.2.1"
},
"devDependencies": {
"sinon-server": "http://sinonjs.org/releases/sinon-server-1.12.2.js",
"jasmine-jquery": "~2.0.6"
},
"resolutions": {
"jquery": ">=1.7.2"
}
Expand Down
50 changes: 25 additions & 25 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To initialize Mirador, it needs to be attached to an existing HTML **div** throu
}
</style>
<link rel="stylesheet" type="text/css" href="build/mirador/css/mirador-combined.css">
<script src="build/mirador/mirador.js"></script>
<script src="build/mirador/mirador.min.js"></script>
</head>
<body>
<div id="viewer"></div>
Expand Down Expand Up @@ -74,11 +74,11 @@ Note that the current version of Mirador can **only **parse collections that are
Within the application itself, there are two other ways for end users to add manifests to Mirador:
1. If showAddFromURLBox has not been disabled, an end user can add a known IIIF manifest URL through the Add new object from URL box:
1. If showAddFromURLBox has not been disabled, an end user can add a known IIIF manifest URL through the Add new object from URL box:
![image alt text](image_1.png)
2. Mirador can handle an end user dropping a IIIF manifest into a window using [IIIF Drag-and-drop](http://zimeon.github.io/iiif-dragndrop/):
2. Mirador can handle an end user dropping a IIIF manifest into a window using [IIIF Drag-and-drop](http://zimeon.github.io/iiif-dragndrop/):
![image alt text](image_2.gif)
Expand All @@ -88,9 +88,9 @@ By default, Mirador is configured to open with a single window. You can specify
```` javascript
Mirador({ id: "viewer",
data: [{
manifestUri: "http://iiif/id/and/uri/of/your/manifest.json",
location: "My Repository"
data: [{
manifestUri: "http://iiif/id/and/uri/of/your/manifest.json",
location: "My Repository"
}],
windowObjects: [{
loadedManifest: "http://iiif/id/and/uri/of/your/manifest.json",
Expand All @@ -108,14 +108,14 @@ There are four possible viewTypes in the current version of Mirador: ImageView (
##### BookView
Like the [previous ](https://github.com/IIIF/mirador/wiki/Configuration-Guides#specifying-which-manifest-will-open)viewType, this configuration provides a minimal, zooming reader, similar to the Internet Archive Bookreader. The instance is configured to show a specific book of the developer's choosing, displayed in a 2-page spread.
Like the [previous ](https://github.com/IIIF/mirador/wiki/Configuration-Guides#specifying-which-manifest-will-open)viewType, this configuration provides a minimal, zooming reader, similar to the Internet Archive Bookreader. The instance is configured to show a specific book of the developer's choosing, displayed in a 2-page spread.
```` javascript
Mirador({
id: "viewer",
data: [{
manifestUri: "http://iiif/id/and/uri/of/your/manifest.json",
location: "My Repository"
manifestUri: "http://iiif/id/and/uri/of/your/manifest.json",
location: "My Repository"
}],
windowObjects: [{
loadedManifest: "http://iiif/id/and/uri/of/your/manifest.json",
Expand All @@ -129,11 +129,11 @@ id: "viewer",
##### ThumbnailsView
The ThumbnailsView viewType configuration displays thumbnail images of all of the pages of the designated book laid out in a grid pattern, from which the user can select and click on a page to view more closely. Unlike the previous viewTypes, the images in ThumbnailsView are not zoomable.
The ThumbnailsView viewType configuration displays thumbnail images of all of the pages of the designated book laid out in a grid pattern, from which the user can select and click on a page to view more closely. Unlike the previous viewTypes, the images in ThumbnailsView are not zoomable.
![image alt text](image_5.png)
##### ScrollView
##### ScrollView
Like the previous viewType, ScrollView displays thumbnail images of the designated book, this time in a side-scrolling format, for the user to select from for closer viewing. As with ThumbnailsView, ScrollView does not display zoomable images.
Expand All @@ -148,8 +148,8 @@ Mirador({
id: "viewer",
layout: "1x2",
data: [{
manifestUri: "http://iiif.lib.harvard.edu/manifests/drs:5981093",
location: "Harvard University"
manifestUri: "http://iiif.lib.harvard.edu/manifests/drs:5981093",
location: "Harvard University"
},
{
manifestUri: "http://iiif.biblissima.fr/manifests/ark:/12148/btv1b84539771/manifest.json",
Expand Down Expand Up @@ -197,13 +197,13 @@ A barebones version of the viewer can be created by turning off the top menu bar
![image alt text](image_10.png)
The configuration and initialisation for this mode looks like this:
The configuration and initialisation for this mode looks like this:
```` javascript
Mirador({
id: "viewer",
buildPath: "",
data: [{
data: [{
manifestUri: "http://iiif/id/and/uri/of/your/manifest.json",
location: "My Repository"
}
Expand Down Expand Up @@ -248,7 +248,7 @@ With the current version of Mirador, you can embed any number of viewers this wa
### Inside a div on same web page
You can also embed Mirador inside a div. To do this, embed both the mirador-combined.css and mirador.js, the fixed-size div and the call to Mirador() as you would do with a full-screen setup. If you have set a CSS margin attribute in your main body tag, you need to add !important to it to prevent the mirador-combined.css from overriding it.
You can also embed Mirador inside a div. To do this, embed both the mirador-combined.css and mirador.js, the fixed-size div and the call to Mirador() as you would do with a full-screen setup. If you have set a CSS margin attribute in your main body tag, you need to add !important to it to prevent the mirador-combined.css from overriding it.
With the current version of Mirador, you can only embed one viewer this way. If you want to embed multiple viewers you must use iframes.
Expand Down Expand Up @@ -279,7 +279,7 @@ With the current version of Mirador, you can only embed one viewer this way. If
}
</style>
<link rel="stylesheet" type="text/css" href="build/mirador/css/mirador-combined.css">
<script src="build/mirador/mirador.js"></script>
<script src="build/mirador/mirador.min.js"></script>
</head>
<body>
<h1>Embedded Default Viewer</h1>
Expand Down Expand Up @@ -438,7 +438,7 @@ deleteAnnotation: function(annotationID, successCallback, errorCallback) {
if (typeof successCallback === "function") {
successCallback();
}
}
}

// Unsuccessful, run error callback if specified
catch (e) {
Expand All @@ -457,15 +457,15 @@ From the given Open Annotation item, find its ID and canvas ID, then replace the
```` javascript
update: function(oaAnnotation, successCallback, errorCallback) {
var _this = this,

// Find canvas ID and annotation ID
key = oaAnnotation.on.full,
annotationID = oaAnnotation['@id'];

try {
// If annotation list isn't loaded, reload
if (_this.annotationsList.length === 0) {
_this.annotationsList = _this.getAnnotationList(key);
_this.annotationsList = _this.getAnnotationList(key);
}

// Find the matching annotation in the array and update it
Expand Down Expand Up @@ -512,10 +512,10 @@ From the given Open Annotation item, find its canvas ID, then add it to the anno
```` javascript
create: function(oaAnnotation, successCallback, errorCallback) {
var _this = this,

// Find the canvas to annotate on
key = oaAnnotation.on.full;

try {
// Reload the annotation list if empty
if (_this.annotationsList.length === 0) {
Expand All @@ -525,7 +525,7 @@ create: function(oaAnnotation, successCallback, errorCallback) {
// Generate a new annotation ID and insert into annotation list
oaAnnotation["@id"] = key + '/' + Date.now();
_this.annotationsList.push(oaAnnotation);

// Remove endpoint reference before JSON.stringify
jQuery.each(_this.annotationsList, function(index, value) {
delete value.endpoint;
Expand Down Expand Up @@ -629,7 +629,7 @@ All remote state endpoints must implement the following functions:

Default options: For this example, the integrator should have a choice between local storage or session storage, and an optional prefix before each entry.

```` javascript
```` javascript
$.MyLocalStateEndpoint = function(opts) {
this.options = {
storage: window.localStorage,
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="viewer"></div>

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

$(function() {
Expand Down
2 changes: 2 additions & 0 deletions js/lib/jquery-migrate-3.0.0.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/src/viewer/manifestListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
}
}
_this.maxPreviewImagesWidth = newMaxPreviewWidth;
_this.eventEmitter.publish('manifestListItemRendered');
},

hide: function() {
Expand Down
19 changes: 19 additions & 0 deletions js/src/widgets/contextControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
move: function(color) {
_this.eventEmitter.publish('changeBorderColor.' + _this.windowId, color.toHexString());
},
show: function(color) {
_this.setColorPickerInCanvas('.borderColorPicker');
},
maxSelectionSize: 4,
color: defaultBorderColor,
palette: [
Expand Down Expand Up @@ -176,6 +179,9 @@
move: function(color) {
_this.eventEmitter.publish('changeFillColor.' + _this.windowId, [color.toHexString(), color.getAlpha()]);
},
show: function(color) {
_this.setColorPickerInCanvas('.fillColorPicker');
},
maxSelectionSize: 4,
color: colorObj,
palette: [
Expand All @@ -188,6 +194,19 @@
// _this.container.find(".fillColorPicker").next(".sp-replacer").append('<i class="fa fa-caret-down dropdown-icon"></i>');
},

setColorPickerInCanvas: function(selector) {
// check for the selector being out of canvas
var pickerContainer=this.container.find(selector).siblings('.sp-container').first(),
pickerOffset=pickerContainer.offset(),
windowWidth = this.state.windowsElements[this.windowId].width();
if (pickerContainer.width() + pickerOffset.left > windowWidth) {
pickerContainer.offset({
top: pickerOffset.top,
left: windowWidth - (pickerContainer.width())
});
}
},

annotationShow: function() {
this.annotationElement.fadeIn("150");
},
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/metadataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
textWithLinks = text,
matches;

if (typeof text === 'string') {
if (typeof text === 'string' && textWithLinks.indexOf('<a ') == -1) {
matches = text.match(regexUrl);

if (matches) {
Expand Down
2 changes: 1 addition & 1 deletion js/src/workspaces/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
_this.endpoint.set('dfd', dfd);
} else {
options.dfd = dfd;
options.windowIDwindowID = _this.id;
options.windowID = _this.id;
options.imagesList = _this.imagesList;
options.eventEmitter = _this.eventEmitter;
_this.endpoint = new $[module](options);
Expand Down
Loading

0 comments on commit 317c329

Please sign in to comment.