jablonka.czprosek.czf

weathermap

Subversion Repositories:
[/] [editor-resources/] [newedit.js] - Blame information for rev 122

 

Line No. Rev Author Line
113simandl 
2 
3// the map data structure - updated via JSON from the server
4var map = { valid: 0 };
5 
6// we queue these up to make our one-at-a-time AJAX call work
7var AJAXRequest = {
8 params: {},
9 send: function()
10 {
11 }
12};
13 
14function printfire() {
15 if (document.createEvent)
16 {
17 printfire.args = arguments;
18 var ev = document.createEvent("Events");
19 ev.initEvent("printfire", false, true );
20 dispatchEvent(ev);
21 }
22}
23 
24function syncmap()
25{
26 $('#busy').show();
27 
28 var nodes = map.nodes;
29 // alert("length: "+nodes.length);
30 
31 var a=3;
32 
33 for(var node in nodes)
34 {
35// alert(node);
36 
37 if(map.nodes[node].name != 'DEFAULT')
38 {
39 if(1==1)
40 {
41 var nodeid = 'mapnode_'+map.nodes[node].name;
42 var existing = $('#'+nodeid);
43 
44 if(existing.size() != 0)
45 {
46 //alert('The node already exists called ' + nodeid);
47 }
48 else
49 {
50 // alert("Creating a node called " + nodeid);
51 
52 $('#nodecontainer').append('<img class="draggablenode" src="editcache/'+map.nodes[node].iconcachefile+'" id="'+nodeid+'"/>');
53 existing = $('#'+nodeid);
54 existing.css('position', 'absolute');
55 }
56 // one way or another, by here we have a node, I hope.
57 existing.css("left",map.nodes[node].x);
58 existing.css("top",map.nodes[node].y);
59 }
60 }
61 }
62 $('#busy').hide();
63}
64 
65$(document).ready( function() {
66 
67 $('#welcome').click( function() {
68 $('#welcome').hide('slow');
69 $('#filepicker').show('slow');
70 $('#toolbar').show('slow');
71 } );
72 // $('#filepicker').fadeIn('slow');
73 // $('#themap').fadeIn('slow');
74 
75 
76 $('#welcome').hide();
77 $('#filepicker').hide();
78 $('#toolbar').show();
79 $('#themap').show();
80 
81 $('#busy').show();
82 
83 $.getJSON("ajax-callback.php",
84 { map: " weathermap.conf", cmd: "dump_map" },
85 function(json){
86 $('#busy').hide();
87 $('#existingdata').attr('src',json.map.mapcache);
88 map = json;
89 syncmap();
90 }
91 );
92});

Powered by WebSVN 2.2.1