1 | /** |
---|
2 | * @fileOverview |
---|
3 | * This is the main file. Invokes app initialization on ready() |
---|
4 | * @author vronk |
---|
5 | * @version |
---|
6 | */ |
---|
7 | |
---|
8 | var index_container_selector = "#index-container"; |
---|
9 | var graph_container_selector = '#infovis'; |
---|
10 | var navi_container_selector = '#navigate'; |
---|
11 | var detail_container_selector = "#detail-container"; |
---|
12 | var detail_info_holder_selector = '#detail-info-holder'; |
---|
13 | var graph_container = null; |
---|
14 | var index_container = null; |
---|
15 | |
---|
16 | $(function(){ |
---|
17 | |
---|
18 | // check for jQuery |
---|
19 | try{ |
---|
20 | jQuery; |
---|
21 | }catch(e){ |
---|
22 | alert('You need to include jQuery!'); |
---|
23 | } |
---|
24 | |
---|
25 | graph_container = $(graph_container_selector); |
---|
26 | |
---|
27 | // loading userdocs as welcome info |
---|
28 | $(graph_container).load(config.url.userdocs + " div.document"); |
---|
29 | |
---|
30 | loadDetailInfo (); |
---|
31 | |
---|
32 | addFunctionality(); |
---|
33 | |
---|
34 | initGraph(opt("graph")); |
---|
35 | |
---|
36 | ////////////// CREATE UI-LAYOUT |
---|
37 | createBlock('base',''); |
---|
38 | createLayouts('base'); |
---|
39 | |
---|
40 | |
---|
41 | }); |
---|
42 | |
---|
43 | /** |
---|
44 | * This function is called during the initialization sequence and binds event-handlers to events of ui-elements. |
---|
45 | * @function |
---|
46 | */ |
---|
47 | function addFunctionality(){ |
---|
48 | |
---|
49 | // $("#input-filter-index").live('change', function(event) { |
---|
50 | $( document ).on( "change", '#input-filter-index', function(event) { |
---|
51 | filterIndex ($(this).val()); |
---|
52 | }); |
---|
53 | |
---|
54 | /*fillOpts(navi_container_selector); |
---|
55 | $("#navigate .slider").slider(); |
---|
56 | */ |
---|
57 | $("#navigate").QueryInput({params: opts, onValueChanged: renderGraph }); |
---|
58 | |
---|
59 | /* $('#infovis-wrapper').resizable( { |
---|
60 | start: function(event, ui) { |
---|
61 | graph_container.hide(); |
---|
62 | }, |
---|
63 | stop: function(event, ui) { |
---|
64 | graph_container.show(); |
---|
65 | renderGraph(); |
---|
66 | } |
---|
67 | } |
---|
68 | );*/ |
---|
69 | |
---|
70 | /*$('#input-link').live("mousedown", function(event) { |
---|
71 | console.log(this); |
---|
72 | $(this).attr("target", "_blank"); |
---|
73 | $(this).attr("href", generateLink()); |
---|
74 | }); |
---|
75 | */ |
---|
76 | |
---|
77 | //$('#input-download').live("mousedown", genDownload); |
---|
78 | $( document ).on( "mousedown", '#input-download', genDownload); |
---|
79 | |
---|
80 | // $(".detail-caller").live("click", function(event) { |
---|
81 | $( document ).on( "click", '.detail-caller', function(event) { |
---|
82 | //console.log(this); |
---|
83 | event.preventDefault(); |
---|
84 | $(this).parent().find('.detail').toggle(); |
---|
85 | }); |
---|
86 | |
---|
87 | // $(".node-item .detail a").live("click", |
---|
88 | $( document ).on( "click", '.node-item .detail a', function(event) { |
---|
89 | event.preventDefault(); |
---|
90 | key = $(this).attr("data-key"); |
---|
91 | console.log(key); |
---|
92 | selectNodeByKey([key]); |
---|
93 | }); |
---|
94 | |
---|
95 | //$("a.scan").live("click", function(event) { |
---|
96 | $( document ).on( "click", 'a.scan', function(event) { |
---|
97 | console.log(this); |
---|
98 | event.preventDefault(); |
---|
99 | url = $(this).attr("href"); |
---|
100 | $(this).parent().find('.node-detail').html("loading"); |
---|
101 | $(this).parent().find('.node-detail').load(url + " div.content"); |
---|
102 | }); |
---|
103 | } |
---|