1 function setContainerMinHeight( applicableDiv){
\r
3 if ( $(applicableDiv).length > 0 ) {
\r
4 //var h = $('.header').height(); div.header is not found
\r
5 var f = $('.footer').height();
\r
6 var w = $(window).height();
\r
7 var pTop = parseInt (($(applicableDiv).css('padding-top').replace("px", "")) );
\r
8 var pBottom = parseInt (($(applicableDiv).css('padding-bottom').replace("px", "")));
\r
10 var c = w - ( f+pTop+pBottom+36);//36 is header's height.
\r
11 $(applicableDiv).css('min-height', c);
\r
16 function tableFixedCols(table, firstColWidth ){
\r
17 ColsNum = $('table th').size();
\r
18 var ColWidth = parseFloat( (100 - firstColWidth)/ColsNum ).toFixed(0);
\r
19 var ColWidthPercentage = ColWidth+'%';
\r
20 var firstColWidthPercentage = firstColWidth+'%';
\r
21 $('table th, table td').attr('width',ColWidthPercentage );
\r
22 $('table tr td:first-child, table tr th:first-child').attr('width',firstColWidthPercentage );
\r
30 $.fn.equalHeights = function(minHeight, maxHeight) {
\r
31 tallest = (minHeight) ? minHeight : 0;
\r
32 this.each(function() {
\r
33 if($(this).height() > tallest) {
\r
34 tallest = $(this).height();
\r
37 if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
\r
38 return this.each(function() {
\r
39 $(this).height(tallest);
\r
46 // fix for iPhone - iPad orientation bug
\r
47 var metas = document.getElementsByTagName('meta');
\r
48 function resetViewport() {
\r
50 if (navigator.userAgent.match(/iPhone/i)) {
\r
51 for (i=0; i<metas.length; i++) {
\r
52 if (metas[i].name == "viewport") {
\r
53 metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
\r
60 window.onorientationchange = function() {
\r
64 function gestureStart() {
\r
65 for (i=0; i<metas.length; i++) {
\r
66 if (metas[i].name == "viewport") {
\r
67 metas[i].content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";
\r
72 if (navigator.userAgent.match(/iPhone/i)) {
\r
73 document.addEventListener("gesturestart", gestureStart, false);
\r
77 $(document).ready(function() {
\r
80 setContainerMinHeight('.container .wrapper');
\r
81 tableFixedCols('my-projects', 25);
\r
83 $('.show-extra').click(function(e) {
\r
85 $(this).parents('.bg-wrap').find('.extra').slideToggle(600);
\r
87 $('.hide-extra').click(function(e) {
\r
89 $(this).parents('.bg-wrap').find('.extra').slideUp(600);
\r
92 $('.box-more p').click(function(e) {
\r
93 $(this).siblings('.clearfix').toggle('slow');
\r
94 $(this).parents('.box-more').toggleClass('border');
\r
97 var fixTopMessageHeight = function() {
\r
98 var topMargin = parseInt($('.mainlogo img').height())+parseInt($('.top-msg').css('marginBottom'));
\r
99 $('.mainlogo').css('marginTop','-'+topMargin+'px');
\r
102 if ($('.mainlogo img').length > 0) {
\r
103 $('.mainlogo img').bind('load', fixTopMessageHeight)
\r
105 fixTopMessageHeight();
\r
108 $('.top-msg a.close').click(function(e) {
\r
109 e.preventDefault();
\r
110 $('.top-msg').animate({
\r
114 }, 1000, function (){
\r
115 $('.top-msg').removeClass('active')
\r
117 $('.mainlogo').animate({
\r
119 }, 1000, function (){
\r
125 $('select.dropkicked').dropkick({
\r
126 change: function (value, label) {
\r
127 $(this).parents('form').submit();
\r
132 $('.with-info select').attr('tabindex','1');
\r
133 $('.with-info select').dropkick();
\r
135 $('.top-msg .success').parents('.top-msg').addClass('success');
\r
136 $('.top-msg .error').parents('.top-msg').addClass('error');
\r
137 $('.top-msg .warning').parents('.top-msg').addClass('warning');
\r
138 $('.top-msg .info').parents('.top-msg').addClass('info');
\r
140 // clouds homepage animation
\r
141 $('#animation a').hover(
\r
146 }, 600, function() {
\r
147 if ($(this).find('img').attr('src').indexOf("_top") == -1) {
\r
148 var src = $(this).find('img').attr('src').replace('.png', '_top.png')
\r
149 $(this).find('img').attr("src", src);
\r
153 $(this).siblings('p').find('img').animate({
\r
159 $(this).animate({top: '0'}, 600, function() {
\r
160 var src = $(this).find('img').attr('src').replace('_top.png', '.png')
\r
161 $(this).find('img').attr("src", src);
\r
163 $(this).siblings('p').find('img').animate({
\r
173 $( "#id_start_date" ).datepicker({
\r
175 defaultDate: "+0",
\r
176 dateFormat: "yy-mm-dd",
\r
177 onSelect: function( selectedDate ) {
\r
178 $( "#id_end_date" ).datepicker( "option", "minDate", selectedDate );
\r
182 $( "#id_end_date" ).datepicker({
\r
183 defaultDate: "+3w",
\r
184 dateFormat: "yy-mm-dd",
\r
185 onSelect: function( selectedDate ) {
\r
186 $( "#id_start_date" ).datepicker( "option", "maxDate", selectedDate );
\r
192 $('table .more-info').click(function(e){
\r
194 e.preventDefault();
\r
195 $(this).toggleClass('open');
\r
196 if ($(this).hasClass('open')){
\r
197 $(this).html('- less info ')
\r
199 $(this).html('+ more info ')
\r
201 $(this).parents('tr').next('tr').toggle();
\r
205 $('.projects .details .edit').click( function(e){
\r
206 e.preventDefault();
\r
207 $(this).parents('.details').children('.data').hide();
\r
208 $(this).parents('.details').children('.editable').slideDown(500, 'linear');
\r
212 $('.editable .form-row').each(function() {
\r
213 if ( $(this).hasClass('with-errors') ){
\r
214 $('.editable').show();
\r
215 $('.projects .details a.edit, .projects .details .data').hide();
\r
221 $("input.leave, input.join").click(function () {
\r
222 $('dialog').hide();
\r
223 $(this).parents('.msg-wrap').find('.dialog').show();
\r
228 $('.msg-wrap .no').click( function(e){
\r
229 e.preventDefault();
\r
230 $(this).parents('.dialog').hide();
\r
233 $('.msg-wrap .yes').click( function(e){
\r
234 e.preventDefault();
\r
235 $(this).parents('.dialog').siblings('form').submit();
\r
238 $('.hidden-submit input[readonly!="True"]').focus(function () {
\r
239 $('.hidden-submit .form-row.submit').slideDown(500);
\r
244 $('.auth_methods').find('li>a').click(function(e){
\r
245 e.preventDefault();
\r
246 $(this).siblings('.wrap').toggle('slow');
\r
247 $(this).toggleClass('up');
\r
250 $('.auth_methods a.red').click(function(e){
\r
251 e.preventDefault();
\r
252 $(this).siblings('.dialog').show();
\r
256 $('.auth_methods .dialog .no').click( function(e){
\r
257 e.preventDefault();
\r
258 console.log($(this));
\r
259 $(this).parents('.dialog').hide();
\r
262 setTimeout(function() {
\r
263 if ($('input#id_username').val()){
\r
264 $('input#id_username').siblings('label').css('opacity','0');
\r
266 if ($('input#id_password').val()){
\r
267 $('input#id_password').siblings('label').css('opacity','0');
\r
275 $(window).resize(function() {
\r
277 setContainerMinHeight('.container .wrapper');
\r