Commit 711ec228 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

beautify HTML ans javascript.

parent cc4b1072
......@@ -27,9 +27,13 @@
<a id="zoom_in">Zoom +</a>
<a id="zoom_out">Zoom -</a>
<a id="export">Export</a>
<form id="export_form" style="display:none" method="post" action="/postJSONData"><textarea id="export_json" name="data"></textarea></form>
<form id="export_form" style="display:none" method="post" action="/postJSONData">
<textarea id="export_json" name="data"></textarea>
</form>
<a id="import">Import</a>
<form id="import_form" style="display:none"><input id="import_file" name="file" type="file"></input></form>
<form id="import_form" style="display:none">
<input id="import_file" name="file" type="file"></input>
</form>
</div>
</div>
......
......@@ -247,7 +247,7 @@
box_left, box_top);
// find an unused ID
var n = 1;
while ($('#'+tool.target.id+'_'+n).length > 0) {
while ($('#' + tool.target.id + '_' + n).length > 0) {
n += 1;
}
_class = tool.target.id.replace('-', '.'); // XXX - vs .
......@@ -262,7 +262,7 @@
}
});
var loadData = function(data) {
var loadData = function (data) {
var preference = data.preference !== undefined ?
data.preference : {};
dream_instance.setPreferences(preference);
......@@ -271,7 +271,10 @@
var coordinates = preference['coordinates'];
$.each(data.nodes, function (key, value) {
if (coordinates === undefined || coordinates[key] === undefined) {
value['coordinate'] = {'top':0.0, 'left':0.0};
value['coordinate'] = {
'top': 0.0,
'left': 0.0
};
} else {
value['coordinate'] = coordinates[key];
}
......@@ -367,8 +370,8 @@
otherwise we have a mapping avg, min max */
if (obj.results.blockage_ratio !== undefined) {
blockage_data.push([counter, obj.results.blockage_ratio
.avg || obj.results.blockage_ratio
]);
.avg || obj.results.blockage_ratio
]);
} else {
blockage_data.push([counter, 0.0]);
}
......@@ -377,8 +380,8 @@
]);
if (obj.results.failure_ratio !== undefined) {
failure_data.push([counter, obj.results.failure_ratio
.avg || obj.results.failure_ratio
]);
.avg || obj.results.failure_ratio
]);
} else {
failure_data.push([counter, 0.0]);
}
......@@ -471,7 +474,7 @@
function (e) {
$('#import_file').click();
});
$("#import_file").change(function() {
$("#import_file").change(function () {
var form = $(this).parent('form')[0];
var form_data = new FormData(form);
$.ajax('/postJSONFile', {
......@@ -480,10 +483,10 @@
processData: false,
data: form_data,
dataType: 'json',
error: function() {
console.log('error');
error: function () {
console.log('error');
},
success: function(data, textStatus, jqXHR) {
success: function (data, textStatus, jqXHR) {
form.reset();
dream_instance.clearAll();
$("#json_output").val(JSON.stringify(data));
......@@ -507,7 +510,7 @@
loadData(JSON.parse($("#json_output").val()));
});
$("#graph_zone").hide();
$("#graph_zone").hide();
});
})(jQuery);
......@@ -89,8 +89,7 @@
} else {
priv.edge_container[connection.id] = [
connection.sourceId,
connection.targetId,
{}
connection.targetId, {}
];
}
priv.onDataChange();
......@@ -137,7 +136,7 @@
}
};
priv.convertToAbsolutePosition = function(x, y) {
priv.convertToAbsolutePosition = function (x, y) {
var canvas_size_x = $('#main').width();
var canvas_size_y = $('#main').height();
var node_style = priv.preference_container['node_style'];
......@@ -154,7 +153,7 @@
return [left, top];
};
that.convertToRelativePosition = function(x, y) {
that.convertToRelativePosition = function (x, y) {
var canvas_size_x = $('#main').width();
var canvas_size_y = $('#main').height();
var size_x = $('.window').width();
......@@ -199,7 +198,8 @@
};
priv.style_attr_list = ['width', 'height', 'font-size', 'padding-top',
'line-height'];
'line-height'
];
that.positionGraph = function () {
$.ajax(
......@@ -264,7 +264,7 @@
"general": priv.general_container
};
if ($.sheet.instance !== undefined) {
data['spreadsheet'] = $.sheet.instance[0].exportSheet.json();
data['spreadsheet'] = $.sheet.instance[0].exportSheet.json();
}
return data;
};
......
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