demo-json.html: Separate code from data

This commit is contained in:
anatoly techtonik 2013-03-12 16:38:12 +03:00
parent 1e6b1ad035
commit 64db6c14bc

View File

@ -3,10 +3,10 @@
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="springy.js"></script> <script src="springy.js"></script>
<script src="springyui.js"></script> <script src="springyui.js"></script>
<script> <script>
var graph = new Graph(); var graphJSON = {
graph.loadJSON(
{
"nodes": [ "nodes": [
'Amphitryon', 'Amphitryon',
'Alcmene', 'Alcmene',
@ -19,10 +19,12 @@ graph.loadJSON(
['Amphitryon', 'Iphicles'], ['Amphitryon', 'Iphicles'],
['Amphitryon', 'Heracles'] ['Amphitryon', 'Heracles']
] ]
} };
);
jQuery(function(){ jQuery(function(){
var graph = new Graph();
graph.loadJSON(graphJSON);
var springy = jQuery('#springydemo').springy({ var springy = jQuery('#springydemo').springy({
graph: graph graph: graph
}); });
@ -30,5 +32,7 @@ jQuery(function(){
</script> </script>
<canvas id="springydemo" width="640" height="480" /> <canvas id="springydemo" width="640" height="480" />
</body> </body>
</html> </html>