From 2b584127c0b5353cef93dd30f7afbfbb03781671 Mon Sep 17 00:00:00 2001 From: edsilv Date: Fri, 12 Jan 2018 14:44:29 +0000 Subject: [PATCH] hide timelineitemcontainer if not needed --- dist/iiif-av-component.bundle.js | 2 +- dist/iiif-av-component.d.ts | 3 ++- dist/iiif-av-component.js | 42 ++++++++++++++++++-------------- dist/iiif-av-component.min.js | 4 +-- examples/js/iiif-av-component.js | 42 ++++++++++++++++++-------------- package.json | 2 +- src/AVComponent.ts | 3 ++- src/CanvasInstance.ts | 42 +++++++++++++++++++------------- 8 files changed, 81 insertions(+), 59 deletions(-) diff --git a/dist/iiif-av-component.bundle.js b/dist/iiif-av-component.bundle.js index 1ac9216..865a333 100644 --- a/dist/iiif-av-component.bundle.js +++ b/dist/iiif-av-component.bundle.js @@ -10889,4 +10889,4 @@ function extend() { }); !function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.manifold=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&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}for(var i="function"==typeof require&&require,o=0;o0)if(9===msie){var settings={url:that._options.iiifResourceUri,type:"GET",dataType:"jsonp",jsonp:"callback",jsonpCallback:"manifestCallback"};$.ajax(settings),global.manifestCallback=function(json){that._loaded(that,JSON.stringify(json),resolve,reject)}}else $.getJSON(that._options.iiifResourceUri,function(json){that._loaded(that,JSON.stringify(json),resolve,reject)})})},Bootstrapper.prototype._loaded=function(bootstrapper,json,resolve,reject){var iiifResource=manifesto.create(json,{locale:bootstrapper._options.locale});if(bootstrapper._options.iiifResource||(bootstrapper._options.iiifResource=iiifResource),iiifResource.getIIIFResourceType().toString()===manifesto.IIIFResourceType.collection().toString()||"collection"===iiifResource.getIIIFResourceType().toString().toLowerCase()){var collections=iiifResource.getCollections();collections&&collections.length?iiifResource.getCollectionByIndex(bootstrapper._options.collectionIndex).then(function(collection){collection||reject("Collection index not found"),0===collection.getTotalManifests()&&0===bootstrapper._options.manifestIndex&&collection.getTotalCollections()>0?(bootstrapper._options.collectionIndex=0,bootstrapper._options.iiifResourceUri=collection.id,bootstrapper.bootstrap(resolve,reject)):collection.getManifestByIndex(bootstrapper._options.manifestIndex).then(function(manifest){bootstrapper._options.manifest=manifest;var helper=new Manifold.Helper(bootstrapper._options);resolve(helper)})}):iiifResource.getManifestByIndex(bootstrapper._options.manifestIndex).then(function(manifest){bootstrapper._options.manifest=manifest;var helper=new Manifold.Helper(bootstrapper._options);resolve(helper)})}else{bootstrapper._options.manifest=iiifResource;var helper=new Manifold.Helper(bootstrapper._options);resolve(helper)}},Bootstrapper.prototype._detectIE=function(){var ua=window.navigator.userAgent,msie=ua.indexOf("MSIE ");if(msie>0)return parseInt(ua.substring(msie+5,ua.indexOf(".",msie)),10);var trident=ua.indexOf("Trident/");if(trident>0){var rv=ua.indexOf("rv:");return parseInt(ua.substring(rv+3,ua.indexOf(".",rv)),10)}var edge=ua.indexOf("Edge/");return edge>0&&parseInt(ua.substring(edge+5,ua.indexOf(".",edge)),10)},Bootstrapper}();Manifold.Bootstrapper=Bootstrapper}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var ExternalResource=function(){function ExternalResource(canvas,options){this.authHoldingPage=null,this.clickThroughService=null,this.externalService=null,this.isResponseHandled=!1,this.kioskService=null,this.loginService=null,this.logoutService=null,this.restrictedService=null,this.tokenService=null,canvas.externalResource=this,this.dataUri=this._getDataUri(canvas),this.index=canvas.index,this.authAPIVersion=options.authApiVersion,this._parseAuthServices(canvas),this._parseDimensions(canvas)}return ExternalResource.prototype._getDataUri=function(canvas){var content=canvas.getContent(),images=canvas.getImages();if(content&&content.length){var annotation=content[0],annotationBody=annotation.getBody();return annotationBody.length?annotationBody[0].id:null}if(images&&images.length){var infoUri=null,firstImage=images[0],resource=firstImage.getResource(),services=resource.getServices();if(services.length){for(var i=0;i'},metadataItem=new Manifesto.MetadataItem(this.options.locale);metadataItem.parse(item),metadataItem.isRootLevel=!0,manifestGroup.addItem(metadataItem)}return metadataGroups.push(manifestGroup),options?this._parseMetadataOptions(options,metadataGroups):metadataGroups},Helper.prototype._parseMetadataOptions=function(options,metadataGroups){var sequence=this.getCurrentSequence(),sequenceMetadata=sequence.getMetadata();if(sequenceMetadata&&sequenceMetadata.length){var sequenceGroup=new Manifold.MetadataGroup(sequence);sequenceGroup.addMetadata(sequenceMetadata),metadataGroups.push(sequenceGroup)}if(options.range){var rangeGroups=this._getRangeMetadata([],options.range);rangeGroups=rangeGroups.reverse(),metadataGroups=metadataGroups.concat(rangeGroups)}if(options.canvases&&options.canvases.length)for(var i=0;i0},Helper.prototype.isBottomToTop=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.bottomToTop().toString()},Helper.prototype.isCanvasIndexOutOfRange=function(index){return this.getCurrentSequence().isCanvasIndexOutOfRange(index)},Helper.prototype.isContinuous=function(){return this.getViewingHint().toString()===manifesto.ViewingHint.continuous().toString()},Helper.prototype.isFirstCanvas=function(index){return"undefined"!=typeof index?this.getCurrentSequence().isFirstCanvas(index):this.getCurrentSequence().isFirstCanvas(this.canvasIndex)},Helper.prototype.isHorizontallyAligned=function(){return this.isLeftToRight()||this.isRightToLeft()},Helper.prototype.isLastCanvas=function(index){return"undefined"!=typeof index?this.getCurrentSequence().isLastCanvas(index):this.getCurrentSequence().isLastCanvas(this.canvasIndex)},Helper.prototype.isLeftToRight=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.leftToRight().toString()},Helper.prototype.isMultiCanvas=function(){return this.getCurrentSequence().isMultiCanvas()},Helper.prototype.isMultiSequence=function(){return this.manifest.isMultiSequence()},Helper.prototype.isPaged=function(){return this.getViewingHint().toString()===manifesto.ViewingHint.paged().toString()},Helper.prototype.isPagingAvailable=function(){return this.isPagingEnabled()&&this.getTotalCanvases()>2},Helper.prototype.isPagingEnabled=function(){return this.manifest.isPagingEnabled()||this.getCurrentSequence().isPagingEnabled()},Helper.prototype.isRightToLeft=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.rightToLeft().toString()},Helper.prototype.isTopToBottom=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.topToBottom().toString()},Helper.prototype.isTotalCanvasesEven=function(){return this.getCurrentSequence().isTotalCanvasesEven()},Helper.prototype.isUIEnabled=function(name){var uiExtensions=this.manifest.getService(manifesto.ServiceProfile.uiExtensions());if(uiExtensions){var disableUI=uiExtensions.getProperty("disableUI");if(disableUI&&(disableUI.indexOf(name)!==-1||disableUI.indexOf(name.toLowerCase())!==-1))return!1}return!0},Helper.prototype.isVerticallyAligned=function(){return this.isTopToBottom()||this.isBottomToTop()},Helper.prototype.createDateNodes=function(rootNode,nodes){for(var i=0;i=n.data.startYear&&year<=n.data.endYear)return n}return null},Helper.prototype.getMonthNode=function(yearNode,month){for(var i=0;i-1&&rootNode.nodes.splice(index,1)}},Helper.prototype.sortDecadeNodes=function(rootNode){rootNode.nodes=rootNode.nodes.sort(function(a,b){return a.data.startYear-b.data.startYear})},Helper.prototype.sortMonthNodes=function(rootNode){for(var _this=this,i=0;i0&&this.getAllSelectedCanvases().length===this.canvases.length},MultiSelectState.prototype.allRangesSelected=function(){return this.ranges.length>0&&this.getAllSelectedRanges().length===this.ranges.length},MultiSelectState.prototype.allSelected=function(){return this.allRangesSelected()&&this.allCanvasesSelected()},MultiSelectState.prototype.getAll=function(){return this.canvases.concat(this.ranges)},MultiSelectState.prototype.getAllSelectedCanvases=function(){return this.canvases.en().where(function(c){return c.multiSelected}).toArray()},MultiSelectState.prototype.getAllSelectedRanges=function(){return this.ranges.en().where(function(r){return r.multiSelected}).toArray()},MultiSelectState.prototype.getCanvasById=function(id){return this.canvases.en().where(function(c){return c.id===id}).first()},MultiSelectState.prototype.getCanvasesByIds=function(ids){for(var canvases=[],i=0;i'+label+""},UriLabeller}();Manifold.UriLabeller=UriLabeller}(Manifold||(Manifold={}))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}); -!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.iiifAvComponent=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&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}for(var i="function"==typeof require&&require,o=0;o'),$canvasContainer=$('
'),$optionsContainer=$('
'),$timelineContainer=$('
'),$durationHighlight=$('
'),$timelineItemContainer=$('
'),$controlsContainer=$('
'),$playButton=$('"),$timingControls=$(""+this.options.data.content.currentTime+': / '+this.options.data.content.duration+': '),$volumeControl=$('');$controlsContainer.append($playButton,$timingControls,$volumeControl),$timelineContainer.append($durationHighlight),$optionsContainer.append($timelineContainer,$timelineItemContainer,$controlsContainer),$player.append($canvasContainer,$optionsContainer),this._$element.append($player);var canvasInstance=new IIIFComponents.CanvasInstance(canvas),canvasWidth=canvas.getWidth(),canvasHeight=canvas.getHeight();canvasWidth?canvasInstance.canvasWidth=canvasWidth:canvasInstance.canvasWidth=this._$element.width(),canvasHeight?canvasInstance.canvasHeight=canvasHeight:canvasInstance.canvasHeight=canvasInstance.canvasWidth*this.options.data.defaultAspectRatio,canvasInstance.$playerElement=$player,canvasInstance.logMessage=this._logMessage.bind(this),canvasInstance.on(AVComponent.Events.PLAYCANVAS,function(){$playButton.removeClass("play"),$playButton.addClass("pause"),$playButton.text(this.options.data.content.pause)},this),canvasInstance.on(AVComponent.Events.PAUSECANVAS,function(){$playButton.removeClass("pause"),$playButton.addClass("play"),$playButton.text(this.options.data.content.play)},this),$timelineContainer.slider({value:0,step:.01,orientation:"horizontal",range:"min",max:canvasInstance.canvasClockDuration,animate:!1,create:function(evt,ui){},slide:function(evt,ui){canvasInstance.setCurrentTime(ui.value)},stop:function(evt,ui){}}),this.canvasInstances.push(canvasInstance),canvasInstance.initContents(),$playButton.on("click",function(){canvasInstance.isPlaying?canvasInstance.pause():canvasInstance.play()}),$volumeControl.on("input",function(){canvasInstance.setVolume(Number(this.value))}),$volumeControl.on("change",function(){canvasInstance.setVolume(Number(this.value))});var that=this;canvasInstance.on("canvasready",function(){canvasInstance.setCurrentTime(0),that.options.data.autoPlay&&canvasInstance.play(),$timingControls.find(".canvasDuration").text(IIIFComponents.AVComponentUtils.Utils.formatTime(canvasInstance.canvasClockDuration)),that._logMessage("CREATED CANVAS: "+canvasInstance.canvasClockDuration+" seconds, "+canvasInstance.canvasWidth+" x "+canvasInstance.canvasHeight+" px."),that.fire(AVComponent.Events.CANVASREADY)},!1)},AVComponent.prototype.getCanvasInstanceById=function(canvasId){canvasId=manifesto.Utils.normaliseUrl(canvasId);for(var i=0;i1){var rangeTiming=temporal[1].split(","),duration=new IIIFComponents.AVComponentObjects.Duration(Number(rangeTiming[0]),Number(rangeTiming[1]));canvasInstance.currentDuration=duration,canvasInstance.highlightDuration(),canvasInstance.setCurrentTime(duration.start),canvasInstance.play()}}},AVComponent.prototype.showCanvas=function(canvasId){for(var i=0;i');break;case"Video":$mediaElement=$('