* Default dialogs to an empty title

* Fix bug that would cause some singleton dialogs to open several times
* Comment fix
This commit is contained in:
Morgan Jones 2013-05-09 01:29:48 -06:00
parent 04851af096
commit 4b39567e29
2 changed files with 9 additions and 8 deletions

View File

@ -51,7 +51,7 @@ window.dialog = function(options) {
} }
// Build an identifier for this dialog // Build an identifier for this dialog
var id = 'dialog-' + (options.modal ? 'modal' : (options.id ? options.id : 'anonymous-' + window.DIALOG_ID++)); var id = 'dialog-' + (options.modal ? 'modal' : (options.id ? options.id : 'anon-' + window.DIALOG_ID++));
var jqID = '#' + id; var jqID = '#' + id;
var html = ''; var html = '';
@ -74,9 +74,9 @@ window.dialog = function(options) {
// Close out existing dialogs. // Close out existing dialogs.
if(window.DIALOGS[id]) { if(window.DIALOGS[id]) {
try { try {
window.DIALOGS[id].dialog('close'); $(window.DIALOGS[id]).dialog('close');
} catch(err) { } catch(err) {
// This dialog doesn't exist anyway console.log('window.dialog: Tried to close nonexistent dialog ' + id);
} }
} }
@ -87,7 +87,7 @@ window.dialog = function(options) {
modal: false, modal: false,
draggable: true, draggable: true,
closeText: ' ', closeText: ' ',
title: '#<Dialog: ' + id + '>', title: '',
buttons: { buttons: {
'OK': function() { 'OK': function() {
$(this).dialog('close'); $(this).dialog('close');
@ -144,6 +144,7 @@ window.dialog = function(options) {
close.addClass('ui-dialog-titlebar-button-close'); close.addClass('ui-dialog-titlebar-button-close');
} }
window.DIALOGS[$(this).data('id')] = this;
window.DIALOG_COUNT++; window.DIALOG_COUNT++;
console.log('window.dialog: ' + $(this).data('id') + ' (' + $(this).dialog('option', 'title') + ') opened. ' + window.DIALOG_COUNT + ' remain.'); console.log('window.dialog: ' + $(this).data('id') + ' (' + $(this).dialog('option', 'title') + ') opened. ' + window.DIALOG_COUNT + ' remain.');
@ -187,8 +188,6 @@ window.dialog = function(options) {
} }
}, options)); }, options));
window.DIALOGS[id] = dialog[0];
// Set HTML and IDs // Set HTML and IDs
dialog.html(html); dialog.html(html);
dialog.data('id', id); dialog.data('id', id);
@ -220,7 +219,7 @@ window.dialog = function(options) {
* If you want more configurability, use window.dialog instead. * If you want more configurability, use window.dialog instead.
*/ */
window.alert = function(text, isHTML, closeCallback) { window.alert = function(text, isHTML, closeCallback) {
var obj = {title: '', closeCallback: closeCallback}; var obj = {closeCallback: closeCallback};
if(isHTML) { if(isHTML) {
obj.html = text; obj.html = text;
} else { } else {

View File

@ -1,4 +1,6 @@
// REDEEMING ///////////////////////////////////////////////////////// // REDEEMING ///////////////////////////////////////////////////////
// Heuristic passcode redemption that tries to guess unknown items /
////////////////////////////////////////////////////////////////////
/* Resource type names mapped to actual names and abbreviations. /* Resource type names mapped to actual names and abbreviations.
* Add more here if necessary. * Add more here if necessary.