integration/js/main.js
changeset 20 c86141a8570d
parent 11 95df5542a1ce
child 21 c2dd00471b2d
equal deleted inserted replaced
19:81a605180745 20:c86141a8570d
     3 	var clusterWidth=0;
     3 	var clusterWidth=0;
     4 	$('.cluster li').each( function(){ clusterWidth += $(this).width() + 10; });
     4 	$('.cluster li').each( function(){ clusterWidth += $(this).width() + 10; });
     5 	$('.cluster').width( clusterWidth );
     5 	$('.cluster').width( clusterWidth );
     6 	var clusterVisibleWidth = $(".cluster-visible").width();
     6 	var clusterVisibleWidth = $(".cluster-visible").width();
     7 	var clusterVisibleLeft = 20;
     7 	var clusterVisibleLeft = 20;
       
     8 	$(".arrow-left").addClass('bute');
     8 	if (clusterWidth>clusterVisibleWidth) {
     9 	if (clusterWidth>clusterVisibleWidth) {
     9 		$(".cluster-containment").css({
    10 		$(".cluster-containment").css({
    10 			"left": -(clusterWidth-clusterVisibleWidth),
    11 			"left": -(clusterWidth-clusterVisibleWidth),
    11 			"width":clusterWidth+(clusterWidth-clusterVisibleWidth+clusterVisibleLeft)
    12 			"width":clusterWidth+(clusterWidth-clusterVisibleWidth+clusterVisibleLeft)
    12 		});
    13 		});
    13 		$(".cluster-visible").css({"left": (clusterWidth-912+clusterVisibleLeft)});
    14 		$(".cluster-visible").css({"left": (clusterWidth-912+clusterVisibleLeft)});
       
    15 		
    14 		$("a.cluster-arrow").bind("click",function(e){
    16 		$("a.cluster-arrow").bind("click",function(e){
    15 		
       
    16 			e.preventDefault();
    17 			e.preventDefault();
       
    18 			$(".cluster").stop();
       
    19 			moveCluster(this, 5);
       
    20 		});
       
    21 
       
    22 
       
    23 		$("a.cluster-arrow").hover(
       
    24 			function(){
       
    25 				moveCluster(this, 20);
       
    26 			},
       
    27 			function(){
       
    28 				$(".cluster").stop();
       
    29 			}
       
    30 		);
       
    31 
       
    32 		function moveCluster(arrow, speed){
    17 			var clusterContainmentLeft = parseInt($(".cluster-containment").css("left"));
    33 			var clusterContainmentLeft = parseInt($(".cluster-containment").css("left"));
    18 			var clusterContainmentRight = parseInt($(".cluster-containment").css("left")) + $(".cluster-containment").width();
    34 			var clusterContainmentRight = parseInt($(".cluster-containment").css("left")) + $(".cluster-containment").width();
    19 			var clusterLeft = parseInt($(".cluster").css("left"));
    35 			var clusterLeft = parseInt($(".cluster").css("left"));
    20 			var clusterRight = parseInt($(".cluster").css("left"))+$(".cluster").width();
    36 			var clusterRight = parseInt($(".cluster").css("left"))+$(".cluster").width();
    21 			if ($(this).hasClass("arrow-right")) {
    37 
    22 				if (clusterLeft-40>clusterContainmentLeft) {
    38 			if ($(arrow).hasClass("arrow-right")) {
    23 					$(".cluster").css({
    39 				$(".arrow-left").removeClass('bute');
    24 						"left":"-="+40	
    40 				vitesse = (clusterLeft-clusterContainmentLeft)*speed;
    25 					});
    41 				$(".cluster").animate({
    26 				}else{
    42 					"left":clusterContainmentLeft
    27 					$(".cluster").css({
    43 				},vitesse,'linear',function(){
    28 						"left":clusterContainmentLeft
    44 					$(arrow).addClass('bute');
    29 					});
    45 				});
    30 				}
    46 			}else{
    31 		
    47 				$(".arrow-right").removeClass('bute');
    32 			}else if($(this).hasClass("arrow-left")){
    48 				vitesse = (clusterContainmentRight-clusterRight)*speed;
    33 			
    49 				$(".cluster").animate({
    34 				if (clusterRight+40<clusterContainmentRight) {
    50 					"left":0
    35 					$(".cluster").css({
    51 				},vitesse,'linear',function(){
    36 						"left":"+="+40	
    52 					$(arrow).addClass('bute');
    37 					});
    53 				});
    38 				}else{
       
    39 					$(".cluster").css({
       
    40 						"left":0
       
    41 					});
       
    42 				}
       
    43 			}
    54 			}
    44 		});
    55 		}
    45 	
    56 
    46 		//DRAGGABLE
    57 		//DRAGGABLE
    47 		$(".cluster").draggable({ axis: "x",containment: ".cluster-containment"  });
    58 		$(".cluster").draggable({ axis: "x",containment: ".cluster-containment"  });
    48 	};
    59 	};
    49 //WIDGET
    60 //WIDGET
    50 	//HEIGHT
    61 	//HEIGHT
    51 	var contentRightHeight = $(".content-right").height();
    62 	function resizeWidgetSidebar(){
    52 	var contentLeftHeight = $(".content-left").height();
    63 		var contentRightHeight = $(".content-right").height();
    53 	if(contentRightHeight>contentLeftHeight){
    64 		var contentLeftHeight = $(".content-left").height();
    54 		$(".content-left .widget-wrap").css({
    65 		if(contentRightHeight>contentLeftHeight){
    55 			"height":"+="+(contentRightHeight-contentLeftHeight)
    66 			$(".content-left .widget-wrap").css({
    56 		});
    67 				"height":"+="+(contentRightHeight-contentLeftHeight)
       
    68 			});
       
    69 		}
    57 	}
    70 	}
       
    71 	resizeWidgetSidebar();
       
    72 
    58 	//VOLET
    73 	//VOLET
    59 	//Tout fermer par défaut
    74 	//Tout fermer par défaut
    60 	//$("div.content-left div.widget-wrap div.widget div.widget-inner").hide().removeClass("open");
    75 	//$("div.content-left div.widget-wrap div.widget div.widget-inner").hide().removeClass("open");
    61 	//$("div.dossier-similaire div.widget div.widget-inner").hide().removeClass("open");
    76 	//$("div.dossier-similaire div.widget div.widget-inner").hide().removeClass("open");
    62 
    77 
    76 	$('.widget.affichage li a').bind('click',function(e){
    91 	$('.widget.affichage li a').bind('click',function(e){
    77 		e.preventDefault();
    92 		e.preventDefault();
    78 		if ($(this).hasClass("treemap") && !$(this).hasClass("active")) {
    93 		if ($(this).hasClass("treemap") && !$(this).hasClass("active")) {
    79 			$('.widget.affichage li a.liste').removeClass("active");
    94 			$('.widget.affichage li a.liste').removeClass("active");
    80 			$(this).addClass('active');
    95 			$(this).addClass('active');
       
    96 			$('#liste').hide();$('#treemap').show();
    81 		}else if($(this).hasClass("liste") && !$(this).hasClass("active")){
    97 		}else if($(this).hasClass("liste") && !$(this).hasClass("active")){
    82 			$('.widget.affichage li a.treemap').removeClass("active");
    98 			$('.widget.affichage li a.treemap').removeClass("active");
    83 			$(this).addClass('active');
    99 			$(this).addClass('active');
    84 		}
   100 			$('#liste').show();$('#treemap').hide();
       
   101 		}
       
   102 		resizeWidgetSidebar();
    85 	});
   103 	});
    86 	//DATE PICKER
   104 	//DATE PICKER
    87 	$(".dateBegin").datepicker({
   105 	$(".dateBegin").datepicker({
    88 		onSelect: function( selectedDate ) {
   106 		onSelect: function( selectedDate ) {
    89         	$( ".dateEnd" ).datepicker( "option", "minDate", selectedDate );
   107         	$( ".dateEnd" ).datepicker( "option", "minDate", selectedDate );
   105 		}else{
   123 		}else{
   106 			$("div.dossier-documentaire").slideDown();
   124 			$("div.dossier-documentaire").slideDown();
   107 		}
   125 		}
   108 	});
   126 	});
   109 */
   127 */
   110 	$("div.header a.dossier-button").bind("click",function(e){e.preventDefault();});
   128 	$(".header .dossier-button").bind("click",function(e){e.preventDefault();});
   111 	$("div.header a.dossier-button, div.header div.dossier-documentaire").hover(
   129 	$(".header .dossier-button, .header .dossier-documentaire").hover(
   112 		function(){
   130 		function(){
   113 			$("div.dossier-documentaire").stop().slideDown();
   131 			$("div.dossier-documentaire").stop().slideDown();
   114 		},
   132 		},
   115 		function(){
   133 		function(){
   116 			$("div.dossier-documentaire").stop().slideUp();
   134 			$("div.dossier-documentaire").stop().slideUp();
   119 //ARTICLES
   137 //ARTICLES
   120 	$(".article-visuel-wrap").each(function(){
   138 	$(".article-visuel-wrap").each(function(){
   121 		var contentHeight = $(this).parents(".article-content").height();
   139 		var contentHeight = $(this).parents(".article-content").height();
   122 		//$(this).height(contentHeight);
   140 		//$(this).height(contentHeight);
   123 	});
   141 	});
       
   142 	$(".article-annotations a").hover(
       
   143 		function(){
       
   144 			var x = $(this).offset().left + $(this).width()/2;
       
   145 			var y = $(this).offset().top;
       
   146 			var text = $(this).attr('title');
       
   147 			showTooltip(x,y,text);
       
   148 		},
       
   149 		function(){
       
   150 			var tip = $(".tooltip");
       
   151 			tip.hide();
       
   152 		}
       
   153 	);
   124 //FRISE
   154 //FRISE
   125 	//valeurs init du slider à définir
   155 	//valeurs init du slider à définir
   126 	var valSlider1 = 75;
   156 	var valSlider1 = 75;
   127 	var valSlider2 = 300;
   157 	var valSlider2 = 300;
   128 	var diffSlide = valSlider2-valSlider1;
   158 	var diffSlide = valSlider2-valSlider1;
   144 			var value1 = ui.values[ 0 ];
   174 			var value1 = ui.values[ 0 ];
   145 			var value2 = ui.values[ 1 ];
   175 			var value2 = ui.values[ 1 ];
   146 		}
   176 		}
   147 	});
   177 	});
   148 
   178 
   149 
   179 //TOOLTIP
   150 	
   180 	function showTooltip(x,y, text) {
       
   181 		//white_arrow_long.png
       
   182 		var tip = $(".tooltip");
       
   183 		tip.show();
       
   184 	    tip.css({
       
   185 	        "left" : Math.floor(x - tip.outerWidth() / 2) + "px",
       
   186 	        "top" : Math.floor(y - tip.outerHeight()) + "px"
       
   187 	    }).text(text);
       
   188 	}
       
   189 
       
   190 //HOME TREEMAP
       
   191 	var lastActuBind = false;
       
   192 	$('#treemap').on('mouseover', '.actu', function(){
       
   193 		if(this == lastActuBind) return;
       
   194 		lastActuBind = this;
       
   195 
       
   196 		console.log('mouseover', $(this));
       
   197 
       
   198 	});
       
   199 
       
   200 
   151 });//jQuery
   201 });//jQuery