Commit ab7af7a4 authored by HERBERT Ryan's avatar HERBERT Ryan Committed by Vidjil Team

builder.js refactoring edit prototype

separated content from edit: into functions
parent 171da02a
...@@ -212,7 +212,18 @@ Builder.prototype = { ...@@ -212,7 +212,18 @@ Builder.prototype = {
var divParent = elem.parentNode; var divParent = elem.parentNode;
divParent.innerHTML = ""; divParent.innerHTML = "";
var input = this.setupInput("edit_value", "", "text", self.m.samples[data][self.m.t]); var input = this.create_edit_input();
divParent.appendChild(input);
divParent.onclick = "";
var a = create_save_button();
divParent.appendChild(a);
$('#edit_value')
.select();
},
create_edit_input: function () {
var input = this.setupInput("edit_value", "", "text", self.m.getStrTime(self.m.t, data));
input.style.width = "200px"; input.style.width = "200px";
input.style.border = "0px"; input.style.border = "0px";
input.style.margin = "0px"; input.style.margin = "0px";
...@@ -228,9 +239,10 @@ Builder.prototype = { ...@@ -228,9 +239,10 @@ Builder.prototype = {
m.update() m.update()
}, 500); }, 500);
}) })
divParent.appendChild(input); return input;
divParent.onclick = ""; },
create_save_button: function () {
var a = document.createElement('a'); var a = document.createElement('a');
a.className = "button"; a.className = "button";
a.appendChild(document.createTextNode("save")); a.appendChild(document.createTextNode("save"));
...@@ -242,9 +254,7 @@ Builder.prototype = { ...@@ -242,9 +254,7 @@ Builder.prototype = {
self.m.update() self.m.update()
self.m.analysisHasChanged = true self.m.analysisHasChanged = true
} }
divParent.appendChild(a); return a;
$('#edit_value')
.select();
}, },
/*complete displaySelector menu with correct info about current tagname / top /*complete displaySelector menu with correct info about current tagname / top
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment