mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 22:56:11 +03:00
open: fix docs, tileHost
* Updated documentation to match actual parameters (see #53) * tileHost was completely broken for dzi files. Now it's based on the DZI source URL (e.g. `foo.dzi` -> tileHost + `foo_files/` vs. `_files/`).
This commit is contained in:
parent
3b1b9cd2f1
commit
6b39a81ef7
@ -1389,12 +1389,12 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
* and provides a callback hook for the resulting Document
|
* and provides a callback hook for the resulting Document
|
||||||
* @function
|
* @function
|
||||||
* @name OpenSeadragon.createFromDZI
|
* @name OpenSeadragon.createFromDZI
|
||||||
* @param {String} xmlUrl
|
* @param {String} dziUrlOrString
|
||||||
* @param {String} xmlString
|
|
||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
|
* @param {String} tileHostname
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
createFromDZI: function( dzi, callback, tileHost ) {
|
createFromDZI: function( dzi, callback, tileHost) {
|
||||||
var async = typeof ( callback ) == "function",
|
var async = typeof ( callback ) == "function",
|
||||||
dziUrl = (
|
dziUrl = (
|
||||||
dzi.substring(0,1) != '<' &&
|
dzi.substring(0,1) != '<' &&
|
||||||
@ -1408,13 +1408,9 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
tilesUrl,
|
tilesUrl,
|
||||||
callbackName;
|
callbackName;
|
||||||
|
|
||||||
|
if (tileHost) {
|
||||||
if( tileHost ){
|
tilesUrl = tileHost + '/' + dziUrl.replace(/^.*\/(.*)\.dzi$/, '$1') + '_files/';
|
||||||
|
} else if (dziUrl) {
|
||||||
tilesUrl = tileHost + "/_files/";
|
|
||||||
|
|
||||||
} else if( dziUrl ) {
|
|
||||||
|
|
||||||
urlParts = dziUrl.split( '/' );
|
urlParts = dziUrl.split( '/' );
|
||||||
filename = urlParts[ urlParts.length - 1 ];
|
filename = urlParts[ urlParts.length - 1 ];
|
||||||
if( filename.match(/_dzi\.js$/) ){
|
if( filename.match(/_dzi\.js$/) ){
|
||||||
@ -1431,7 +1427,6 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
|
|
||||||
|
|
||||||
tilesUrl = urlParts.join( '/' ) + "_files/";
|
tilesUrl = urlParts.join( '/' ) + "_files/";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function finish( func, obj ) {
|
function finish( func, obj ) {
|
||||||
@ -1449,7 +1444,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
if ( async ) {
|
if ( async ) {
|
||||||
if ( dziString ) {
|
if ( dziString ) {
|
||||||
window.setTimeout( function() {
|
window.setTimeout( function() {
|
||||||
var source = finish( processDZIXml, $.parseXml( xmlString ) );
|
var source = finish( processDZIXml, $.parseXml( dziString ) );
|
||||||
// call after finish sets error
|
// call after finish sets error
|
||||||
callback( source, error );
|
callback( source, error );
|
||||||
}, 1);
|
}, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user