Revision 0c27cc1b snf-astakos-app/astakos/im/static/im/js/common.js
b/snf-astakos-app/astakos/im/static/im/js/common.js | ||
---|---|---|
1 |
function setContainerMinHeight( applicableDiv){ |
|
2 |
|
|
3 |
if ( $(applicableDiv).length > 0 ) { |
|
4 |
//var h = $('.header').height(); div.header is not found |
|
5 |
var f = $('.footer').height(); |
|
6 |
var w = $(window).height(); |
|
7 |
var pTop = parseInt (($(applicableDiv).css('padding-top').replace("px", "")) ); |
|
8 |
var pBottom = parseInt (($(applicableDiv).css('padding-bottom').replace("px", ""))); |
|
9 |
|
|
10 |
var c = w - ( f+pTop+pBottom+36);//36 is header's height. |
|
11 |
$(applicableDiv).css('min-height', c); |
|
12 |
} |
|
13 |
|
|
14 |
} |
|
15 |
|
|
16 |
function tableFixedCols(table, firstColWidth ){ |
|
17 |
ColsNum = $('table th').size(); |
|
18 |
var ColWidth = parseFloat( (100 - firstColWidth)/ColsNum ).toFixed(0); |
|
19 |
var ColWidthPercentage = ColWidth+'%'; |
|
20 |
var firstColWidthPercentage = firstColWidth+'%'; |
|
21 |
$('table th, table td').attr('width',ColWidthPercentage ); |
|
22 |
$('table tr td:first-child, table tr th:first-child').attr('width',firstColWidthPercentage ); |
|
23 |
|
|
24 |
} |
|
25 |
|
|
26 |
function addClassHover(hoverEl, applicableEl){ |
|
27 |
$(hoverEl).hover( |
|
28 |
function () { |
|
29 |
|
|
30 |
$(applicableEl).addClass('red-border') |
|
31 |
}, |
|
32 |
function () { |
|
33 |
$(applicableEl).removeClass('red-border'); |
|
34 |
|
|
35 |
}); |
|
36 |
} |
|
37 |
//equal heights |
|
38 |
|
|
39 |
(function($) { |
|
40 |
$.fn.equalHeights = function(minHeight, maxHeight) { |
|
41 |
tallest = (minHeight) ? minHeight : 0; |
|
42 |
this.each(function() { |
|
43 |
if($(this).height() > tallest) { |
|
44 |
tallest = $(this).height(); |
|
45 |
} |
|
46 |
}); |
|
47 |
if((maxHeight) && tallest > maxHeight) tallest = maxHeight; |
|
48 |
return this.each(function() { |
|
49 |
$(this).height(tallest); |
|
50 |
}); |
|
51 |
} |
|
52 |
})(jQuery); |
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
// fix for iPhone - iPad orientation bug |
|
57 |
var metas = document.getElementsByTagName('meta'); |
|
58 |
function resetViewport() { |
|
59 |
var i; |
|
60 |
if (navigator.userAgent.match(/iPhone/i)) { |
|
61 |
for (i=0; i<metas.length; i++) { |
|
62 |
if (metas[i].name == "viewport") { |
|
63 |
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0"; |
|
64 |
} |
|
65 |
} |
|
66 |
} |
|
67 |
} |
|
68 |
resetViewport(); |
|
69 |
|
|
70 |
window.onorientationchange = function() { |
|
71 |
resetViewport(); |
|
72 |
}; |
|
73 |
|
|
74 |
function gestureStart() { |
|
75 |
for (i=0; i<metas.length; i++) { |
|
76 |
if (metas[i].name == "viewport") { |
|
77 |
metas[i].content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6"; |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
if (navigator.userAgent.match(/iPhone/i)) { |
|
83 |
document.addEventListener("gesturestart", gestureStart, false); |
|
84 |
} |
|
85 |
//end of fix |
|
86 |
|
|
87 |
|
|
88 |
$(document).ready(function() { |
|
89 |
|
|
90 |
|
|
91 |
setContainerMinHeight('.container .wrapper'); |
|
92 |
//tableFixedCols('my-projects', 25); |
|
93 |
|
|
94 |
$('.show-extra').click(function(e) { |
|
95 |
e.preventDefault(); |
|
96 |
$(this).parents('.bg-wrap').find('.extra').slideToggle(600); |
|
97 |
}); |
|
98 |
$('.hide-extra').click(function(e) { |
|
99 |
e.preventDefault(); |
|
100 |
$(this).parents('.bg-wrap').find('.extra').slideUp(600); |
|
101 |
}); |
|
102 |
|
|
103 |
$('.box-more p').click(function(e) { |
|
104 |
$(this).siblings('.clearfix').toggle('slow'); |
|
105 |
$(this).parents('.box-more').toggleClass('border'); |
|
106 |
}); |
|
107 |
|
|
108 |
var fixTopMessageHeight = function() { |
|
109 |
var topMargin = parseInt($('.mainlogo img').height())+parseInt($('.top-msg').css('marginBottom')); |
|
110 |
$('.mainlogo').css('marginTop','-'+topMargin+'px'); |
|
111 |
} |
|
112 |
|
|
113 |
if ($('.mainlogo img').length > 0) { |
|
114 |
$('.mainlogo img').bind('load', fixTopMessageHeight) |
|
115 |
} else { |
|
116 |
fixTopMessageHeight(); |
|
117 |
} |
|
118 |
|
|
119 |
$('.top-msg a.close').click(function(e) { |
|
120 |
e.preventDefault(); |
|
121 |
$('.top-msg').animate({ |
|
122 |
paddingTop:'0', |
|
123 |
paddingBottom:'0', |
|
124 |
height:'0' |
|
125 |
}, 1000, function (){ |
|
126 |
$('.top-msg').removeClass('active') |
|
127 |
}); |
|
128 |
$('.mainlogo').animate({ |
|
129 |
marginTop:'0' |
|
130 |
}, 1000, function (){ |
|
131 |
//todo |
|
132 |
}); |
|
133 |
}); |
|
134 |
|
|
135 |
|
|
136 |
$('select.dropkicked').dropkick({ |
|
137 |
change: function (value, label) { |
|
138 |
$(this).parents('form').submit(); |
|
139 |
|
|
140 |
} |
|
141 |
}); |
|
142 |
|
|
143 |
$('.with-info select').attr('tabindex','1'); |
|
144 |
$('.with-info select').dropkick(); |
|
145 |
|
|
146 |
$('.top-msg .success').parents('.top-msg').addClass('success'); |
|
147 |
$('.top-msg .error').parents('.top-msg').addClass('error'); |
|
148 |
$('.top-msg .warning').parents('.top-msg').addClass('warning'); |
|
149 |
$('.top-msg .info').parents('.top-msg').addClass('info'); |
|
150 |
|
|
151 |
// clouds homepage animation |
|
152 |
$('#animation a').hover( |
|
153 |
function () { |
|
154 |
|
|
155 |
$(this).animate({ |
|
156 |
top: '+=-10' |
|
157 |
}, 600, function() { |
|
158 |
if ($(this).find('img').attr('src').indexOf("_top") == -1) { |
|
159 |
var src = $(this).find('img').attr('src').replace('.png', '_top.png') |
|
160 |
$(this).find('img').attr("src", src); |
|
161 |
} |
|
162 |
|
|
163 |
}); |
|
164 |
$(this).siblings('p').find('img').animate({ |
|
165 |
width: '60%' |
|
166 |
}, 600); |
|
167 |
}, |
|
168 |
function () { |
|
169 |
|
|
170 |
$(this).animate({top: '0'}, 600, function() { |
|
171 |
var src = $(this).find('img').attr('src').replace('_top.png', '.png') |
|
172 |
$(this).find('img').attr("src", src); |
|
173 |
}); |
|
174 |
$(this).siblings('p').find('img').animate({ |
|
175 |
width: '65%' |
|
176 |
},600); |
|
177 |
} |
|
178 |
); |
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
$(function() { |
|
184 |
$( "#id_start_date" ).datepicker({ |
|
185 |
minDate: 0, |
|
186 |
defaultDate: "+0", |
|
187 |
dateFormat: "yy-mm-dd", |
|
188 |
onSelect: function( selectedDate ) { |
|
189 |
$( "#id_end_date" ).datepicker( "option", "minDate", selectedDate ); |
|
190 |
} |
|
191 |
}); |
|
192 |
|
|
193 |
$( "#id_end_date" ).datepicker({ |
|
194 |
defaultDate: "+3w", |
|
195 |
dateFormat: "yy-mm-dd", |
|
196 |
onSelect: function( selectedDate ) { |
|
197 |
$( "#id_start_date" ).datepicker( "option", "maxDate", selectedDate ); |
|
198 |
} |
|
199 |
}); |
|
200 |
}); |
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
$('table .more-info').click(function(e){ |
|
205 |
e.preventDefault(); |
|
206 |
$(this).toggleClass('open'); |
|
207 |
if ($(this).hasClass('open')){ |
|
208 |
$(this).html('- less info ') |
|
209 |
} else { |
|
210 |
$(this).html('+ more info ') |
|
211 |
} |
|
212 |
$(this).parents('tr').next('tr').toggle(); |
|
213 |
|
|
214 |
}); |
|
215 |
|
|
216 |
$('.projects .details .edit').click( function(e){ |
|
217 |
e.preventDefault(); |
|
218 |
$(this).parents('.details').children('.data').hide(); |
|
219 |
$(this).parents('.details').children('.editable').slideDown(500, 'linear'); |
|
220 |
$(this).hide(); |
|
221 |
}); |
|
222 |
|
|
223 |
$('.editable .form-row').each(function() { |
|
224 |
if ( $(this).hasClass('with-errors') ){ |
|
225 |
$('.editable').show(); |
|
226 |
$('.projects .details a.edit, .projects .details .data').hide(); |
|
227 |
|
|
228 |
} |
|
229 |
}); |
|
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
|
235 |
$("input.leave, input.join").click(function (e) { |
|
236 |
e.preventDefault(); |
|
237 |
var form = $(this).parents('form'); |
|
238 |
var dialog = $(this).parents('.msg-wrap').find('.dialog'); |
|
239 |
|
|
240 |
$('.dialog').hide(); |
|
241 |
if ($(this).parents('.form-actions').hasClass('inactive')) { |
|
242 |
return false; |
|
243 |
} |
|
244 |
$(this).parents('.msg-wrap').find('.dialog').show(); |
|
245 |
var offset = dialog.offset(); |
|
246 |
|
|
247 |
if (offset.left <= 10) { |
|
248 |
dialog.css({'left': '10px'}) |
|
249 |
} |
|
250 |
if (offset.top <= 10) { |
|
251 |
dialog.css({'top': '10px'}) |
|
252 |
} |
|
253 |
|
|
254 |
if (dialog.find('textarea').length > 0) { |
|
255 |
dialog.find('textarea').val(''); |
|
256 |
dialog.find('textarea').focus(); |
|
257 |
} |
|
258 |
|
|
259 |
return false; |
|
260 |
|
|
261 |
}); |
|
262 |
|
|
263 |
$('.msg-wrap .no').click( function(e){ |
|
264 |
e.preventDefault(); |
|
265 |
$(this).parents('.dialog').hide(); |
|
266 |
}) |
|
267 |
|
|
268 |
$('.msg-wrap .yes').click( function(e){ |
|
269 |
e.preventDefault(); |
|
270 |
var dialog = $(this).parents('.msg-wrap').find('.dialog'); |
|
271 |
var form = $(this).parents('.msg-wrap').find('form'); |
|
272 |
var fields = dialog.find('input, textarea') |
|
273 |
|
|
274 |
var toremove = []; |
|
275 |
fields.each(function(){ |
|
276 |
var f = $(this).clone(); |
|
277 |
f.hide(); |
|
278 |
form.append(f); |
|
279 |
f.val($(this).val()); |
|
280 |
toremove.push(f); |
|
281 |
}); |
|
282 |
|
|
283 |
form.submit(); |
|
284 |
}) |
|
285 |
|
|
286 |
$('.hidden-submit input[readonly!="True"]').focus(function () { |
|
287 |
$('.hidden-submit .form-row.submit').slideDown(500); |
|
288 |
}); |
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
|
295 |
setTimeout(function() { |
|
296 |
if ($('input#id_username').val()){ |
|
297 |
$('input#id_username').siblings('label').css('opacity','0'); |
|
298 |
}; |
|
299 |
if ($('input#id_password').val()){ |
|
300 |
$('input#id_password').siblings('label').css('opacity','0'); |
|
301 |
} |
|
302 |
}, 100); |
|
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
$('.landing-page .cms').hover( |
|
308 |
function () { |
|
309 |
el = $('.cloudbar ul.services li').first(); |
|
310 |
var offset = el.offset(); |
|
311 |
positionX = offset.left; |
|
312 |
$('#hand').css('left',positionX); |
|
313 |
$('#hand').show(); |
|
314 |
}, |
|
315 |
function () { |
|
316 |
$('#hand').hide(); |
|
317 |
|
|
318 |
}); |
|
319 |
|
|
320 |
$('.landing-page .pithos').hover( |
|
321 |
function () { |
|
322 |
el = $('.cloudbar ul.services li:nth-child(3)'); |
|
323 |
var offset = el.offset(); |
|
324 |
positionX = offset.left; |
|
325 |
left = parseInt(positionX) +20; |
|
326 |
$('#hand').css('left',left+'px'); |
|
327 |
$('#hand').show(); |
|
328 |
}, |
|
329 |
function () { |
|
330 |
$('#hand').hide(); |
|
331 |
|
|
332 |
}); |
|
333 |
|
|
334 |
$('.landing-page .cyclades').hover( |
|
335 |
function () { |
|
336 |
el = $('.cloudbar ul.services li:nth-child(2)').first(); |
|
337 |
var offset = el.offset(); |
|
338 |
positionX = offset.left; |
|
339 |
left = parseInt(positionX) +20; |
|
340 |
$('#hand').css('left',left+'px'); |
|
341 |
$('#hand').show(); |
|
342 |
}, |
|
343 |
function () { |
|
344 |
$('#hand').hide(); |
|
345 |
|
|
346 |
}); |
|
347 |
|
|
348 |
|
|
349 |
$('.landing-page .dashboard').hover( |
|
350 |
function () { |
|
351 |
el = $('.cloudbar .profile'); |
|
352 |
var offset = el.offset(); |
|
353 |
positionX = offset.left +50; |
|
354 |
$('#hand').css('left',positionX); |
|
355 |
$('#hand').show(); |
|
356 |
}, |
|
357 |
function () { |
|
358 |
$('#hand').hide(); |
|
359 |
|
|
360 |
}); |
|
361 |
|
|
362 |
$('.pagination a.disabled').click(function(e){ |
|
363 |
e.preventDefault(); |
|
364 |
}); |
|
365 |
|
|
366 |
// fix for recaptcha fields |
|
367 |
$('#okeanos_recaptcha').parents('.form-row').find('.extra-img').hide(); |
|
368 |
|
|
369 |
/* project members page js */ |
|
370 |
function check_form_actions_inactive(){ |
|
371 |
if ( $('#members-table tbody td.check input:checked').length >0 ) { |
|
372 |
$('.projects .form-actions').removeClass('inactive'); |
|
373 |
} else { |
|
374 |
$('.projects .form-actions').addClass('inactive'); |
|
375 |
} |
|
376 |
} |
|
377 |
|
|
378 |
$('#members-table td.email').click(function(e){ |
|
379 |
var that = $(this).parent('tr').find('.check').find('input[type="checkbox"]') |
|
380 |
if(that.is(":checked")){ |
|
381 |
that.removeAttr('checked'); |
|
382 |
} else { |
|
383 |
that.attr('checked', 'checked'); |
|
384 |
} |
|
385 |
check_form_actions_inactive(); |
|
386 |
|
|
387 |
}) |
|
388 |
|
|
389 |
|
|
390 |
|
|
391 |
|
|
392 |
$('#members-table tr th.check input').click(function(e){ |
|
393 |
if($(this).is(":checked")){ |
|
394 |
$('#members-table tbody td.check input').attr('checked', 'checked'); |
|
395 |
} else { |
|
396 |
$('#members-table tbody td.check input').removeAttr('checked'); |
|
397 |
} |
|
398 |
}); |
|
399 |
|
|
400 |
$('#members-table tr .check input').click(function(e){ |
|
401 |
check_form_actions_inactive() |
|
402 |
}); |
|
403 |
|
|
404 |
|
|
405 |
/* end of project members page js */ |
|
406 |
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
}); |
|
411 |
|
|
412 |
$(window).resize(function() { |
|
413 |
|
|
414 |
setContainerMinHeight('.container .wrapper'); |
|
415 |
|
|
416 |
|
|
417 |
}); |
|
1 |
function setContainerMinHeight( applicableDiv){ |
|
2 |
|
|
3 |
if ( $(applicableDiv).length > 0 ) { |
|
4 |
//var h = $('.header').height(); div.header is not found |
|
5 |
var f = $('.footer').height(); |
|
6 |
var w = $(window).height(); |
|
7 |
var pTop = parseInt (($(applicableDiv).css('padding-top').replace("px", "")) ); |
|
8 |
var pBottom = parseInt (($(applicableDiv).css('padding-bottom').replace("px", ""))); |
|
9 |
|
|
10 |
var c = w - ( f+pTop+pBottom+36);//36 is header's height. |
|
11 |
$(applicableDiv).css('min-height', c); |
|
12 |
} |
|
13 |
|
|
14 |
} |
|
15 |
|
|
16 |
function tableFixedCols(table, firstColWidth ){ |
|
17 |
ColsNum = $('table th').size(); |
|
18 |
var ColWidth = parseFloat( (100 - firstColWidth)/ColsNum ).toFixed(0); |
|
19 |
var ColWidthPercentage = ColWidth+'%'; |
|
20 |
var firstColWidthPercentage = firstColWidth+'%'; |
|
21 |
$('table th, table td').attr('width',ColWidthPercentage ); |
|
22 |
$('table tr td:first-child, table tr th:first-child').attr('width',firstColWidthPercentage ); |
|
23 |
|
|
24 |
} |
|
25 |
|
|
26 |
function addClassHover(hoverEl, applicableEl){ |
|
27 |
$(hoverEl).hover( |
|
28 |
function () { |
|
29 |
|
|
30 |
$(applicableEl).addClass('red-border') |
|
31 |
}, |
|
32 |
function () { |
|
33 |
$(applicableEl).removeClass('red-border'); |
|
34 |
|
|
35 |
}); |
|
36 |
} |
|
37 |
//equal heights |
|
38 |
|
|
39 |
(function($) { |
|
40 |
$.fn.equalHeights = function(minHeight, maxHeight) { |
|
41 |
tallest = (minHeight) ? minHeight : 0; |
|
42 |
this.each(function() { |
|
43 |
if($(this).height() > tallest) { |
|
44 |
tallest = $(this).height(); |
|
45 |
} |
|
46 |
}); |
|
47 |
if((maxHeight) && tallest > maxHeight) tallest = maxHeight; |
|
48 |
return this.each(function() { |
|
49 |
$(this).height(tallest); |
|
50 |
}); |
|
51 |
} |
|
52 |
})(jQuery); |
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
// fix for iPhone - iPad orientation bug |
|
57 |
var metas = document.getElementsByTagName('meta'); |
|
58 |
function resetViewport() { |
|
59 |
var i; |
|
60 |
if (navigator.userAgent.match(/iPhone/i)) { |
|
61 |
for (i=0; i<metas.length; i++) { |
|
62 |
if (metas[i].name == "viewport") { |
|
63 |
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0"; |
|
64 |
} |
|
65 |
} |
|
66 |
} |
|
67 |
} |
|
68 |
resetViewport(); |
|
69 |
|
|
70 |
window.onorientationchange = function() { |
|
71 |
resetViewport(); |
|
72 |
}; |
|
73 |
|
|
74 |
function gestureStart() { |
|
75 |
for (i=0; i<metas.length; i++) { |
|
76 |
if (metas[i].name == "viewport") { |
|
77 |
metas[i].content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6"; |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
if (navigator.userAgent.match(/iPhone/i)) { |
|
83 |
document.addEventListener("gesturestart", gestureStart, false); |
|
84 |
} |
|
85 |
//end of fix |
|
86 |
|
|
87 |
|
|
88 |
$(document).ready(function() { |
|
89 |
|
|
90 |
|
|
91 |
setContainerMinHeight('.container .wrapper'); |
|
92 |
//tableFixedCols('my-projects', 25); |
|
93 |
|
|
94 |
$('.show-extra').click(function(e) { |
|
95 |
e.preventDefault(); |
|
96 |
$(this).parents('.bg-wrap').find('.extra').slideToggle(600); |
|
97 |
}); |
|
98 |
$('.hide-extra').click(function(e) { |
|
99 |
e.preventDefault(); |
|
100 |
$(this).parents('.bg-wrap').find('.extra').slideUp(600); |
|
101 |
}); |
|
102 |
|
|
103 |
$('.box-more p').click(function(e) { |
|
104 |
$(this).siblings('.clearfix').toggle('slow'); |
|
105 |
$(this).parents('.box-more').toggleClass('border'); |
|
106 |
}); |
|
107 |
|
|
108 |
var fixTopMessageHeight = function() { |
|
109 |
var topMargin = parseInt($('.mainlogo img').height())+parseInt($('.top-msg').css('marginBottom')); |
|
110 |
$('.mainlogo').css('marginTop','-'+topMargin+'px'); |
|
111 |
} |
|
112 |
|
|
113 |
if ($('.mainlogo img').length > 0) { |
|
114 |
$('.mainlogo img').bind('load', fixTopMessageHeight) |
|
115 |
} else { |
|
116 |
fixTopMessageHeight(); |
|
117 |
} |
|
118 |
|
|
119 |
$('.top-msg a.close').click(function(e) { |
|
120 |
e.preventDefault(); |
|
121 |
$('.top-msg').animate({ |
|
122 |
paddingTop:'0', |
|
123 |
paddingBottom:'0', |
|
124 |
height:'0' |
|
125 |
}, 1000, function (){ |
|
126 |
$('.top-msg').removeClass('active') |
|
127 |
}); |
|
128 |
$('.mainlogo').animate({ |
|
129 |
marginTop:'0' |
|
130 |
}, 1000, function (){ |
|
131 |
//todo |
|
132 |
}); |
|
133 |
}); |
|
134 |
|
|
135 |
|
|
136 |
$('select.dropkicked').dropkick({ |
|
137 |
change: function (value, label) { |
|
138 |
$(this).parents('form').submit(); |
|
139 |
|
|
140 |
} |
|
141 |
}); |
|
142 |
|
|
143 |
$('.with-info select').attr('tabindex','1'); |
|
144 |
$('.with-info select').dropkick(); |
|
145 |
|
|
146 |
$('.top-msg .success').parents('.top-msg').addClass('success'); |
|
147 |
$('.top-msg .error').parents('.top-msg').addClass('error'); |
|
148 |
$('.top-msg .warning').parents('.top-msg').addClass('warning'); |
|
149 |
$('.top-msg .info').parents('.top-msg').addClass('info'); |
|
150 |
|
|
151 |
// clouds homepage animation |
|
152 |
$('#animation a').hover( |
|
153 |
function () { |
|
154 |
|
|
155 |
$(this).animate({ |
|
156 |
top: '+=-10' |
|
157 |
}, 600, function() { |
|
158 |
if ($(this).find('img').attr('src').indexOf("_top") == -1) { |
|
159 |
var src = $(this).find('img').attr('src').replace('.png', '_top.png') |
|
160 |
$(this).find('img').attr("src", src); |
|
161 |
} |
|
162 |
|
|
163 |
}); |
|
164 |
$(this).siblings('p').find('img').animate({ |
|
165 |
width: '60%' |
|
166 |
}, 600); |
|
167 |
}, |
|
168 |
function () { |
|
169 |
|
|
170 |
$(this).animate({top: '0'}, 600, function() { |
|
171 |
var src = $(this).find('img').attr('src').replace('_top.png', '.png') |
|
172 |
$(this).find('img').attr("src", src); |
|
173 |
}); |
|
174 |
$(this).siblings('p').find('img').animate({ |
|
175 |
width: '65%' |
|
176 |
},600); |
|
177 |
} |
|
178 |
); |
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
$(function() { |
|
184 |
$( "#id_start_date" ).datepicker({ |
|
185 |
minDate: 0, |
|
186 |
defaultDate: "+0", |
|
187 |
dateFormat: "yy-mm-dd", |
|
188 |
onSelect: function( selectedDate ) { |
|
189 |
$( "#id_end_date" ).datepicker( "option", "minDate", selectedDate ); |
|
190 |
} |
|
191 |
}); |
|
192 |
|
|
193 |
$( "#id_end_date" ).datepicker({ |
|
194 |
defaultDate: "+3w", |
|
195 |
dateFormat: "yy-mm-dd", |
|
196 |
onSelect: function( selectedDate ) { |
|
197 |
$( "#id_start_date" ).datepicker( "option", "maxDate", selectedDate ); |
|
198 |
} |
|
199 |
}); |
|
200 |
}); |
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
$('table .more-info').click(function(e){ |
|
205 |
e.preventDefault(); |
|
206 |
$(this).toggleClass('open'); |
|
207 |
if ($(this).hasClass('open')){ |
|
208 |
$(this).html('- less info ') |
|
209 |
} else { |
|
210 |
$(this).html('+ more info ') |
|
211 |
} |
|
212 |
$(this).parents('tr').next('tr').toggle(); |
|
213 |
|
|
214 |
}); |
|
215 |
|
|
216 |
$('.projects .details .edit').click( function(e){ |
|
217 |
e.preventDefault(); |
|
218 |
$(this).parents('.details').children('.data').hide(); |
|
219 |
$(this).parents('.details').children('.editable').slideDown(500, 'linear'); |
|
220 |
$(this).hide(); |
|
221 |
}); |
|
222 |
|
|
223 |
$('.editable .form-row').each(function() { |
|
224 |
if ( $(this).hasClass('with-errors') ){ |
|
225 |
$('.editable').show(); |
|
226 |
$('.projects .details a.edit, .projects .details .data').hide(); |
|
227 |
|
|
228 |
} |
|
229 |
}); |
|
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
|
235 |
$("input.leave, input.join").click(function (e) { |
|
236 |
e.preventDefault(); |
|
237 |
var form = $(this).parents('form'); |
|
238 |
var dialog = $(this).parents('.msg-wrap').find('.dialog'); |
|
239 |
|
|
240 |
$('.dialog').hide(); |
|
241 |
if ($(this).parents('.form-actions').hasClass('inactive')) { |
|
242 |
return false; |
|
243 |
} |
|
244 |
$(this).parents('.msg-wrap').find('.dialog').show(); |
|
245 |
var offset = dialog.offset(); |
|
246 |
|
|
247 |
if (offset.left <= 10) { |
|
248 |
dialog.css({'left': '10px'}) |
|
249 |
} |
|
250 |
if (offset.top <= 10) { |
|
251 |
dialog.css({'top': '10px'}) |
|
252 |
} |
|
253 |
|
|
254 |
if (dialog.find('textarea').length > 0) { |
|
255 |
dialog.find('textarea').val(''); |
|
256 |
dialog.find('textarea').focus(); |
|
257 |
} |
|
258 |
|
|
259 |
return false; |
|
260 |
|
|
261 |
}); |
|
262 |
|
|
263 |
$('.msg-wrap .no').click( function(e){ |
|
264 |
e.preventDefault(); |
|
265 |
$(this).parents('.dialog').hide(); |
|
266 |
}) |
|
267 |
|
|
268 |
$('.msg-wrap .yes').click( function(e){ |
|
269 |
e.preventDefault(); |
|
270 |
var dialog = $(this).parents('.msg-wrap').find('.dialog'); |
|
271 |
var form = $(this).parents('.msg-wrap').find('form'); |
|
272 |
var fields = dialog.find('input, textarea') |
|
273 |
|
|
274 |
var toremove = []; |
|
275 |
fields.each(function(){ |
|
276 |
var f = $(this).clone(); |
|
277 |
f.hide(); |
|
278 |
form.append(f); |
|
279 |
f.val($(this).val()); |
|
280 |
toremove.push(f); |
|
281 |
}); |
|
282 |
|
|
283 |
form.submit(); |
|
284 |
}) |
|
285 |
|
|
286 |
$('.hidden-submit input[readonly!="True"]').focus(function () { |
|
287 |
$('.hidden-submit .form-row.submit').slideDown(500); |
|
288 |
}); |
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
|
295 |
setTimeout(function() { |
|
296 |
if ($('input#id_username').val()){ |
|
297 |
$('input#id_username').siblings('label').css('opacity','0'); |
|
298 |
}; |
|
299 |
if ($('input#id_password').val()){ |
|
300 |
$('input#id_password').siblings('label').css('opacity','0'); |
|
301 |
} |
|
302 |
}, 100); |
|
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
$('.landing-page .cms').hover( |
|
308 |
function () { |
|
309 |
el = $('.cloudbar ul.services li').first(); |
|
310 |
var offset = el.offset(); |
|
311 |
positionX = offset.left; |
|
312 |
$('#hand').css('left',positionX); |
|
313 |
$('#hand').show(); |
|
314 |
}, |
|
315 |
function () { |
|
316 |
$('#hand').hide(); |
|
317 |
|
|
318 |
}); |
|
319 |
|
|
320 |
$('.landing-page .pithos').hover( |
|
321 |
function () { |
|
322 |
el = $('.cloudbar ul.services li:nth-child(3)'); |
|
323 |
var offset = el.offset(); |
|
324 |
positionX = offset.left; |
|
325 |
left = parseInt(positionX) +20; |
|
326 |
$('#hand').css('left',left+'px'); |
|
327 |
$('#hand').show(); |
|
328 |
}, |
|
329 |
function () { |
|
330 |
$('#hand').hide(); |
|
331 |
|
|
332 |
}); |
|
333 |
|
|
334 |
$('.landing-page .cyclades').hover( |
|
335 |
function () { |
|
336 |
el = $('.cloudbar ul.services li:nth-child(2)').first(); |
|
337 |
var offset = el.offset(); |
|
338 |
positionX = offset.left; |
|
339 |
left = parseInt(positionX) +20; |
|
340 |
$('#hand').css('left',left+'px'); |
|
341 |
$('#hand').show(); |
|
342 |
}, |
|
343 |
function () { |
|
344 |
$('#hand').hide(); |
|
345 |
|
|
346 |
}); |
|
347 |
|
|
348 |
|
|
349 |
$('.landing-page .dashboard').hover( |
|
350 |
function () { |
|
351 |
el = $('.cloudbar .profile'); |
|
352 |
var offset = el.offset(); |
|
353 |
positionX = offset.left +50; |
|
354 |
$('#hand').css('left',positionX); |
|
355 |
$('#hand').show(); |
|
356 |
}, |
|
357 |
function () { |
|
358 |
$('#hand').hide(); |
|
359 |
|
|
360 |
}); |
|
361 |
|
|
362 |
$('.pagination a.disabled').click(function(e){ |
|
363 |
e.preventDefault(); |
|
364 |
}); |
|
365 |
|
|
366 |
// fix for recaptcha fields |
|
367 |
$('#okeanos_recaptcha').parents('.form-row').find('.extra-img').hide(); |
|
368 |
|
|
369 |
/* project members page js */ |
|
370 |
function check_form_actions_inactive(){ |
|
371 |
if ( $('#members-table tbody td.check input:checked').length >0 ) { |
|
372 |
$('.projects .form-actions').removeClass('inactive'); |
|
373 |
} else { |
|
374 |
$('.projects .form-actions').addClass('inactive'); |
|
375 |
} |
|
376 |
} |
|
377 |
|
|
378 |
$('#members-table td.email').click(function(e){ |
|
379 |
var that = $(this).parent('tr').find('.check').find('input[type="checkbox"]') |
|
380 |
if(that.is(":checked")){ |
|
381 |
that.removeAttr('checked'); |
|
382 |
} else { |
|
383 |
that.attr('checked', 'checked'); |
|
384 |
} |
|
385 |
check_form_actions_inactive(); |
|
386 |
|
|
387 |
}) |
|
388 |
|
|
389 |
|
|
390 |
|
|
391 |
|
|
392 |
$('#members-table tr th.check input').click(function(e){ |
|
393 |
if($(this).is(":checked")){ |
|
394 |
$('#members-table tbody td.check input').attr('checked', 'checked'); |
|
395 |
} else { |
|
396 |
$('#members-table tbody td.check input').removeAttr('checked'); |
|
397 |
} |
|
398 |
}); |
|
399 |
|
|
400 |
$('#members-table tr .check input').click(function(e){ |
|
401 |
check_form_actions_inactive() |
|
402 |
}); |
|
403 |
|
|
404 |
|
|
405 |
/* end of project members page js */ |
|
406 |
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
}); |
|
411 |
|
|
412 |
$(window).resize(function() { |
|
413 |
|
|
414 |
setContainerMinHeight('.container .wrapper'); |
|
415 |
|
|
416 |
|
|
417 |
}); |
Also available in: Unified diff