| author | Nicolas Sauret <nicolas.sauret@iri.centrepompidou.fr> |
| Fri, 18 Apr 2014 14:31:58 +0200 | |
| changeset 51 | 79833eaa394a |
| parent 26 | 94f586daa623 |
| permissions | -rwxr-xr-x |
|
1
43d9dff6758a
premiers ajout front périples
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1 |
$(function(){ |
| 3 | 2 |
//CLUSTER |
| 2 | 3 |
var clusterWidth=0; |
4 |
$('.cluster li').each( function(){ clusterWidth += $(this).width() + 10; }); |
|
5 |
$('.cluster').width( clusterWidth ); |
|
6 |
var clusterVisibleWidth = $(".cluster-visible").width(); |
|
7 |
var clusterVisibleLeft = 20; |
|
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
8 |
$(".arrow-left").addClass('bute'); |
| 2 | 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)}); |
|
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
15 |
|
| 2 | 16 |
$("a.cluster-arrow").bind("click",function(e){ |
17 |
e.preventDefault(); |
|
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
18 |
$(".cluster").stop(); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
19 |
moveCluster(this, 5); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
20 |
}); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
21 |
|
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
22 |
|
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
23 |
$("a.cluster-arrow").hover( |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
24 |
function(){ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
25 |
moveCluster(this, 20); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
26 |
}, |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
27 |
function(){ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
28 |
$(".cluster").stop(); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
29 |
} |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
30 |
); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
31 |
|
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
32 |
function moveCluster(arrow, speed){ |
| 2 | 33 |
var clusterContainmentLeft = parseInt($(".cluster-containment").css("left")); |
34 |
var clusterContainmentRight = parseInt($(".cluster-containment").css("left")) + $(".cluster-containment").width(); |
|
35 |
var clusterLeft = parseInt($(".cluster").css("left")); |
|
36 |
var clusterRight = parseInt($(".cluster").css("left"))+$(".cluster").width(); |
|
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
37 |
|
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
38 |
if ($(arrow).hasClass("arrow-right")) { |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
39 |
$(".arrow-left").removeClass('bute'); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
40 |
vitesse = (clusterLeft-clusterContainmentLeft)*speed; |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
41 |
$(".cluster").animate({ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
42 |
"left":clusterContainmentLeft |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
43 |
},vitesse,'linear',function(){ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
44 |
$(arrow).addClass('bute'); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
45 |
}); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
46 |
}else{ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
47 |
$(".arrow-right").removeClass('bute'); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
48 |
vitesse = (clusterContainmentRight-clusterRight)*speed; |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
49 |
$(".cluster").animate({ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
50 |
"left":0 |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
51 |
},vitesse,'linear',function(){ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
52 |
$(arrow).addClass('bute'); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
53 |
}); |
| 2 | 54 |
} |
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
55 |
} |
| 2 | 56 |
//DRAGGABLE |
57 |
$(".cluster").draggable({ axis: "x",containment: ".cluster-containment" }); |
|
58 |
}; |
|
| 3 | 59 |
//WIDGET |
| 11 | 60 |
//HEIGHT |
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
61 |
function resizeWidgetSidebar(){ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
62 |
var contentRightHeight = $(".content-right").height(); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
63 |
var contentLeftHeight = $(".content-left").height(); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
64 |
if(contentRightHeight>contentLeftHeight){ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
65 |
$(".content-left .widget-wrap").css({ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
66 |
"height":"+="+(contentRightHeight-contentLeftHeight) |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
67 |
}); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
68 |
} |
| 11 | 69 |
} |
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
70 |
resizeWidgetSidebar(); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
71 |
|
| 3 | 72 |
//VOLET |
|
4
b00fdbef41d4
ajout du header sur pages articles
Anthony Ly <anthonyly.com@gmail.com>
parents:
3
diff
changeset
|
73 |
//Tout fermer par défaut |
|
b00fdbef41d4
ajout du header sur pages articles
Anthony Ly <anthonyly.com@gmail.com>
parents:
3
diff
changeset
|
74 |
//$("div.content-left div.widget-wrap div.widget div.widget-inner").hide().removeClass("open"); |
|
b00fdbef41d4
ajout du header sur pages articles
Anthony Ly <anthonyly.com@gmail.com>
parents:
3
diff
changeset
|
75 |
//$("div.dossier-similaire div.widget div.widget-inner").hide().removeClass("open"); |
|
b00fdbef41d4
ajout du header sur pages articles
Anthony Ly <anthonyly.com@gmail.com>
parents:
3
diff
changeset
|
76 |
|
|
b00fdbef41d4
ajout du header sur pages articles
Anthony Ly <anthonyly.com@gmail.com>
parents:
3
diff
changeset
|
77 |
$("div.content-left div.widget-wrap div.widget h3 a, div.dossier-similaire div.widget h3 a").bind("click",function(e){ |
| 2 | 78 |
e.preventDefault(); |
79 |
var widgetInner = $(this).parents("h3").siblings("div.widget-inner"); |
|
80 |
widgetInner.stop(); |
|
81 |
if ($(this).hasClass("open")) { |
|
82 |
widgetInner.slideUp(); |
|
83 |
$(this).removeClass("open"); |
|
84 |
}else{ |
|
85 |
widgetInner.slideDown(); |
|
86 |
$(this).addClass("open"); |
|
87 |
} |
|
88 |
}); |
|
| 3 | 89 |
//AFFICHAGE |
90 |
$('.widget.affichage li a').bind('click',function(e){ |
|
91 |
e.preventDefault(); |
|
92 |
if ($(this).hasClass("treemap") && !$(this).hasClass("active")) { |
|
93 |
$('.widget.affichage li a.liste').removeClass("active"); |
|
94 |
$(this).addClass('active'); |
|
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
95 |
$('#liste').hide();$('#treemap').show(); |
| 3 | 96 |
}else if($(this).hasClass("liste") && !$(this).hasClass("active")){ |
97 |
$('.widget.affichage li a.treemap').removeClass("active"); |
|
98 |
$(this).addClass('active'); |
|
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
99 |
$('#liste').show();$('#treemap').hide(); |
| 3 | 100 |
} |
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
101 |
resizeWidgetSidebar(); |
| 3 | 102 |
}); |
|
5
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
103 |
//DATE PICKER |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
104 |
$(".dateBegin").datepicker({ |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
105 |
onSelect: function( selectedDate ) { |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
106 |
$( ".dateEnd" ).datepicker( "option", "minDate", selectedDate ); |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
107 |
} |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
108 |
}); |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
109 |
$(".dateEnd").datepicker({ |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
110 |
onSelect: function( selectedDate ) { |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
111 |
$( ".dateBegin" ).datepicker( "option", "maxDate", selectedDate ); |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
112 |
} |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
113 |
}); |
| 3 | 114 |
//VOLET DOCUMENTAIRE |
| 2 | 115 |
$("div.dossier-documentaire").hide(); |
| 11 | 116 |
/* |
| 2 | 117 |
$("div.header a.dossier-button").bind("click",function(e){ |
118 |
e.preventDefault(); |
|
119 |
$("div.dossier-documentaire").stop() |
|
120 |
if($("div.dossier-documentaire").is(":visible")){ |
|
121 |
$("div.dossier-documentaire").slideUp(); |
|
122 |
}else{ |
|
123 |
$("div.dossier-documentaire").slideDown(); |
|
124 |
} |
|
125 |
}); |
|
| 11 | 126 |
*/ |
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
127 |
$(".header .dossier-button").bind("click",function(e){e.preventDefault();}); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
128 |
$(".header .dossier-button, .header .dossier-documentaire").hover( |
| 11 | 129 |
function(){ |
130 |
$("div.dossier-documentaire").stop().slideDown(); |
|
131 |
}, |
|
132 |
function(){ |
|
133 |
$("div.dossier-documentaire").stop().slideUp(); |
|
134 |
} |
|
135 |
); |
|
| 3 | 136 |
//ARTICLES |
| 2 | 137 |
$(".article-visuel-wrap").each(function(){ |
138 |
var contentHeight = $(this).parents(".article-content").height(); |
|
139 |
//$(this).height(contentHeight); |
|
140 |
}); |
|
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
141 |
$(".article-annotations a").hover( |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
142 |
function(){ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
143 |
var x = $(this).offset().left + $(this).width()/2; |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
144 |
var y = $(this).offset().top; |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
145 |
var text = $(this).attr('title'); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
146 |
showTooltip(x,y,text); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
147 |
}, |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
148 |
function(){ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
149 |
var tip = $(".tooltip"); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
150 |
tip.hide(); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
151 |
} |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
152 |
); |
| 3 | 153 |
//FRISE |
154 |
//valeurs init du slider à définir |
|
155 |
var widthFrise = $('.frise').width(); |
|
|
5
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
156 |
|
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
157 |
$( "#slider-range" ).dragslider({ |
| 3 | 158 |
range: true, |
|
5
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
159 |
rangeDrag: true, |
| 3 | 160 |
min: 0, |
161 |
max: widthFrise, |
|
| 26 | 162 |
values: [ 0, widthFrise ], |
| 3 | 163 |
slide: function( event, ui ) { |
| 9 | 164 |
if (window.streamgraph) { |
165 |
streamgraph.slidevalues(ui.values[0], ui.values[1]); |
|
166 |
} |
|
|
5
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
167 |
}, |
|
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
168 |
change: function( event, ui ){ |
| 3 | 169 |
} |
170 |
}); |
|
|
5
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
171 |
|
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
172 |
//TOOLTIP |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
173 |
function showTooltip(x,y, text) { |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
174 |
//white_arrow_long.png |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
175 |
var tip = $(".tooltip"); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
176 |
tip.show(); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
177 |
tip.css({ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
178 |
"left" : Math.floor(x - tip.outerWidth() / 2) + "px", |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
179 |
"top" : Math.floor(y - tip.outerHeight()) + "px" |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
180 |
}).text(text); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
181 |
} |
|
5
16413123bc8c
ajout date picker / avancement
Anthony Ly <anthonyly.com@gmail.com>
parents:
4
diff
changeset
|
182 |
|
|
20
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
183 |
//HOME TREEMAP |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
184 |
var lastActuBind = false; |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
185 |
$('#treemap').on('mouseover', '.actu', function(){ |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
186 |
if(this == lastActuBind) return; |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
187 |
lastActuBind = this; |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
188 |
|
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
189 |
console.log('mouseover', $(this)); |
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
190 |
|
|
c86141a8570d
maj retours / modifications
Anthony Ly <anthonyly.com@gmail.com>
parents:
11
diff
changeset
|
191 |
}); |
| 21 | 192 |
});//jQuery |