* 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
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 html = '';
@ -74,9 +74,9 @@ window.dialog = function(options) {
// Close out existing dialogs.
if(window.DIALOGS[id]) {
try {
window.DIALOGS[id].dialog('close');
$(window.DIALOGS[id]).dialog('close');
} 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,
draggable: true,
closeText: ' ',
title: '#<Dialog: ' + id + '>',
title: '',
buttons: {
'OK': function() {
$(this).dialog('close');
@ -144,6 +144,7 @@ window.dialog = function(options) {
close.addClass('ui-dialog-titlebar-button-close');
}
window.DIALOGS[$(this).data('id')] = this;
window.DIALOG_COUNT++;
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));
window.DIALOGS[id] = dialog[0];
// Set HTML and IDs
dialog.html(html);
dialog.data('id', id);
@ -220,7 +219,7 @@ window.dialog = function(options) {
* If you want more configurability, use window.dialog instead.
*/
window.alert = function(text, isHTML, closeCallback) {
var obj = {title: '', closeCallback: closeCallback};
var obj = {closeCallback: closeCallback};
if(isHTML) {
obj.html = text;
} 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.
* Add more here if necessary.