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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
| function GetId(id) {
return document.getElementById(id);
}
function change_current_tab(new_current_tab) {
// On désactive chaque onglet
for(var i = 1; i <= 8; i++) {
var tab = GetId("tab" + i);
tab.className = "";
}
// On active le bon onglet
var tab = GetId(new_current_tab);
tab.className = "active";
}
// PageLoad function
// This function is called when:
// 1. after calling $.historyInit();
// 2. after calling $.historyLoad();
// 3. after pushing "Go Back" button of a browser
function pageload(hash) {
if(hash) {
var i = hash.indexOf("-");
var part1 = "";
var part2 = "";
if(i == -1) {
hash = hash + ".php";
} else {
part1 = hash.substr(0, i);
part2 = hash.substr(i + 1, hash.length);
hash = part1 + ".php?page=" + part2;
}
if(hash.indexOf("accueil") != -1) {
change_current_tab("tab1");
ocument.title = "Elektrochoc 2009 - Accueil";
}
if(hash.indexOf("actu") != -1) {
change_current_tab("tab2");
document.title = "Elektrochoc 2009 - Actualité";
}
if(hash.indexOf("artistes") != -1) {
change_current_tab("tab3");
document.title = "Elektrochoc 2009 - Artistes";
}
if(hash.indexOf("infos") != -1) {
change_current_tab("tab4");
document.title = "Elektrochoc 2009 - Infos";
}
if(hash.indexOf("historique") != -1) {
change_current_tab("tab5");
document.title = "Elektrochoc 2009 - Historique";
}
if(hash.indexOf("liens") != -1) {
change_current_tab("tab7");
document.title = "Elektrochoc 2009 - Liens";
}
if(hash.indexOf("contact") != -1) {
change_current_tab("tab8");
document.title = "Elektrochoc 2009 - Contacts";
}
$("#content").html('<p style="text-align: center; font-weight : bold; margin-top: 30px;">Chargement... <br /><br /><img src="./template/orange/images/loading.gif"></p>');
setTimeout(function() {
$("#content").load(hash, function() {
$(".accordion h3:first").addClass("active");
$(".accordion p:not(:first)").hide();
$(".accordion h3").click(function(){
$(this).next("p").slideToggle("slow").siblings("p:visible").slideUp("slow");
$(this).toggleClass("active"); $(this).siblings("h3").removeClass("active");
});
$("#galerie2007").transition({
title: "Elektrochoc 2007",
images: [
{image: "images/2007/01.jpg", thumb: "images/2007/thumb/01.jpg", title: "01.jpg"},
{image: "images/2007/02.jpg", thumb: "images/2007/thumb/02.jpg", title: "02.jpg"},
{image: "images/2007/03.jpg", thumb: "images/2007/thumb/03.jpg", title: "03.jpg"},
{image: "images/2007/04.jpg", thumb: "images/2007/thumb/04.jpg", title: "04.jpg"},
{image: "images/2007/05.jpg", thumb: "images/2007/thumb/05.jpg", title: "05.jpg"},
{image: "images/2007/06.jpg", thumb: "images/2007/thumb/06.jpg", title: "06.jpg"},
{image: "images/2007/07.jpg", thumb: "images/2007/thumb/07.jpg", title: "07.jpg"}
],
displayCaption: false,
autoRun: true,
displayTime: 3000,
ransitionTime: 500
});
$("#galerie2008").transition({
title: "Elektrochoc 2008",
images: [
{image: "images/2008/01.jpg", thumb: "images/2008/thumb/01.jpg", title: "01.jpg"},
{image: "images/2008/02.jpg", thumb: "images/2008/thumb/02.jpg", title: "02.jpg"},
{image: "images/2008/03.jpg", thumb: "images/2008/thumb/03.jpg", title: "03.jpg"},
{image: "images/2008/04.jpg", thumb: "images/2008/thumb/04.jpg", title: "04.jpg"},
{image: "images/2008/05.jpg", thumb: "images/2008/thumb/05.jpg", title: "05.jpg"},
{image: "images/2008/06.jpg", thumb: "images/2008/thumb/06.jpg", title: "06.jpg"},
{image: "images/2008/07.jpg", thumb: "images/2008/thumb/07.jpg", title: "07.jpg"},
{image: "images/2008/08.jpg", thumb: "images/2008/thumb/08.jpg", title: "08.jpg"}
],
displayCaption: false,
autoRun: true,
displayTime: 3000,
transitionTime: 500
});
$("#map").googleMap(48.2996682, 4.072001, 15, {
controls: ["GSmallMapControl", "GMapTypeControl"],
markers: $(".geo")
});
});
}, 400);
} else {
$("#content").html('<p style="text-align: center; font-weight : bold; margin-top: 30px;">Chargement... <br /><br /><img src="./template/orange/images/loading.gif"></p>');
setTimeout(function() {
change_current_tab("tab1");
document.title = "Elektrochoc 2009 - Accueil";
$("#content").load("accueil.php");
}, 400);
}
}
$(document).ready(function(){
$.historyInit(pageload);
};
$(document).ajaxComplete(function(){
// sélection de tous les liens a ayant l'attribut rel égal à history (valeur arbitraire)
$("a[@class='history']").click(function(){
//suppression du mot cle history, pour que les liens ne soient surchargés qu'une seule fois
this.rel = this.rel.replace(/history/, '');
// mise à jour de l'ancre
var hash = this.href;
// suppression du caractère #
hash = hash.replace(/^.*#/, '');
// chargement dans l'historique et appel de pageload
$.historyLoad(hash);
// trés important : désactivation du clic du lien a
return false;
});
}); |
Partager