1 | //jQuery( function($) {
|
---|
2 | //$('div.blockWrapper').iNestedSortable(
|
---|
3 | // {
|
---|
4 | // accept: 'block',
|
---|
5 | // }
|
---|
6 | //);
|
---|
7 | //});
|
---|
8 |
|
---|
9 | console.log("Loading gui_div.js\n");
|
---|
10 |
|
---|
11 | $(document).ready(function(){
|
---|
12 |
|
---|
13 | console.log("Document ready function\n");
|
---|
14 |
|
---|
15 | $('a.minmax').bind('click', toggleContent);
|
---|
16 | $('a.remove').bind('click', removeContent);
|
---|
17 |
|
---|
18 | /*
|
---|
19 | $('div.blockWrapper').NestedSortable(
|
---|
20 | {
|
---|
21 | accept: 'block',
|
---|
22 | helperclass: 'sortHelper',
|
---|
23 | activeclass : 'sortableactive',
|
---|
24 | hoverclass : 'sortablehover',
|
---|
25 |
|
---|
26 | // Restricts sort start click to the specified element.
|
---|
27 | handle: 'div.header',
|
---|
28 | onStart : function()
|
---|
29 | {
|
---|
30 | $.iAutoscroller.start(this, document.getElementsByTagName('body'));
|
---|
31 | },
|
---|
32 | onStop : function()
|
---|
33 | {
|
---|
34 | $.iAutoscroller.stop();
|
---|
35 | }
|
---|
36 | }
|
---|
37 | );
|
---|
38 | */
|
---|
39 |
|
---|
40 |
|
---|
41 | $('#formatStatement').sortable({
|
---|
42 | 'cursor':'pointer',
|
---|
43 | 'tolerance': 'pointer',
|
---|
44 | 'items':'.gsf\\:template',
|
---|
45 | 'placeholder':'placeholder',
|
---|
46 | //'nested':'div'
|
---|
47 | });
|
---|
48 |
|
---|
49 | $('.gsf\\:template').sortable({
|
---|
50 | 'cursor':'pointer',
|
---|
51 | 'tolerance': 'pointer',
|
---|
52 | 'items':'.table, .gsf\\:choose-metadata, .gsf\\:metadata',
|
---|
53 | 'placeholder':'placeholder'
|
---|
54 | //'nested':'.gsf:metadata'
|
---|
55 | });
|
---|
56 |
|
---|
57 | $('.table').sortable({
|
---|
58 | 'cursor':'pointer',
|
---|
59 | 'tolerance': 'pointer',
|
---|
60 | 'items':'.leaf .gsf\\:choose-metadata, .gsf\\:link, .gsf\\:switch',
|
---|
61 | 'placeholder':'placeholder'
|
---|
62 | //'nested':'.gsf:metadata'
|
---|
63 | });
|
---|
64 |
|
---|
65 | $('.gsf\\:choose-metadata').sortable({
|
---|
66 | 'cursor':'pointer',
|
---|
67 | 'tolerance': 'pointer',
|
---|
68 | 'items':'.gsf\\:metadata',
|
---|
69 | 'placeholder':'placeholder',
|
---|
70 | 'connectWith':'.gsf\\:choose-metadata'
|
---|
71 | //'nested':'.gsf:metadata'
|
---|
72 | });
|
---|
73 |
|
---|
74 | $('.gsf\\:link').sortable({
|
---|
75 | 'cursor':'pointer',
|
---|
76 | 'tolerance': 'pointer',
|
---|
77 | 'items':'.gsf\\:icon',
|
---|
78 | 'placeholder':'placeholder'
|
---|
79 | //'nested':'.gsf:metadata'
|
---|
80 | });
|
---|
81 |
|
---|
82 | $('.gsf\\:switch').sortable({
|
---|
83 | 'cursor':'pointer',
|
---|
84 | 'tolerance': 'pointer',
|
---|
85 | 'items':'.gsf\\:metadata, .gsf\\:when, .gsf\\otherwise',
|
---|
86 | 'placeholder':'placeholder'
|
---|
87 | //'nested':'.gsf:metadata'
|
---|
88 | });
|
---|
89 |
|
---|
90 | $('.gsf\\:when').sortable({
|
---|
91 | 'cursor':'pointer',
|
---|
92 | 'tolerance': 'pointer',
|
---|
93 | 'items':'.leaf',
|
---|
94 | 'placeholder':'placeholder'
|
---|
95 | //'nested':'.gsf:metadata'
|
---|
96 | });
|
---|
97 |
|
---|
98 | $('.gsf\\:otherwise').sortable({
|
---|
99 | 'cursor':'pointer',
|
---|
100 | 'tolerance': 'pointer',
|
---|
101 | 'items':'.leaf',
|
---|
102 | 'placeholder':'placeholder'
|
---|
103 | //'nested':'.gsf:metadata'
|
---|
104 | });
|
---|
105 |
|
---|
106 | /*
|
---|
107 | $('div.blockWrapper').sortable(
|
---|
108 | {
|
---|
109 | accept: 'block',
|
---|
110 | helperclass: 'sortHelper',
|
---|
111 | activeclass : 'sortableactive',
|
---|
112 | hoverclass : 'sortablehover',
|
---|
113 |
|
---|
114 | // Restricts sort start click to the specified element.
|
---|
115 | handle: 'div.header',
|
---|
116 |
|
---|
117 | // This is the way the reordering behaves during drag. Possible values: 'intersect', 'pointer'. In some setups, 'pointer' is more natural.
|
---|
118 | // * intersect: draggable overlaps the droppable at least 50%
|
---|
119 | // * pointer: mouse pointer overlaps the droppable
|
---|
120 | tolerance: 'pointer',
|
---|
121 | //containment: 'parent',
|
---|
122 | nested: 'div',
|
---|
123 | onChange : function(ser)
|
---|
124 | {
|
---|
125 | },
|
---|
126 | onStart : function()
|
---|
127 | {
|
---|
128 | $.iAutoscroller.start(this, document.getElementsByTagName('body'));
|
---|
129 | },
|
---|
130 | onStop : function()
|
---|
131 | {
|
---|
132 | $.iAutoscroller.stop();
|
---|
133 | }
|
---|
134 | }
|
---|
135 | );
|
---|
136 | */
|
---|
137 |
|
---|
138 | $(".block").mouseover(function()
|
---|
139 | {
|
---|
140 | //alert("Mouse over event");
|
---|
141 | $(this).parents().css("border", "");
|
---|
142 | $(this).css("border", "1px solid blue");
|
---|
143 | return false;
|
---|
144 | }).mouseout(function(){
|
---|
145 | $(this).css("border", "");
|
---|
146 | return false;
|
---|
147 | });
|
---|
148 |
|
---|
149 | });
|
---|
150 |
|
---|
151 | var removeContent = (function () {
|
---|
152 | //var parentTag = $(this).parent().get(0).titleName;
|
---|
153 | //alert("Removing div " + parentTag);
|
---|
154 | $(this).parent().remove();
|
---|
155 | });
|
---|
156 |
|
---|
157 |
|
---|
158 | var toggleContent = function(e)
|
---|
159 | {
|
---|
160 | var targetContent = $('div.block', this.parentNode);
|
---|
161 | if (targetContent.css('display') == 'none') {
|
---|
162 | targetContent.slideDown(300);
|
---|
163 | $(this).html('[-]');
|
---|
164 | } else {
|
---|
165 | targetContent.slideUp(300);
|
---|
166 | $(this).html('[+]');
|
---|
167 | }
|
---|
168 | return false;
|
---|
169 | };
|
---|
170 |
|
---|
171 | function serialize(s)
|
---|
172 | {
|
---|
173 | serial = $.SortSerialize(s);
|
---|
174 | alert(serial.hash);
|
---|
175 | };
|
---|
176 |
|
---|
177 |
|
---|