corrade-nucleus-nucleons – Diff between revs 42 and 43
?pathlinks?
Rev 42 | Rev 43 | |||
---|---|---|---|---|
Line 89... | Line 89... | |||
89 | var states = JSON.parse(cookie); |
89 | var states = JSON.parse(cookie); |
|
90 | if(typeof states[nucleon] !== 'undefined') { |
90 | if(typeof states[nucleon] !== 'undefined') { |
|
91 | var x = states[nucleon].x, |
91 | var x = states[nucleon].x, |
|
92 | y = states[nucleon].y, |
92 | y = states[nucleon].y, |
|
93 | wm = $(data).find('.window-manager-window').get(0); |
93 | wm = $(data).find('.window-manager-window').get(0); |
|
94 | |
94 | |
|
95 | if(typeof wm !== 'undefined') { |
- | ||
96 | wm.style.webkitTransform = |
95 | wm.style.webkitTransform = |
|
97 | wm.style.transform = |
96 | wm.style.transform = |
|
98 | 'translate(' + x + 'px, ' + y + 'px)'; |
97 | 'translate(' + x + 'px, ' + y + 'px)'; |
|
Line 99... | Line 98... | |||
99 | |
98 | |
|
100 | // Update the position attributes |
99 | // Update the position attributes |
|
101 | wm.setAttribute('data-x', x); |
100 | wm.setAttribute('data-x', x); |
|
102 | wm.setAttribute('data-y', y); |
- | ||
103 | } |
101 | wm.setAttribute('data-y', y); |
|
104 | } |
102 | } |
|
105 | } |
103 | } |
|
106 | $(data).hide().appendTo('#window-manager-desktop').fadeIn(750); |
104 | $(data).hide().appendTo('#window-manager-desktop').fadeIn(750); |
|
107 | }).done(function(data) { |
105 | }).done(function(data) { |
|
Line 140... | Line 138... | |||
140 | autoScroll: true, |
138 | autoScroll: true, |
|
Line 141... | Line 139... | |||
141 | |
139 | |
|
142 | onmove: dragMoveListener, |
140 | onmove: dragMoveListener, |
|
143 | onend: function (event) { |
141 | onend: function (event) { |
|
144 | event.target.style.opacity = 1; |
- | ||
145 | |
- | ||
146 | // Save the window position. |
- | ||
147 | var states = {}; |
- | ||
148 | var cookie = Cookies.get('window-manager-windows'); |
- | ||
149 | if(cookie) |
- | ||
150 | states = JSON.parse(cookie); |
- | ||
151 | |
- | ||
152 | $('.window-manager-window').each(function(i, wm) { |
- | ||
153 | states[$(wm).data('target')] = { |
- | ||
154 | x: $(wm).data('x'), |
- | ||
155 | y: $(wm).data('y') |
- | ||
156 | }; |
- | ||
157 | }); |
- | ||
158 | |
- | ||
159 | Cookies.set('window-manager-windows', states, { path: '' }); |
142 | event.target.style.opacity = 1; |
|
160 | }, |
143 | }, |
|
161 | onstart: function(event) { |
144 | onstart: function(event) { |
|
162 | // Move windows to top on drag. |
145 | // Move windows to top on drag. |
|
163 | event.target.style.zIndex = getTopWindowIndex() + 1; |
146 | event.target.style.zIndex = getTopWindowIndex() + 1; |
|
Line 188... | Line 171... | |||
188 | autoScroll: true, |
171 | autoScroll: true, |
|
Line 189... | Line 172... | |||
189 | |
172 | |
|
190 | onmove: dragMoveListener, |
173 | onmove: dragMoveListener, |
|
191 | onend: function (event) { |
174 | onend: function (event) { |
|
192 | event.target.style.opacity = 1; |
- | ||
193 | |
- | ||
194 | // Save the icon position. |
- | ||
195 | var states = {}; |
- | ||
196 | var cookie = Cookies.get('window-manager-icons'); |
- | ||
197 | if(cookie) |
- | ||
198 | states = JSON.parse(cookie); |
- | ||
199 | |
- | ||
200 | $('.window-manager-icon').each(function(i, wm) { |
- | ||
201 | states[$(wm).data('target')] = { |
- | ||
202 | x: $(wm).data('x'), |
- | ||
203 | y: $(wm).data('y') |
- | ||
204 | }; |
- | ||
205 | }); |
- | ||
206 | |
- | ||
207 | Cookies.set('window-manager-icons', states, { path: '' }); |
175 | event.target.style.opacity = 1; |
|
208 | }, |
176 | }, |
|
209 | onstart: function(event) { |
177 | onstart: function(event) { |
|
210 | event.target.style.opacity = 0.5; |
178 | event.target.style.opacity = 0.5; |
|
211 | } |
179 | } |
|
Line 238... | Line 206... | |||
238 | 'translate(' + x + 'px, ' + y + 'px)'; |
206 | 'translate(' + x + 'px, ' + y + 'px)'; |
|
Line 239... | Line 207... | |||
239 | |
207 | |
|
240 | // update the position attributes |
208 | // update the position attributes |
|
241 | target.setAttribute('data-x', x); |
209 | target.setAttribute('data-x', x); |
|
- | 210 | target.setAttribute('data-y', y); |
||
- | 211 | |
||
- | 212 | if(target.classList.contains('window-manager-window')) { |
||
- | 213 | // Save the window position. |
||
- | 214 | var states = {}; |
||
- | 215 | var cookie = Cookies.get('window-manager-windows'); |
||
- | 216 | if(cookie) |
||
- | 217 | states = JSON.parse(cookie); |
||
- | 218 | |
||
- | 219 | states[$(event.target).data('target')] = { |
||
- | 220 | x: x, |
||
- | 221 | y: y |
||
- | 222 | }; |
||
- | 223 | |
||
- | 224 | Cookies.set('window-manager-windows', states, { path: '' }); |
||
- | 225 | } |
||
- | 226 | |
||
- | 227 | if(target.classList.contains('window-manager-icon')) { |
||
- | 228 | // Save the icon position. |
||
- | 229 | var states = {}; |
||
- | 230 | var cookie = Cookies.get('window-manager-icons'); |
||
- | 231 | if(cookie) |
||
- | 232 | states = JSON.parse(cookie); |
||
- | 233 | |
||
- | 234 | states[$(event.target).data('target')] = { |
||
- | 235 | x: x, |
||
- | 236 | y: y |
||
- | 237 | }; |
||
- | 238 | |
||
- | 239 | Cookies.set('window-manager-icons', states, { path: '' }); |
||
242 | target.setAttribute('data-y', y); |
240 | } |
|
Line 243... | Line 241... | |||
243 | } |
241 | } |
|
244 | |
242 | |
|
245 | // this is used later in the resizing and gesture demos |
243 | // this is used later in the resizing and gesture demos |
|
246 | window.dragMoveListener = dragMoveListener; |
244 | window.dragMoveListener = dragMoveListener; |