From 28a26713b3773f7b27c0b86036157cd50934bd7a Mon Sep 17 00:00:00 2001 From: X O Date: Sun, 10 Jan 2016 15:03:09 +1030 Subject: [PATCH] use class for browser dialog --- gui/slick/css/browser.css | 12 ++++++------ gui/slick/js/browser.js | 40 ++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/gui/slick/css/browser.css b/gui/slick/css/browser.css index 571501723e..bdc1f3ab3d 100644 --- a/gui/slick/css/browser.css +++ b/gui/slick/css/browser.css @@ -1,30 +1,30 @@ -#fileBrowserDialog { +.fileBrowserDialog { max-height: 480px; overflow-y: auto; } -#fileBrowserDialog ul { +.fileBrowserDialog ul { margin: 0; padding: 0; } -#fileBrowserDialog ul li { +.fileBrowserDialog ul li { margin: 2px 0; cursor: pointer; list-style-type: none; } -#fileBrowserDialog ul li a { +.fileBrowserDialog ul li a { display: block; padding: 4px 0; } -#fileBrowserDialog ul li a:hover { +.fileBrowserDialog ul li a:hover { color: #00f; background: none; } -#fileBrowserDialog ul li a span.ui-icon { +.fileBrowserDialog ul li a .ui-icon { margin: 0 4px; float: left; } diff --git a/gui/slick/js/browser.js b/gui/slick/js/browser.js index b3a447d815..e9512dd67a 100644 --- a/gui/slick/js/browser.js +++ b/gui/slick/js/browser.js @@ -78,7 +78,7 @@ // make a fileBrowserDialog object if one doesn't exist already if (!fileBrowserDialog) { // set up the jquery dialog - fileBrowserDialog = $('
').appendTo('body').dialog({ + fileBrowserDialog = $('
').appendTo('body').dialog({ dialogClass: 'browserDialog', title: options.title, position: { my: 'center top', at: 'center top+60', of: window }, @@ -89,30 +89,26 @@ modal: true, autoOpen: false }); - } - else { + } else { // The title may change, even if fileBrowserDialog already exists - fileBrowserDialog.dialog('option', 'title', options.title); + fileBrowserDialog.dialog('option', 'title', options.title); } - - fileBrowserDialog.dialog('option', 'buttons', [ - { - text: 'Ok', - 'class': 'btn', - click: function () { - // store the browsed path to the associated text field - callback(currentBrowserPath, options); - $(this).dialog('close'); - } - }, - { - text: 'Cancel', - 'class': 'btn', - click: function () { - $(this).dialog('close'); - } + + fileBrowserDialog.dialog('option', 'buttons', [{ + text: 'Ok', + 'class': 'btn', + click: function () { + // store the browsed path to the associated text field + callback(currentBrowserPath, options); + $(this).dialog('close'); + } + }, { + text: 'Cancel', + 'class': 'btn', + click: function () { + $(this).dialog('close'); } - ]); + }]); // set up the browser and launch the dialog var initialDir = '';