From ffacfb6476fb4857e1889765e4cdf9ae0fb2508e Mon Sep 17 00:00:00 2001 From: Thomas Pinaud Date: Sat, 22 Jun 2013 18:08:40 +0200 Subject: [PATCH 1/2] Added 'format' options which allow to specify format to display. It allow to swap source by using setFormat('big'). Format string used need to be into the data object. The goal is to swap format when modifying galleria size (like on Youtube video) --- src/galleria.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/galleria.js b/src/galleria.js index a9dd083b..2eebe194 100644 --- a/src/galleria.js +++ b/src/galleria.js @@ -2397,6 +2397,7 @@ Galleria.prototype = { dummy: undef, // 1.2.5 easing: 'galleria', extend: function(options) {}, + format: 'image', fullscreenCrop: undef, // 1.2.5 fullscreenDoubleTap: true, // 1.2.4 toggles fullscreen on double-tap for touch devices fullscreenTransition: undef, // 1.2.6 @@ -4529,8 +4530,8 @@ this.prependChild( 'info', 'myElement' ); if ( !data ) { return; } - - var src = data.iframe || ( this.isFullscreen() && 'big' in data ? data.big : data.image ), // use big image if fullscreen mode + + var src = data.iframe || ( this.isFullscreen() && 'big' in data ? data.big : data[this.getOptions('format')] ), // use big image if fullscreen mode active = this._controls.getActive(), next = this._controls.getNext(), cached = next.isCached( src ), @@ -4890,6 +4891,27 @@ this.prependChild( 'info', 'myElement' ); return this._stageWidth; }, + /** + Specify source format to diplay. Data must contains the specified format + + @param {string} format Format to use + + */ + setFormat : function(format){ + format = format == undefined ? "image" : format; + this.setOptions('format', format); + //this._options.format = format; + this.show(this._active); + }, + + /** + Retrieve the format to display + + */ + getFormat : function(){ + return this.getOptions('format'); + }, + /** Retrieve the option @@ -4897,7 +4919,6 @@ this.prependChild( 'info', 'myElement' ); @returns option or options */ - getOptions : function( key ) { return typeof key === 'undefined' ? this._options : this._options[ key ]; }, From 7609ddc370f03cbeb82c038e5aa766090c7ff806 Mon Sep 17 00:00:00 2001 From: Thomas Pinaud Date: Sat, 22 Jun 2013 22:51:24 +0200 Subject: [PATCH 2/2] Removed getFormat which is replace by getOptions --- src/galleria.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/galleria.js b/src/galleria.js index 2eebe194..6677ebec 100644 --- a/src/galleria.js +++ b/src/galleria.js @@ -4904,14 +4904,6 @@ this.prependChild( 'info', 'myElement' ); this.show(this._active); }, - /** - Retrieve the format to display - - */ - getFormat : function(){ - return this.getOptions('format'); - }, - /** Retrieve the option