Skip to content

Commit

Permalink
check @context present
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Dec 5, 2016
1 parent 8d48d73 commit f5b8877
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 34 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "manifesto",
"version": "2.0.3",
"version": "2.0.4",
"homepage": "https://github.com/edsilv/manifesto",
"authors": [
"edsilv <[email protected]>"
Expand Down
10 changes: 6 additions & 4 deletions dist/client/manifesto.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,12 @@ var Manifesto;
if (!width) {
width = this.externalResource.data.width;
}
if (this.externalResource.data['@context'].indexOf('/1.0/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1.1/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1/context.json') > -1) {
quality = 'native';
if (this.externalResource.data['@context']) {
if (this.externalResource.data['@context'].indexOf('/1.0/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1.1/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1/context.json') > -1) {
quality = 'native';
}
}
}
else {
Expand Down
12 changes: 7 additions & 5 deletions dist/client/manifesto.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// manifesto.js v2.0.3 https://github.com/viewdir/manifesto
// manifesto.js v2.0.4 https://github.com/viewdir/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 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})({1:[function(require,module,exports){
(function (global){
var Manifesto;
Expand Down Expand Up @@ -666,10 +666,12 @@ var Manifesto;
if (!width) {
width = this.externalResource.data.width;
}
if (this.externalResource.data['@context'].indexOf('/1.0/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1.1/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1/context.json') > -1) {
quality = 'native';
if (this.externalResource.data['@context']) {
if (this.externalResource.data['@context'].indexOf('/1.0/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1.1/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1/context.json') > -1) {
quality = 'native';
}
}
}
else {
Expand Down
14 changes: 7 additions & 7 deletions dist/client/manifesto.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/manifesto.bundle.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// manifesto.js v2.0.3 https://github.com/viewdir/manifesto
// manifesto.js v2.0.4 https://github.com/viewdir/manifesto
declare module exjs {
}
declare module exjs {
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.js v2.0.3 https://github.com/viewdir/manifesto
// manifesto.js v2.0.4 https://github.com/viewdir/manifesto
declare module Manifesto {
class StringValue {
value: string;
Expand Down
12 changes: 7 additions & 5 deletions dist/server/manifesto.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/server/manifesto.min.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.0.3",
"version": "2.0.4",
"description": "IIIF Presentation API utility library for client and server",
"main": "dist/server/manifesto.js",
"scripts": {
Expand Down
15 changes: 9 additions & 6 deletions src/Canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ module Manifesto {
var size: string;

// if an info.json has been loaded
if (this.externalResource && this.externalResource.data){
if (this.externalResource && this.externalResource.data) {
id = this.externalResource.data['@id'];

if (!width){
if (!width) {
width = this.externalResource.data.width;
}

if (this.externalResource.data['@context'].indexOf('/1.0/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1.1/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1/context.json') > -1 ) {
quality = 'native';
if (this.externalResource.data['@context']) {
if (this.externalResource.data['@context'].indexOf('/1.0/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1.1/context.json') > -1 ||
this.externalResource.data['@context'].indexOf('/1/context.json') > -1 ) {
quality = 'native';
}
}

} else {
// info.json hasn't been loaded yet
var images: IAnnotation[] = this.getImages();
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ module Manifesto {
// returned access tokens are not stored, therefore the login window flashes for every request.

resource.getData().then(() => {
if (resource.isAccessControlled()){
if (resource.isAccessControlled()) {
// if the resource has a click through service, use that.
if (resource.clickThroughService){
resolve(clickThrough(resource));
Expand Down

0 comments on commit f5b8877

Please sign in to comment.