mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-16 23:03:13 +03:00
Merge pull request #999 from rburgstaler/rpb/make-tilsources-option-smarter-with-json-xml-string
Make tileSources option smarter about detecting when a json string or…
This commit is contained in:
commit
b481a17298
@ -2121,9 +2121,11 @@ function getTileSourceImplementation( viewer, tileSource, imgOptions, successCal
|
|||||||
|
|
||||||
//allow plain xml strings or json strings to be parsed here
|
//allow plain xml strings or json strings to be parsed here
|
||||||
if ( $.type( tileSource ) == 'string' ) {
|
if ( $.type( tileSource ) == 'string' ) {
|
||||||
if ( tileSource.match( /\s*<.*/ ) ) {
|
//xml should start with "<" and end with ">"
|
||||||
|
if ( tileSource.match( /^\s*<.*>\s*$/ ) ) {
|
||||||
tileSource = $.parseXml( tileSource );
|
tileSource = $.parseXml( tileSource );
|
||||||
} else if ( tileSource.match( /\s*[\{\[].*/ ) ) {
|
//json should start with "{" or "[" and end with "}" or "]"
|
||||||
|
} else if ( tileSource.match(/^\s*[\{\[].*[\}\]]\s*$/ ) ) {
|
||||||
tileSource = $.parseJSON(tileSource);
|
tileSource = $.parseJSON(tileSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user