summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/memory.js
diff options
context:
space:
mode:
authorMrYummy <elemental428@gmail.com>2017-07-01 04:48:52 +0200
committerMrYummy <elemental428@gmail.com>2017-07-01 04:48:52 +0200
commit0f74795159ba65432aa1a6a25367dfdcffd4bb12 (patch)
treeded77479274a99d6f9f5668b911229c1eabb4087 /app/assets/javascripts/memory.js
parent3bfc74045fa61e7646754a1563c8813ed0952f14 (diff)
Added basic hexfile reading that respects r/w perms
Diffstat (limited to 'app/assets/javascripts/memory.js')
-rw-r--r--app/assets/javascripts/memory.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/assets/javascripts/memory.js b/app/assets/javascripts/memory.js
new file mode 100644
index 0000000..4dac5a0
--- /dev/null
+++ b/app/assets/javascripts/memory.js
@@ -0,0 +1,19 @@
+$(function() {
+ var data = [];
+ $('td').keydown(function() {
+ data.push(this.id, $(this).html().substr(0, 2)); //position, value
+ })
+ $('td').blur(function() {
+ if ((id_i = data.indexOf(this.id) != -1) && data[id_i+1] != $(this).html().substr(0, 2)) {
+ 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);
+ }
+ });
+ $('select').change(function() {
+ $.get("/memory/table?project="+$(this).data("project")+"&file="+$(this).find("option:selected").text()+".hex")
+ });
+});
+
+
+