alcatel/static/js/main.js
changeset 37 3848e1813a30
parent 27 8ca7f2cea729
equal deleted inserted replaced
36:bad0e6c60b63 37:3848e1813a30
       
     1 
     1 $(function(){
     2 $(function(){
     2 //CLUSTER
     3 //CLUSTER
     3 	var clusterWidth=0;
     4 	var clusterWidth=0;
     4 	$('.cluster li').each( function(){ clusterWidth += $(this).width() + 10; });
     5 	$('.cluster li').each( function(){ clusterWidth += $(this).width() + 10; });
     5 	$('.cluster').width( clusterWidth );
     6 	$('.cluster').width( clusterWidth );
    71 			widgetInner.slideDown();
    72 			widgetInner.slideDown();
    72 			$(this).addClass("open");
    73 			$(this).addClass("open");
    73 		}
    74 		}
    74 	});
    75 	});
    75 	//AFFICHAGE
    76 	//AFFICHAGE
    76 	$('.widget.affichage li a').bind('click',function(e){
    77 	$('.widget.affichage li a').bind('click',function(e)
       
    78 	{
    77 		e.preventDefault();
    79 		e.preventDefault();
    78 		if ($(this).hasClass("treemap") && !$(this).hasClass("active")) {
    80 		if ($(this).hasClass("treemap") && !$(this).hasClass("active")) {
       
    81 
    79 			$('.widget.affichage li a.liste').removeClass("active");
    82 			$('.widget.affichage li a.liste').removeClass("active");
    80 			$(this).addClass('active');
    83 			$(this).addClass('active');
    81 		}else if($(this).hasClass("liste") && !$(this).hasClass("active")){
    84 			$('#liste').hide();$('#treemap').show();
       
    85 			  $(".actu img").each(function() 
       
    86 				{
       
    87 					
       
    88 					var img = $(this),
       
    89 						div = $(this).parent();
       
    90 						
       
    91 					
       
    92 						var iw = $(this).width(),
       
    93 							ih = $(this).height(),
       
    94 							dw = $(this).parent().width(),
       
    95 							dh = $(this).parent().height(),
       
    96 							scale = Math.max(dw/iw, dh/ih),
       
    97 							niw = iw * scale,
       
    98 							nih = ih * scale;
       
    99 						img.css({
       
   100 							width: niw,
       
   101 							height: nih,
       
   102 							"margin-left": (dw - niw) / 2,
       
   103 							"margin-top": (dh - nih) / 3
       
   104 						});
       
   105 				});
       
   106 		}
       
   107 		else if($(this).hasClass("liste") && !$(this).hasClass("active")){
       
   108 			
    82 			$('.widget.affichage li a.treemap').removeClass("active");
   109 			$('.widget.affichage li a.treemap').removeClass("active");
    83 			$(this).addClass('active');
   110 			$(this).addClass('active');
       
   111 			$('#liste').show();
       
   112 			$('#treemap').hide();
       
   113 			
    84 		}
   114 		}
       
   115 		//resizeWidgetSidebar();		
    85 	});
   116 	});
    86 	
       
    87 	
   117 	
    88 	
   118 	
    89 	//DATE PICKER
   119 	//DATE PICKER
    90 	$(".dateBegin").datepicker({
   120 	$(".dateBegin").datepicker({
    91 		minDate: new Date(2007, 7 - 1, 01),
   121 		minDate: new Date(2007, 7 - 1, 01),
    92         maxDate: new Date(2012,12 - 1 , 31),
   122         maxDate: new Date(2012,12 - 1 , 31),
    93 		onSelect: function(selectedDate) {
   123 		onSelect: function(selectedDate) {
    94 			$("#pickeddatebegin").val(selectedDate);
   124 			$("#pickeddatebegin").val(selectedDate);
    95 			$("#ajax2").submit();
   125 			$("#ajaxfiltretreemap").submit();
    96 			$( "#pickeddateend" ).datepicker( "option", "minDate", selectedDate );
   126 			$( "#pickeddateend" ).datepicker( "option", "minDate", selectedDate );
    97         }
   127         }
    98 	});
   128 	});
    99 	$(".dateEnd").datepicker({
   129 	$(".dateEnd").datepicker({
   100 		minDate: new Date(2007, 7 - 1, 01),
   130 		minDate: new Date(2007, 7 - 1, 01),
   101         maxDate: new Date(2012, 12 - 1, 31),
   131         maxDate: new Date(2012, 12 - 1, 31),
   102 		onSelect: function( selectedDate ) {
   132 		onSelect: function( selectedDate ) {
   103 			$("#pickeddateend").val(selectedDate);
   133 			$("#pickeddateend").val(selectedDate);
   104         	$("#ajax2").submit();
   134         	$("#ajaxfiltretreemap").submit();
   105 			$( "#pickeddatebegin" ).datepicker( "option", "maxDate", selectedDate );
   135 			$( "#pickeddatebegin" ).datepicker( "option", "maxDate", selectedDate );
   106         }
   136         }
   107 	});
   137 	});
   108 //VOLET DOCUMENTAIRE
   138 //VOLET DOCUMENTAIRE
   109 	$("div.dossier-documentaire").hide();
   139 	$("div.dossier-documentaire").hide();