From c61a22f750deff5007df186814874cbf1ea15dab Mon Sep 17 00:00:00 2001 From: Heath Nielson Date: Thu, 10 Apr 2014 14:08:19 -0600 Subject: [PATCH] Support query parameters in DZI tileSource URLs Any query parameters that are a part of the tileSource URL are added to the tile URLs. --- src/dzitilesource.js | 5 +++-- test/formats.js | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dzitilesource.js b/src/dzitilesource.js index 9a3b1d03..daed278e 100644 --- a/src/dzitilesource.js +++ b/src/dzitilesource.js @@ -137,7 +137,8 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead } if (url && !options.tilesUrl) { - options.tilesUrl = url.replace(/([^\/]+)\.(dzi|xml|js)$/, '$1_files/'); + options.tilesUrl = url.replace(/([^\/]+)\.(dzi|xml|js)(\?.*|$)/, '$1_files/'); + options.queryParams = url.match(/\?.*/); } return options; @@ -151,7 +152,7 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead * @param {Number} y */ getTileUrl: function( level, x, y ) { - return [ this.tilesUrl, level, '/', x, '_', y, '.', this.fileFormat ].join( '' ); + return [ this.tilesUrl, level, '/', x, '_', y, '.', this.fileFormat, this.queryParams ].join( '' ); }, diff --git a/test/formats.js b/test/formats.js index 7a54048f..c3653123 100644 --- a/test/formats.js +++ b/test/formats.js @@ -66,6 +66,11 @@ }); // ---------- + asyncTest('DZI XML with query parameter', function() { + testOpen('testpattern.xml?param=value'); + }); + + // ---------- asyncTest('IIIF 1.0 JSON', function() { testOpen('iiif1_0.json'); });