Browse Source

Small js tweaks.

undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 11 years ago
parent
commit
1d5310b12e
2 changed files with 41 additions and 41 deletions
  1. +1
    -1
      test/easy_mesh_dictionnary.js
  2. +40
    -40
      test/type_dictionnary.js

+ 1
- 1
test/easy_mesh_dictionnary.js View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//Command vars operations //Command vars operations
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
CmdVar("[ ]", ["Opens a new context,\nevery operations between the braces will only be done to the vertices added since the start of this context."]);
CmdVar("[ ]", ["Opens a new context,\nevery operations between the braces\nwill only be done to the vertices added\nsince the start of this context."]);
CmdVar("float", ["Fraction value", "0.0"]); CmdVar("float", ["Fraction value", "0.0"]);
CmdVar("int", ["No decimal value", "0"]); CmdVar("int", ["No decimal value", "0"]);
CmdVar("bool", ["Boolean value", "true/false", "1/0"]); CmdVar("bool", ["Boolean value", "true/false", "1/0"]);


+ 40
- 40
test/type_dictionnary.js View File

@@ -193,6 +193,7 @@ function CmdLookup(div_cmds, div_args, div_cmnt, div_vars, text_src)
var cur_dict = GetCmdDictionnary(); var cur_dict = GetCmdDictionnary();
if (text_src != undefined) if (text_src != undefined)
{ {
var type_list = new Array();
var cmd_size = 8; var cmd_size = 8;
var found = FindMatchingCommand(text_src); var found = FindMatchingCommand(text_src);
if (found.match_list.length > 0) if (found.match_list.length > 0)
@@ -224,7 +225,6 @@ function CmdLookup(div_cmds, div_args, div_cmnt, div_vars, text_src)
found.match_list[0] = found.match_list[best_match]; found.match_list[0] = found.match_list[best_match];
found.match_list[best_match] = tmp; found.match_list[best_match] = tmp;


var type_list = new Array();
div_cmds[0].innerHTML = ""; div_cmds[0].innerHTML = "";
div_cmds[1].innerHTML = ""; div_cmds[1].innerHTML = "";
div_args.innerHTML = ""; div_args.innerHTML = "";
@@ -254,7 +254,7 @@ function CmdLookup(div_cmds, div_args, div_cmnt, div_vars, text_src)
while (word-- > 0) while (word-- > 0)
div_cmds[word].innerHTML += "<br>"; div_cmds[word].innerHTML += "<br>";
//Go through the arguments and show them, force if we found the perfect match //Go through the arguments and show them, force if we found the perfect match
if (perfect_match || (found.match_list.length < 4 && i == 0))
if ((perfect_match || found.match_list.length < 4) && i == 0)
{ {
div_args.innerHTML += "&nbsp;>&nbsp;"; div_args.innerHTML += "&nbsp;>&nbsp;";
if (cur_match.m_arg != undefined) if (cur_match.m_arg != undefined)
@@ -298,52 +298,52 @@ function CmdLookup(div_cmds, div_args, div_cmnt, div_vars, text_src)
} }
} }
} }
//Go through the type list and bold the used ones.
if (cur_dict.m_vars != undefined)
}
else
{
div_cmds[0].innerHTML = "[ ...&nbsp;";
div_cmds[1].innerHTML = "";
div_args.innerHTML = "";
div_cmnt.innerHTML = "";
}
//Go through the type list and bold the used ones.
if (cur_dict.m_vars != undefined)
{
div_vars.innerHTML = "";
var max = cur_dict.m_vars.length;
for (var j = 0; j < max; j++)
{ {
div_vars.innerHTML = "";
var max = cur_dict.m_vars.length;
for (var j = 0; j < max; j++)
{
var cur_var = cur_dict.m_vars[j];
div_vars.innerHTML += "&nbsp;>&nbsp;";
var k = 0;
for (; k < type_list.length; k++)
if (cur_var.m_type == type_list[k])
break;
var cur_var = cur_dict.m_vars[j];
div_vars.innerHTML += "&nbsp;>&nbsp;";
var k = 0;
for (; k < type_list.length; k++)
if (cur_var.m_type == type_list[k])
break;


//Bold the used variables
if (k < type_list.length)
div_vars.innerHTML += "<b>" + cur_var.m_type + "</b>";
else
div_vars.innerHTML += cur_var.m_type;
//Bold the used variables
if (k < type_list.length)
div_vars.innerHTML += "<b>" + cur_var.m_type + "</b>";
else
div_vars.innerHTML += cur_var.m_type;
if (cur_var.m_syntax != undefined)
if (cur_var.m_syntax != undefined)
{
var align_size = 9;
var cmd_size = cur_var.m_type.length + 3;
for (var m = 0; m < cur_var.m_syntax.length; m++)
{ {
var align_size = 9;
var cmd_size = cur_var.m_type.length + 3;
for (var m = 0; m < cur_var.m_syntax.length; m++)
{
for (var l = 0; l < align_size - cmd_size; l++)
div_vars.innerHTML += "&nbsp;";
div_vars.innerHTML += cur_var.m_syntax[m] + "<br>";
cmd_size = 0;
}
var tab = '';
for (var l = 0; l < align_size - cmd_size; l++) for (var l = 0; l < align_size - cmd_size; l++)
tab += "&nbsp;";
while (div_vars.innerHTML.indexOf('\n') > -1)
div_vars.innerHTML = div_vars.innerHTML.replace('\n', '<br>' + tab);
div_vars.innerHTML += "&nbsp;";
div_vars.innerHTML += cur_var.m_syntax[m] + "<br>";
cmd_size = 0;
} }
var tab = '';
for (var l = 0; l < align_size - cmd_size; l++)
tab += "&nbsp;";
while (div_vars.innerHTML.indexOf('\n') > -1)
div_vars.innerHTML = div_vars.innerHTML.replace('\n', '<br>' + tab);
} }
} }
} }
else
{
div_cmds[0].innerHTML = "[ ...&nbsp;";
div_cmds[1].innerHTML = "";
div_args.innerHTML = "";
div_cmnt.innerHTML = "";
}
} }
} }

Loading…
Cancel
Save