|
37
|
1 |
|
|
27
|
2 |
$(function(){ |
|
|
3 |
//CLUSTER |
|
|
4 |
var clusterWidth=0; |
|
|
5 |
$('.cluster li').each( function(){ clusterWidth += $(this).width() + 10; }); |
|
|
6 |
$('.cluster').width( clusterWidth ); |
|
|
7 |
var clusterVisibleWidth = $(".cluster-visible").width(); |
|
|
8 |
var clusterVisibleLeft = 20; |
|
|
9 |
if (clusterWidth>clusterVisibleWidth) { |
|
|
10 |
$(".cluster-containment").css({ |
|
|
11 |
"left": -(clusterWidth-clusterVisibleWidth), |
|
|
12 |
"width":clusterWidth+(clusterWidth-clusterVisibleWidth+clusterVisibleLeft) |
|
|
13 |
}); |
|
|
14 |
$(".cluster-visible").css({"left": (clusterWidth-912+clusterVisibleLeft)}); |
|
|
15 |
$("a.cluster-arrow").bind("click",function(e){ |
|
|
16 |
|
|
|
17 |
e.preventDefault(); |
|
|
18 |
var clusterContainmentLeft = parseInt($(".cluster-containment").css("left")); |
|
|
19 |
var clusterContainmentRight = parseInt($(".cluster-containment").css("left")) + $(".cluster-containment").width(); |
|
|
20 |
var clusterLeft = parseInt($(".cluster").css("left")); |
|
|
21 |
var clusterRight = parseInt($(".cluster").css("left"))+$(".cluster").width(); |
|
|
22 |
if ($(this).hasClass("arrow-right")) { |
|
|
23 |
if (clusterLeft-40>clusterContainmentLeft) { |
|
|
24 |
$(".cluster").css({ |
|
|
25 |
"left":"-="+40 |
|
|
26 |
}); |
|
|
27 |
}else{ |
|
|
28 |
$(".cluster").css({ |
|
|
29 |
"left":clusterContainmentLeft |
|
|
30 |
}); |
|
|
31 |
} |
|
|
32 |
|
|
|
33 |
}else if($(this).hasClass("arrow-left")){ |
|
|
34 |
|
|
|
35 |
if (clusterRight+40<clusterContainmentRight) { |
|
|
36 |
$(".cluster").css({ |
|
|
37 |
"left":"+="+40 |
|
|
38 |
}); |
|
|
39 |
}else{ |
|
|
40 |
$(".cluster").css({ |
|
|
41 |
"left":0 |
|
|
42 |
}); |
|
|
43 |
} |
|
|
44 |
} |
|
|
45 |
}); |
|
|
46 |
|
|
|
47 |
//DRAGGABLE |
|
|
48 |
$(".cluster").draggable({ axis: "x",containment: ".cluster-containment" }); |
|
|
49 |
}; |
|
|
50 |
//WIDGET |
|
|
51 |
//HEIGHT |
|
|
52 |
var contentRightHeight = $(".content-right").height(); |
|
|
53 |
var contentLeftHeight = $(".content-left").height(); |
|
|
54 |
if(contentRightHeight>contentLeftHeight){ |
|
|
55 |
$(".content-left .widget-wrap").css({ |
|
|
56 |
"height":"+="+(contentRightHeight-contentLeftHeight) |
|
|
57 |
}); |
|
|
58 |
} |
|
|
59 |
//VOLET |
|
|
60 |
//Tout fermer par défaut |
|
|
61 |
//$("div.content-left div.widget-wrap div.widget div.widget-inner").hide().removeClass("open"); |
|
|
62 |
//$("div.dossier-similaire div.widget div.widget-inner").hide().removeClass("open"); |
|
|
63 |
|
|
|
64 |
$("div.content-left div.widget-wrap div.widget h3 a, div.dossier-similaire div.widget h3 a").bind("click",function(e){ |
|
|
65 |
e.preventDefault(); |
|
|
66 |
var widgetInner = $(this).parents("h3").siblings("div.widget-inner"); |
|
|
67 |
widgetInner.stop(); |
|
|
68 |
if ($(this).hasClass("open")) { |
|
|
69 |
widgetInner.slideUp(); |
|
|
70 |
$(this).removeClass("open"); |
|
|
71 |
}else{ |
|
|
72 |
widgetInner.slideDown(); |
|
|
73 |
$(this).addClass("open"); |
|
|
74 |
} |
|
|
75 |
}); |
|
|
76 |
//AFFICHAGE |
|
37
|
77 |
$('.widget.affichage li a').bind('click',function(e) |
|
|
78 |
{ |
|
27
|
79 |
e.preventDefault(); |
|
|
80 |
if ($(this).hasClass("treemap") && !$(this).hasClass("active")) { |
|
37
|
81 |
|
|
27
|
82 |
$('.widget.affichage li a.liste').removeClass("active"); |
|
|
83 |
$(this).addClass('active'); |
|
37
|
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 |
|
|
27
|
109 |
$('.widget.affichage li a.treemap').removeClass("active"); |
|
|
110 |
$(this).addClass('active'); |
|
37
|
111 |
$('#liste').show(); |
|
|
112 |
$('#treemap').hide(); |
|
|
113 |
|
|
27
|
114 |
} |
|
37
|
115 |
//resizeWidgetSidebar(); |
|
27
|
116 |
}); |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
//DATE PICKER |
|
|
120 |
$(".dateBegin").datepicker({ |
|
|
121 |
minDate: new Date(2007, 7 - 1, 01), |
|
|
122 |
maxDate: new Date(2012,12 - 1 , 31), |
|
|
123 |
onSelect: function(selectedDate) { |
|
|
124 |
$("#pickeddatebegin").val(selectedDate); |
|
37
|
125 |
$("#ajaxfiltretreemap").submit(); |
|
27
|
126 |
$( "#pickeddateend" ).datepicker( "option", "minDate", selectedDate ); |
|
|
127 |
} |
|
|
128 |
}); |
|
|
129 |
$(".dateEnd").datepicker({ |
|
|
130 |
minDate: new Date(2007, 7 - 1, 01), |
|
|
131 |
maxDate: new Date(2012, 12 - 1, 31), |
|
|
132 |
onSelect: function( selectedDate ) { |
|
|
133 |
$("#pickeddateend").val(selectedDate); |
|
37
|
134 |
$("#ajaxfiltretreemap").submit(); |
|
27
|
135 |
$( "#pickeddatebegin" ).datepicker( "option", "maxDate", selectedDate ); |
|
|
136 |
} |
|
|
137 |
}); |
|
|
138 |
//VOLET DOCUMENTAIRE |
|
|
139 |
$("div.dossier-documentaire").hide(); |
|
|
140 |
/* |
|
|
141 |
$("div.header a.dossier-button").bind("click",function(e){ |
|
|
142 |
e.preventDefault(); |
|
|
143 |
$("div.dossier-documentaire").stop() |
|
|
144 |
if($("div.dossier-documentaire").is(":visible")){ |
|
|
145 |
$("div.dossier-documentaire").slideUp(); |
|
|
146 |
}else{ |
|
|
147 |
$("div.dossier-documentaire").slideDown(); |
|
|
148 |
} |
|
|
149 |
}); |
|
|
150 |
*/ |
|
|
151 |
//$("div.header p.dossier-button").bind("click",function(){alert('tutu';}); |
|
|
152 |
$("div.header p.dossier-button, div.header div.dossier-documentaire").hover( |
|
|
153 |
function(){ |
|
|
154 |
$("div.dossier-documentaire").stop().slideDown(); |
|
|
155 |
}, |
|
|
156 |
function(){ |
|
|
157 |
$("div.dossier-documentaire").stop().slideUp(); |
|
|
158 |
} |
|
|
159 |
); |
|
|
160 |
|
|
|
161 |
//ARTICLES |
|
|
162 |
$(".article-visuel-wrap").each(function(){ |
|
|
163 |
var contentHeight = $(this).parents(".article-content").height(); |
|
|
164 |
//$(this).height(contentHeight); |
|
|
165 |
}); |
|
|
166 |
//FRISE |
|
|
167 |
//valeurs init du slider à définir |
|
|
168 |
var valSlider1 = 75; |
|
|
169 |
var valSlider2 = 300; |
|
|
170 |
var diffSlide = valSlider2-valSlider1; |
|
|
171 |
var widthFrise = $('.frise').width(); |
|
|
172 |
|
|
|
173 |
$( "#slider-range" ).dragslider({ |
|
|
174 |
range: true, |
|
|
175 |
rangeDrag: true, |
|
|
176 |
min: 0, |
|
|
177 |
max: widthFrise, |
|
|
178 |
values: [ valSlider1, valSlider2 ], |
|
|
179 |
slide: function( event, ui ) { |
|
|
180 |
if (window.streamgraph) { |
|
|
181 |
streamgraph.slidevalues(ui.values[0], ui.values[1]); |
|
|
182 |
} |
|
|
183 |
}, |
|
|
184 |
change: function( event, ui ){ |
|
|
185 |
//ici on récup les valeurs après un slide |
|
|
186 |
var value1 = ui.values[ 0 ]; |
|
|
187 |
var value2 = ui.values[ 1 ]; |
|
|
188 |
} |
|
|
189 |
}); |
|
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
});//jQuery |