X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;ds=sidebyside;f=public%2Fjavascripts%2Flsl.js;h=f7efa52f72236622f57796a2b84a501f4ec95e6e;hb=0753df8cb1a2c3d9bd1a3b36c7d1b71ca529bdd3;hp=3e66db6ede1441b20f9e361e286b30d5a8659af9;hpb=446f81036c7082123098d6afe641c5a149deac25;p=lsl.git diff --git a/public/javascripts/lsl.js b/public/javascripts/lsl.js index 3e66db6..f7efa52 100644 --- a/public/javascripts/lsl.js +++ b/public/javascripts/lsl.js @@ -92,6 +92,14 @@ function edit_list() { .append( $('').text('List name'), $('') + .on('keypress', (ev) => { + if (13 == ev.keyCode) { + save_list(d); + return false; + } + + return true; + }) .val(selected_list.data('lsl-name')) ) ); @@ -101,7 +109,10 @@ function edit_list() { autoOpen: true, modal: true, title: 'Edit list', - width: 'max-content', + width: 'min(calc(100% - 2em), 20em)', + close: (ev) => { + $(ev.target).dialog('destroy'); + }, buttons: [ { class: 'btn-delete', @@ -110,10 +121,6 @@ function edit_list() { delete_list(d); }, }, - { - text: 'Cancel', - click: ()=>{ d.dialog('destroy'); }, - }, { icon: 'ui-icon-disk', text: 'OK', @@ -327,7 +334,10 @@ function edit_list_item(li) { autoOpen: true, modal: true, title: 'Edit item', - width: 'max-content', + width: 'min(calc(100% - 2em), 20em)', + close: (ev) => { + $(ev.target).dialog('destroy'); + }, buttons: [ { class: 'btn-delete', @@ -336,10 +346,6 @@ function edit_list_item(li) { delete_list_item(d, li); }, }, - { - text: 'Cancel', - click: ()=>{ d.dialog('destroy'); }, - }, { icon: 'ui-icon-disk', text: 'OK', @@ -441,5 +447,8 @@ $(function(){ }); $('#list-items').on('change', '.list-item-row input[type="checkbox"]', handle_list_item_state_changed); load_lists(); + $('body').on('click', '.ui-widget-overlay', (ev) => { + $(ev.target).siblings('.ui-dialog').find('.ui-dialog-content').dialog('close'); + }); }); })();