-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
120 lines (107 loc) · 2.55 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
$(document).ready( function() {
// year
$("span[name='myAge']").html(getAge());
var userLang = navigator.language || navigator.userLanguage;
if(userLang == "fr" || userLang == "en")
showLanguage(userLang);
else
showLanguage("en");
//lang change
$("#langChooser,#flagLangChooser").click(function(){
var currentLang = $('#currentLang').val();
if(currentLang == "en")
showLanguage("fr");
else
showLanguage("en");
});
// Logo
var $logo = $('#logo');
if (location.href.indexOf("#") != -1) {
if(location.href.substr(location.href.indexOf("#"))!='#about'){
$logo.show();
}
}
// Show logo
$('#tab-container .tab a').click(function() {
$logo.slideDown('slow');
});
// Hide logo
$('#tab-about').click(function() {
$logo.slideUp('slow');
});
function animMeter(){
$(".meter > span").each(function() {
$(this)
.data("origWidth", $(this).width())
.width(0)
.animate({
width: $(this).data("origWidth")
}, 1200);
});
}
animMeter();
$('#tab-container').easytabs({
animate : true,
updateHash : true,
transitionIn : 'slideDown',
transitionOut : 'slideUp',
animationSpeed : 600,
tabActiveClass : 'active'}).bind('easytabs:midTransition', function(event, $clicked, $targetPanel){
if($targetPanel.selector=='#resume'){
animMeter();
}
});
});
/**
* Display text in current language
*/
function showLanguage(lang){
$("*[lang]").hide();
$("*[lang='"+lang+"']").show();
$('#currentLang').val(lang);
}
/**
* Fonction qui calcul mon age courant
* @return mon age
*/
function getAge(){
actu=new Date();
var moisNaiss='07';
var jourNaiss='01';
var anneeNaiss='1988';
if((actu.getMonth()+1)>=moisNaiss){
if((actu.getMonth()+1)==moisNaiss){
if(actu.getDate()>=jourNaiss){
mois=(actu.getMonth()+1)-moisNaiss;
ans=actu.getFullYear()-anneeNaiss;
}
else
{
mois=(12-moisNaiss)+(actu.getMonth()+1);
ans=actu.getFullYear()-anneeNaiss-1;
}
}
else
{
mois=(actu.getMonth()+1)-moisNaiss;
ans=actu.getFullYear()-anneeNaiss;
}
}
else{
mois=(12-moisNaiss)+(actu.getMonth()+1);
ans=actu.getFullYear()-anneeNaiss-1;
}
if(actu.getDate()>jourNaiss)
jours=actu.getDate()-jourNaiss;
else
jours=(30-jourNaiss)+(actu.getDate());
while(jours>30){
jours-=30;
mois+=1;
}
while(mois>12){
mois-=12;
ans+=1;
}
return ans;
}