2017-06-26 19:52:49 +00:00
|
|
|
function TextBox(config){
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
self.id = config.id;
|
|
|
|
|
|
|
|
// Create DOM
|
|
|
|
self.dom = document.createElement("div");
|
|
|
|
self.dom.className = "object";
|
|
|
|
self.dom.classList.add("textbox");
|
|
|
|
|
2017-07-10 18:06:22 +00:00
|
|
|
// Customize
|
2017-07-15 02:29:31 +00:00
|
|
|
_configText(config, self.dom);
|
2017-07-10 18:06:22 +00:00
|
|
|
|
|
|
|
// Set Text!
|
|
|
|
self.setText = function(words){
|
|
|
|
self.dom.innerHTML = words;
|
|
|
|
};
|
|
|
|
self.setTextID = function(id){
|
|
|
|
self.text_id = id;
|
|
|
|
self.setText(Words.get(self.text_id));
|
|
|
|
};
|
2017-07-13 18:49:49 +00:00
|
|
|
if(config.text_id) self.setTextID(config.text_id);
|
2017-07-15 02:29:31 +00:00
|
|
|
else if(config.text) self.setText(config.text);
|
|
|
|
|
|
|
|
// Add & Remove
|
|
|
|
self.add = function(){ _add(self); };
|
|
|
|
self.remove = function(){ _remove(self); };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function CharacterTextBox(config){
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
self.id = config.id;
|
|
|
|
|
|
|
|
// Create DOM
|
|
|
|
self.dom = document.createElement("div");
|
|
|
|
self.dom.className = "object";
|
|
|
|
self.dom.classList.add("textbox");
|
|
|
|
self.dom.classList.add("character");
|
|
|
|
self.dom.classList.add(config.character);
|
|
|
|
|
|
|
|
// Customize
|
|
|
|
_configText(config, self.dom);
|
|
|
|
|
|
|
|
// Peep
|
|
|
|
var peep = document.createElement("div");
|
|
|
|
peep.id = "peep";
|
|
|
|
peep.setAttribute("char", config.character);
|
|
|
|
self.dom.appendChild(peep);
|
|
|
|
|
|
|
|
// Description
|
|
|
|
var desc = document.createElement("div");
|
|
|
|
desc.id = "desc";
|
|
|
|
desc.innerHTML = Words.get("character_"+config.character);
|
|
|
|
self.dom.appendChild(desc);
|
2017-06-26 19:52:49 +00:00
|
|
|
|
2017-07-13 18:49:49 +00:00
|
|
|
// Add & Remove
|
|
|
|
self.add = function(){ _add(self); };
|
|
|
|
self.remove = function(){ _remove(self); };
|
2017-06-26 19:52:49 +00:00
|
|
|
|
2017-07-10 15:38:20 +00:00
|
|
|
}
|