From 847bb6a5753a227dd3b196f20acdf95409439078 Mon Sep 17 00:00:00 2001 From: Exodus4D Date: Sat, 17 Oct 2015 16:31:32 +0200 Subject: [PATCH] Fixed dialog "overlapping" if main character ID not found --- app/pathfinder.ini | 2 +- js/app/mappage.js | 2 +- js/app/ui/dialog/account_settings.js | 8 +++----- js/app/ui/dialog/map_settings.js | 2 +- js/app/util.js | 13 +++++++++++++ 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/pathfinder.ini b/app/pathfinder.ini index 1cf1dc98..7f676a92 100644 --- a/app/pathfinder.ini +++ b/app/pathfinder.ini @@ -1,7 +1,7 @@ [PATHFINDER] NAME = "PATHFINDER" ; installed version (used for CSS/JS cache busting) -VERSION = "v0.0.13" +VERSION = "v0.0.14" ; contact information (DO NOT CHANGE) CONTACT = "https://github.com/exodus4d" ; source code (DO NOT CHANGE) diff --git a/js/app/mappage.js b/js/app/mappage.js index 2c923e45..e5fe24ab 100644 --- a/js/app/mappage.js +++ b/js/app/mappage.js @@ -219,7 +219,7 @@ define([ if(userData.character === undefined){ // no active character found -> show settings dialog - Util.showNotify({title: 'Main character missing', text: 'Check API and set a main character', type: 'error'}); + Util.showNotify({title: 'Main character not set', text: 'Check your API data and set a main character', type: 'error'}); $(document).triggerMenuEvent('ShowSettingsDialog'); } diff --git a/js/app/ui/dialog/account_settings.js b/js/app/ui/dialog/account_settings.js index f4f1e36b..ffb2c65e 100644 --- a/js/app/ui/dialog/account_settings.js +++ b/js/app/ui/dialog/account_settings.js @@ -110,16 +110,14 @@ define([ */ $.fn.showSettingsDialog = function(options){ - // check if there is already a settings dialog open - var settingsDialog = $('#' + config.settingsDialogId); - - if(settingsDialog.length > 0){ + // check if there are other dialogs open + var openDialogs = Util.getOpenDialogs(); + if(openDialogs.length > 0){ return false; } var reroutePath = ''; - // check navigation buttons and show/hide them var checkNavigationButton = function(dialog){ var navigationBarElement = $(dialog).find('.' + config.dialogWizardNavigationClass); diff --git a/js/app/ui/dialog/map_settings.js b/js/app/ui/dialog/map_settings.js index d779ae4b..0db1d5b5 100644 --- a/js/app/ui/dialog/map_settings.js +++ b/js/app/ui/dialog/map_settings.js @@ -7,7 +7,7 @@ define([ 'app/init', 'app/util', 'app/render', - 'bootbox', + 'bootbox' ], function($, Init, Util, Render, bootbox) { 'use strict'; diff --git a/js/app/util.js b/js/app/util.js index 9a594222..bbe9a299 100644 --- a/js/app/util.js +++ b/js/app/util.js @@ -36,6 +36,9 @@ define([ duration: 180 }, + // dialogs + dialogClass: 'modal-dialog', // class for all dialogs (bootstrap) + // map module mapModuleId: 'pf-map-module', // id for main map module mapTabBarId: 'pf-map-tabs' // id for map tab bar @@ -1499,6 +1502,15 @@ define([ return Init.currentSystemData; }; + + /** + * get all "open" dialog elements + * @returns {*|jQuery} + */ + var getOpenDialogs = function(){ + return $('.' + config.dialogClass).filter(':visible'); + }; + /** * formats a price string into an ISK Price * @param price @@ -1623,6 +1635,7 @@ define([ getCurrentUserInfo: getCurrentUserInfo, getCurrentCharacterLog: getCurrentCharacterLog, convertDateToString: convertDateToString, + getOpenDialogs: getOpenDialogs, formatPrice: formatPrice, redirect: redirect, logout: logout