Skip to content

Commit

Permalink
initial work on #44, updated manifesto
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Aug 14, 2015
1 parent 89acfaf commit c8a2bd9
Show file tree
Hide file tree
Showing 9 changed files with 184 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Inspired by https://github.com/DigitalInnovation/mns-digital-blog/blob/master/.travis.yml
language: node_js
node_js:
- '0.10'
- '0.12.7'
before_install:
- npm install -g grunt-cli
- npm install -g bower
Expand Down
2 changes: 2 additions & 0 deletions src/extensions/uv-seadragon-extension/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Commands {
static SEADRAGON_ANIMATION_FINISH: string = Commands.namespace + 'onAnimationfinish';
static SEADRAGON_ANIMATION_START: string = Commands.namespace + 'onAnimationStart';
static SEADRAGON_OPEN: string = Commands.namespace + 'onOpen';
static SEARCH_PREVIEW_START: string = Commands.namespace + 'onSearchPreviewStart';
static SEARCH_PREVIEW_FINISH: string = Commands.namespace + 'onSearchPreviewFinish';
static SEADRAGON_RESIZE: string = Commands.namespace + 'onResize';
static SEADRAGON_ROTATION: string = Commands.namespace + 'onRotation';
static SEARCH: string = Commands.namespace + 'onSearch';
Expand Down
290 changes: 153 additions & 137 deletions src/lib/manifesto.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/modules/uv-searchfooterpanel-module/FooterPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ class FooterPanel extends BaseFooterPanel {

var canvasIndex = parseInt($placemarker.attr('data-index'));

$.publish(Commands.SEARCH_PREVIEW_START, [canvasIndex]);

var placemarkers = that.getSearchResultPlacemarkers();
var elemIndex = placemarkers.index($placemarker[0]);

Expand Down Expand Up @@ -359,6 +361,8 @@ class FooterPanel extends BaseFooterPanel {
}

onPlacemarkerMouseLeave(e, that): void {
$.publish(Commands.SEARCH_PREVIEW_FINISH);

var $placemarker = $(this);

var newElement = e.toElement || e.relatedTarget;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/uv-shared-module/BaseExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class BaseExtension implements IExtension {
});

return new Promise<Manifesto.IExternalResource[]>((resolve) => {
this.provider.manifest.loadResources(
manifesto.loadExternalResources(
resources,
this.clickThrough,
this.login,
Expand Down
5 changes: 2 additions & 3 deletions src/modules/uv-shared-module/BaseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ class BaseProvider implements IProvider{
if (this.isPagingSettingEnabled()){
var indices = this.getPagedIndices(canvasIndex);

// todo: use constants
if (this.getViewingDirection().toString() === "right-to-left"){
if (this.getViewingDirection().toString() === manifesto.ViewingDirection.rightToLeft().toString()){
index = indices.last() - 1;
} else {
index = indices[0] - 1;
Expand Down Expand Up @@ -416,7 +415,7 @@ class BaseProvider implements IProvider{

getLocales(): any[] {
if (this.locales) return this.locales;

b
// use data-locales to prioritise
var items = this.config.localisation.locales.clone();
var sorting = this.bootstrapper.params.locales;
Expand Down
14 changes: 10 additions & 4 deletions src/modules/uv-treeviewleftpanel-module/ThumbsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ class ThumbsView extends BaseView {
this.loadThumbs();
});

$.subscribe(Commands.SEARCH_PREVIEW_START, (e, canvasIndex) => {
//this.searchPreviewStart(canvasIndex);
});

$.subscribe(Commands.SEARCH_PREVIEW_FINISH, () => {
//this.searchPreviewFinish();
});

this.$thumbs = $('<div class="thumbs"></div>');
this.$element.append(this.$thumbs);

Expand All @@ -62,9 +70,8 @@ class ThumbsView extends BaseView {

$.views.helpers({
separator: function(){
// todo: use constants
var viewingDirection = that.provider.getViewingDirection().toString();
if (viewingDirection === "top-to-bottom" || viewingDirection === "bottom-to-top"){
if (viewingDirection === manifesto.ViewingDirection.topToBottom().toString() || viewingDirection === manifesto.ViewingDirection.bottomToTop().toString()){
return true; // one thumb per line
}
// two thumbs per line
Expand All @@ -84,10 +91,9 @@ class ThumbsView extends BaseView {
className += " placeholder";
}

// todo: use constants
var viewingDirection = that.provider.getViewingDirection().toString();

if (viewingDirection === "top-to-bottom" || viewingDirection === "bottom-to-top"){
if (viewingDirection === manifesto.ViewingDirection.topToBottom().toString() || viewingDirection === manifesto.ViewingDirection.bottomToTop().toString()){
className += " oneCol";
} else {
className += " twoCol";
Expand Down
3 changes: 1 addition & 2 deletions src/modules/uv-treeviewleftpanel-module/TreeViewLeftPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ class TreeViewLeftPanel extends LeftPanel {

var viewingDirection = this.provider.getViewingDirection().toString();

// todo: use constants
if (viewingDirection === "top-to-bottom" || viewingDirection === "bottom-to-top"){
if (viewingDirection === manifesto.ViewingDirection.topToBottom().toString() || viewingDirection === manifesto.ViewingDirection.bottomToTop().toString()){
width = this.config.options.oneColThumbWidth;
height = this.config.options.oneColThumbHeight;
} else {
Expand Down
16 changes: 10 additions & 6 deletions src/typings/manifesto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ declare module Manifesto {
private _parseTreeNode(node, range);
getType(): ManifestType;
isMultiSequence(): boolean;
loadResource(resource: IExternalResource, clickThrough: (resource: IExternalResource) => void, login: (loginServiceUrl: string) => Promise<void>, getAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken) => Promise<void>, getStoredAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, handleResourceResponse: (resource: IExternalResource) => Promise<any>): Promise<IExternalResource>;
loadResources(resources: IExternalResource[], clickThrough: (resource: IExternalResource) => void, login: (loginServiceUrl: string) => Promise<void>, getAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken) => Promise<void>, getStoredAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, handleResourceResponse: (resource: IExternalResource) => Promise<any>): Promise<IExternalResource[]>;
authorize(resource: IExternalResource, clickThrough: (resource: IExternalResource) => void, login: (loginServiceUrl: string) => Promise<void>, getAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken) => Promise<void>, getStoredAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>): Promise<IExternalResource>;
}
}
declare module Manifesto {
Expand Down Expand Up @@ -260,6 +257,14 @@ declare module Manifesto {
}
declare var http: any;
declare var url: any;
declare module Manifesto {
class Utils {
static loadManifest(uri: string): Promise<any>;
static loadExternalResource(resource: IExternalResource, clickThrough: (resource: IExternalResource) => void, login: (loginServiceUrl: string) => Promise<void>, getAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken) => Promise<void>, getStoredAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, handleResourceResponse: (resource: IExternalResource) => Promise<any>, options?: IManifestoOptions): Promise<IExternalResource>;
static loadExternalResources(resources: IExternalResource[], clickThrough: (resource: IExternalResource) => void, login: (loginServiceUrl: string) => Promise<void>, getAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken) => Promise<void>, getStoredAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, handleResourceResponse: (resource: IExternalResource) => Promise<any>, options?: IManifestoOptions): Promise<IExternalResource[]>;
static authorize(resource: IExternalResource, clickThrough: (resource: IExternalResource) => void, login: (loginServiceUrl: string) => Promise<void>, getAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken) => Promise<void>, getStoredAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>): Promise<IExternalResource>;
}
}
declare module Manifesto {
interface IAccessToken {
accessToken: string;
Expand Down Expand Up @@ -332,8 +337,6 @@ declare module Manifesto {
getTree(): TreeNode;
getType(): ManifestType;
isMultiSequence(): boolean;
loadResource(resource: IExternalResource, clickThrough: (resource: IExternalResource) => void, login: (loginServiceUrl: string) => Promise<void>, getAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken) => Promise<void>, getStoredAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, handleResourceResponse: (resource: IExternalResource) => Promise<any>): Promise<IExternalResource>;
loadResources(resources: IExternalResource[], clickThrough: (resource: IExternalResource) => void, login: (loginServiceUrl: string) => Promise<void>, getAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken) => Promise<void>, getStoredAccessToken: (tokenServiceUrl: string) => Promise<IAccessToken>, handleResourceResponse: (resource: IExternalResource) => Promise<any>): Promise<IExternalResource[]>;
options: IManifestoOptions;
rootRange: IRange;
sequences: ISequence[];
Expand All @@ -346,7 +349,8 @@ declare module Manifesto {
}
}
interface IManifesto {
load: (manifestUri: string, callback: (manifest: string) => void) => void;
loadManifest: (uri: string) => Promise<any>;
loadExternalResources: (resources: Manifesto.IExternalResource[], clickThrough: (resource: Manifesto.IExternalResource) => void, login: (loginServiceUrl: string) => Promise<void>, getAccessToken: (tokenServiceUrl: string) => Promise<Manifesto.IAccessToken>, storeAccessToken: (resource: Manifesto.IExternalResource, token: Manifesto.IAccessToken) => Promise<void>, getStoredAccessToken: (tokenServiceUrl: string) => Promise<Manifesto.IAccessToken>, handleResourceResponse: (resource: Manifesto.IExternalResource) => Promise<any>, options?: Manifesto.IManifestoOptions) => Promise<Manifesto.IExternalResource[]>;
create: (manifest: string, options?: Manifesto.IManifestoOptions) => Manifesto.Manifest;
CanvasType: Manifesto.CanvasType;
ElementType: Manifesto.ElementType;
Expand Down

0 comments on commit c8a2bd9

Please sign in to comment.