diff --git a/aiserver.py b/aiserver.py index 6635b39d..5f387626 100644 --- a/aiserver.py +++ b/aiserver.py @@ -2643,7 +2643,7 @@ def actionredo(): # Send sequences to UI for selection - genout = [[item['Text'], True] for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Previous Selection"]==True)] + genout = [[item['Text'], "redo"] for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Previous Selection"]==True)] emit('from_server', {'cmd': 'genseqs', 'data': genout}, broadcast=True) else: emit('from_server', {'cmd': 'popuperror', 'data': "There's nothing to undo"}, broadcast=True) @@ -3082,7 +3082,7 @@ def genselect(genout): # Store sequences in memory until selection is made vars.genseqs = genout - genout = [[item['Text'], item['Pinned']] for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Previous Selection"]==False) and (item["Edited"]==False)] + genout = [[item['Text'], "pinned" if item['Pinned'] else "normal"] for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Previous Selection"]==False) and (item["Edited"]==False)] # Send sequences to UI for selection emit('from_server', {'cmd': 'genseqs', 'data': genout}, broadcast=True) diff --git a/static/application.js b/static/application.js index 956f8f82..b24bbe1d 100644 --- a/static/application.js +++ b/static/application.js @@ -1163,27 +1163,41 @@ function parsegenseqs(seqs) { seqselcontents.html(""); var i; for(i=0; i"+seqs[i][0]+"" + + //Now do the icon (pin/redo) + + if (seqs[i][1] == "redo") { + text_data = text_data + "" + } else if (seqs[i][1] == "pinned") { + text_data = text_data + "" } else { - color = "grey" + text_data = text_data + "" } - seqselcontents.append("
"+seqs[i][0]+"
"); + text_data = text_data + "" + seqselcontents.append(text_data); + + //setup on-click actions $("#seqsel"+i).on("click", function () { socket.send({'cmd': 'seqsel', 'data': $(this).attr("n")}); }); - $("#seqselpin"+i).on("click", function () { - socket.send({'cmd': 'seqpin', 'data': $(this).attr("n")}); - if ($(this).attr("style") == "color: grey") { - console.log($(this).attr("style")); - $(this).css({"color": "white"}); - console.log($(this).attr("style")); - } else { - console.log($(this).attr("style")); - $(this).css({"color": "grey"}); - console.log($(this).attr("style")); - } - }); + + //onclick for pin only + if (seqs[i][1] != "redo") { + $("#seqselpin"+i).on("click", function () { + socket.send({'cmd': 'seqpin', 'data': $(this).attr("n")}); + if ($(this).attr("style") == "color: grey") { + console.log($(this).attr("style")); + $(this).css({"color": "white"}); + console.log($(this).attr("style")); + } else { + console.log($(this).attr("style")); + $(this).css({"color": "grey"}); + console.log($(this).attr("style")); + } + }); + } } $('#seqselmenu').slideDown("slow"); }