Browse Source

button to remove packets from launcher. fixes #1

Erinn 8 years ago
parent
commit
03b8f07bd2
1 changed files with 9 additions and 1 deletions
  1. 9 1
      js/ui.js

+ 9 - 1
js/ui.js

@@ -65,12 +65,20 @@ function createPacketEditor(index, packet) {
 	$('#editor').dialog({
 		title: index < 0 ? "Add packet" : "Update packet",
 		resizable:false,
-		buttons:[{ text: index < 0 ? "Add" : "Update", click:function() { updatePlayerPacket(index < 0 ? playerPackets.length : index); createLaunchers(); $(this).dialog("close");}}]
+		buttons:[
+			{ text: "Remove", click:function() { deletePlayerPacket(index); createLaunchers(); $(this).dialog("close"); }},
+			{ text: index < 0 ? "Add" : "Update", click:function() { updatePlayerPacket(index < 0 ? playerPackets.length : index); createLaunchers(); $(this).dialog("close");}}
+		]
 	});
 	$('select').selectmenu();
 	$('#editor').show();
 }
 
+function deletePlayerPacket(index) {
+	playerPackets.splice(index, 1);
+	savePlayerPackets();
+}
+
 function updatePlayerPacket(index) {
 	playerPackets[index] = {
 		from: $("#pktFrom").val(),