From 0aad3bb71afbb6419b90f499118f18676452b095 Mon Sep 17 00:00:00 2001 From: MrYummy Date: Tue, 4 Jul 2017 22:24:50 +0200 Subject: Added choice of project, r/w perms, and fixed up some css --- app/assets/javascripts/memory.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/assets/javascripts/memory.js') diff --git a/app/assets/javascripts/memory.js b/app/assets/javascripts/memory.js index 4dac5a0..a614e91 100644 --- a/app/assets/javascripts/memory.js +++ b/app/assets/javascripts/memory.js @@ -1,10 +1,17 @@ $(function() { + $('td').focus(function() { + if (this.id.split("-")[0] == "memory") { + $(this).css("background-color", "lightblue") + } + }); var data = []; $('td').keydown(function() { data.push(this.id, $(this).html().substr(0, 2)); //position, value }) $('td').blur(function() { + $(this).css("background", "none"); if ((id_i = data.indexOf(this.id) != -1) && data[id_i+1] != $(this).html().substr(0, 2)) { + $(this).css("color", "darkgreen"); var int_id = this.id.split("-")[1] $.post("/memory/update_memory?project="+$(this).closest("table").data("project")+"&file="+Math.floor((int_id/2048)+1)+"&mem_id="+int_id%2048+"&value="+$(this).html().substr(0, 2)); data.splice(id_i, 2); -- cgit v1.2.3