diff options
author | Simon Rettberg | 2019-08-01 15:12:05 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-08-01 15:12:05 +0200 |
commit | 7c767557db2a5d28f72c43919db0f284f24e1abd (patch) | |
tree | 8da7036b6bbc4ac8981f5cea6b1d9a9fe2467af2 /modules-available/roomplanner | |
parent | [roomplanner] Search only returns clients allowed in that room (diff) | |
download | slx-admin-7c767557db2a5d28f72c43919db0f284f24e1abd.tar.gz slx-admin-7c767557db2a5d28f72c43919db0f284f24e1abd.tar.xz slx-admin-7c767557db2a5d28f72c43919db0f284f24e1abd.zip |
[roomplanner] Ugly workaround for modal-close-bug on Firefox
Diffstat (limited to 'modules-available/roomplanner')
-rw-r--r-- | modules-available/roomplanner/clientscript.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/modules-available/roomplanner/clientscript.js b/modules-available/roomplanner/clientscript.js index 48311a09..0ad14a25 100644 --- a/modules-available/roomplanner/clientscript.js +++ b/modules-available/roomplanner/clientscript.js @@ -11,7 +11,7 @@ var selectMachinInitialized = false; var placedMachines = []; -var $modal, $selectizeSearch; +var $modal, $selectizeSearch, $selectizeSubnet; var currentCallback = false; function makeCombinedFieldSingle(item) @@ -118,6 +118,18 @@ function initSelectize() { /* init modal */ $modal = $('#selectMachineModal'); + // Firefox workaround - don't close the modal when selecting an item from the dropdown + // A proper fix for the underlying cause would be much appreciated + var selectTime = 0; + var ch = function() { + selectTime = Date.now(); + }; + $modal.on('hide.bs.modal', function(e) { + if (Date.now() - selectTime < 400) { + e.preventDefault(); + } + }); + /* for the search */ $selectizeSearch = $('#machineSearchBox').selectize({ plugins : ["remove_button"], @@ -130,6 +142,7 @@ function initSelectize() { maxItems: 1, sortField: 'sortField', sortDirection: 'asc', + onDropdownClose: ch, onChange: clearSubnetBox }); @@ -146,6 +159,7 @@ function initSelectize() { maxItems: 1, sortField: 'sortField', sortDirection: 'asc', + onDropdownClose: ch, onChange: clearSearchBox }); @@ -154,6 +168,7 @@ function initSelectize() { selectMachinInitialized = true; } } + function onBtnSelect() { /* check which one has a value */ console.assert($selectizeSubnet.length === 1); |