euscanwww: use jQuery each instead of for

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-06-03 17:38:51 +02:00
parent 5970b4df37
commit 2edb220d3e

View File

@ -18,21 +18,22 @@
selector.append( selector.append(
$("<option/>").text("-------------").attr("selected", "selected") $("<option/>").text("-------------").attr("selected", "selected")
); );
for (task in data["tasks"]) { $.each(data.tasks, function(task) {
var t = data["tasks"][task]; var t = data["tasks"][task];
selector.append( selector.append(
$("<option/>").val(task).text(task) $("<option/>").val(task).text(task)
) )
} });
selector.change(function() { selector.change(function() {
$("#task_data").empty();
var task = data["tasks"][$(this).val()]; var task = data["tasks"][$(this).val()];
$("#task_data").empty();
if (task.args) { if (task.args) {
for (var i = 0; i < task.args.length; i++) { $.each(task.args, function(i) {
var arg = task.args[i]; var arg = task.args[i]
var arg_input = $("<input/>").attr("name", arg); , arg_input = $("<input/>").attr("name", arg)
var default_arg; , default_arg;
if (task.defaults) { if (task.defaults) {
var default_arg_i = task.args.length - 1 - i; var default_arg_i = task.args.length - 1 - i;
@ -42,7 +43,7 @@
arg_input.attr("type", "checkbox"); arg_input.attr("type", "checkbox");
} }
else { else {
continue return true;
} }
} }
} }
@ -54,7 +55,7 @@
).append( ).append(
arg_input arg_input
); );
} });
} }
}) })