Improved hints
This commit is contained in:
@@ -10,6 +10,10 @@ function Hint(element)
|
||||
this.element.innerHTML = this.message(module,cmd);
|
||||
this.element.style.display = "block";
|
||||
}
|
||||
else if(commander && commander.element_input.value != ""){
|
||||
this.element.innerHTML = commander.element_input.value;
|
||||
this.element.style.display = "block";
|
||||
}
|
||||
else{
|
||||
this.element.innerHTML = this.default();
|
||||
this.element.style.display = "block";
|
||||
@@ -18,31 +22,26 @@ function Hint(element)
|
||||
|
||||
this.message = function(module,cmd)
|
||||
{
|
||||
var s = "<span class='module'>"+module.constructor.name+"</span>";
|
||||
var s = "<span class='rune'>"+module.rune+"</span><span class='module'>"+module.constructor.name+"</span>";
|
||||
|
||||
s += cmd.content.join("") != "" ? "<span class='command'>"+cmd.content.join(" ")+"</span>" : "";
|
||||
|
||||
// Params
|
||||
|
||||
var e = 0;
|
||||
while(e < 10){
|
||||
if(!module.parameters[e]){ break; }
|
||||
var param_name = module.parameters[e].name;
|
||||
s += cmd[param_name.toLowerCase()]() ? "<span class='value'>"+cmd[param_name.toLowerCase()]().render()+"</span>" : "<span class='param'>"+param_name+"</span>";
|
||||
s += cmd[param_name.toLowerCase()]() ? "" : "<span class='param'>"+param_name+"</span>";
|
||||
e += 1;
|
||||
}
|
||||
|
||||
s += " ";
|
||||
|
||||
s += this.print_variables(module);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
this.print_variables = function(module)
|
||||
{
|
||||
if(module.variables.length < 1){ return "";}
|
||||
|
||||
var s = "";
|
||||
|
||||
for (var key in module.variables){
|
||||
s += "<span class='variable_key'>"+key+"</span>=<span class='variable_value'>"+module.variables[key]+"</span> ";
|
||||
|
||||
// Variables
|
||||
if(module.variables){
|
||||
for (var key in module.variables){
|
||||
if(cmd.variable(key)){continue;}
|
||||
s += "<span class='variable_key'>"+key+"</span>=<span class='variable_value'>"+module.variables[key]+"</span> ";
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
@@ -54,6 +54,7 @@ function Commander(element,element_input)
|
||||
{
|
||||
this.element.setAttribute('class','visible');
|
||||
this.element_input.focus();
|
||||
this.element_input.value = "";
|
||||
}
|
||||
|
||||
this.always = function() {
|
||||
|
||||
Reference in New Issue
Block a user