diff --git a/htdocs/lib/settings/BookmarkTable.js b/htdocs/lib/settings/BookmarkTable.js index a4c6025..a0927af 100644 --- a/htdocs/lib/settings/BookmarkTable.js +++ b/htdocs/lib/settings/BookmarkTable.js @@ -341,7 +341,7 @@ $.fn.bookmarktable = function() { } var row = $( '' + - '' + + '' + '' + b.name + '' + '' + renderFrequency(b.frequency) + '' + '' + modulation + '' + @@ -356,5 +356,45 @@ $.fn.bookmarktable = function() { } $importModal.modal('show'); }); + + $importModal.on('click', '.confirm', function() { + var $list = $importModal.find('.bookmark-list table'); + if ($list.length) { + var selected = $list.find('tr').filter(function(){ + return $(this).find('.select').is(':checked'); + }).map(function(){ + return $(this).data('bookmark'); + }).toArray(); + if (selected.length) { + $.ajax(document.location.href, { + data: JSON.stringify(selected), + contentType: 'application/json', + method: 'POST' + }).done(function(data){ + var modes = $table.data('modes'); + if (data.length && data.length == selected.length) { + $table.append(data.map(function(obj, index) { + var bookmark = selected[index]; + var modulation_name = bookmark.modulation; + if (modulation_name in modes) { + modulation_name = modes[modulation_name]; + } + return $( + '' + + '' + bookmark.name + '' + + '' + renderFrequency(bookmark.frequency) +'' + + '' + modulation_name + '' + + '' + + '' + + '' + + '' + ) + })); + } + }); + } + } + $importModal.modal('hide'); + }); }); };