mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 22:56:11 +03:00
Viewer: add a basic error message display system
This might be something we want to make configurable for users who want to completely control how errors are displayed. This also adds the first use of OpenSeadragon.makeCenteredNode currently so we might want to clean up that code as well.
This commit is contained in:
parent
2bf6b13bfe
commit
7dcf662fdd
@ -174,7 +174,12 @@ $.Viewer = function( options ) {
|
|||||||
|
|
||||||
this.addHandler( 'open-failed', function (source, args) {
|
this.addHandler( 'open-failed', function (source, args) {
|
||||||
var msg = $.getString( "Errors.Open-Failed", args.source, args.message);
|
var msg = $.getString( "Errors.Open-Failed", args.source, args.message);
|
||||||
window.alert( msg );
|
|
||||||
|
var errorDiv = $.makeNeutralElement( "div" );
|
||||||
|
$.addClass( errorDiv, "modal-dialog error" );
|
||||||
|
errorDiv.appendChild( document.createTextNode( msg ) );
|
||||||
|
|
||||||
|
_this.container.appendChild( $.makeCenteredNode(errorDiv) );
|
||||||
});
|
});
|
||||||
|
|
||||||
$.ControlDock.call( this, options );
|
$.ControlDock.call( this, options );
|
||||||
@ -423,6 +428,13 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
$TileSource,
|
$TileSource,
|
||||||
options;
|
options;
|
||||||
|
|
||||||
|
if (this.container) {
|
||||||
|
var dialogs = this.container.querySelectorAll(".modal-dialog");
|
||||||
|
for (var i = 0; i < dialogs.length; i++) {
|
||||||
|
dialogs[i].parentNode.remove(dialogs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//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*<.*/) ){
|
if( tileSource.match(/\s*<.*/) ){
|
||||||
|
Loading…
Reference in New Issue
Block a user