/* * Copyright 2009 * AESGE - Pole Informatique * informatique@aesge.fr * www.aesge.fr * -- remote edit -- */ var $jQ = jQuery.noConflict(); var _sliding = false; var currentAnchor = null; var page = ""; var UI = new Object(); UI.btn_ready = true; var first_run = true; var all_pages = ["homepage_" , "aesge_","projets_","partenaires_","ressources_","evenements_"]; var menu_pages = ["aesge_","projets_","partenaires_","ressources_","evenements_"]; var cached_pages = new Object(); var title = $jQ("title").text() || document.title; var shared_url = "http://www.aesge.fr/v2"; var prevent_shadow_remove = false; var remote_data = null; var FormBuffer = new Object(); $jQ().ready(function(){ // source : http://css-tricks.com/learning-jquery-fading-menu-replacing-content/ fade_them_out(); // all menu items are faded out first ! /* * ANCHOR NAV * init the timer which check if the there are anchor changes each 300 ms */ setInterval("checkAnchor()", 300); $jQ(".wibiyaToolbar_wiwi_close_a").html("[close]"); }); // -- ready function fade_them_out(){ $jQ(".menu_item_ > img").css({ opacity: 0.7 }); } var process_login = function(e){ var username = $jQ("#login_in").val(); var password = $jQ("#password_in").val(); if (!valid_username(username)){ $jQ("#login_in").parent(".input_holder").addClass("input_error"); } if(password == ""){ $jQ("#password_in").parent(".input_holder").addClass("input_error"); }else{ log_user_in(username,password); } e.preventDefault(); } var close_fancy = function(e){ $jQ("#fancy_close").click(); e.preventDefault(); } function setup_ui_interactions(){ $jQ("#contacter_pan_body #pt4").click(function(e){ e.preventDefault(); var names = $jQ("#contact_name").val(), email = $jQ("#contact_email").val(), message = $jQ("#contact_message").val(); var error = false; if(!valid_email(email)){ $jQ("#-email").show(); error = true; } if(names == ""){ $jQ("#-name").show(); error = true; } if(message == ""){ $jQ("#-message").show(); error = true; } if(error){return;} // send message to server : begin_notify(); query = {q : "contact", n : names, e : email, m : message} server_request(query); alert("sending q:"+query.q+" n:"+query.n+" e:"+query.e+" m:"+query.m); }); $jQ(".close_fancy").click(close_fancy); // Currently handled by WP //$jQ("#login_form").submit(process_login); $jQ("#contact_name").click(function (){$jQ("#-name").hide();}); $jQ("#contact_email").click(function (){$jQ("#-email").hide();}); $jQ("#contact_message").click(function (){$jQ("#-message").hide();}); /*$jQ(".elastro").click(function(){ if(!$jQ(this).hasClass("_open")){ $jQ(this).addClass("_open"); $jQ(this).siblings("._body").children(".mp_blue_layer").children("._body").slideDown("slow"); }else{ $jQ(this).removeClass("_open"); $jQ(this).siblings("._body").children(".mp_blue_layer").children("._body").slideUp("slow"); } });*/ $jQ(".content_plus").click(function(){ if (!$jQ(this).siblings(".content_more").is(":visible")){ $jQ(this).siblings(".content_more").slideDown(); $jQ(this).text() == "[+]" ? $jQ(this).text("[-]") : null; $jQ(this).text() == "Lire la suite." ? $jQ(this).text("Réduire.") : null; } else { $jQ(this).siblings(".content_more").slideUp(); $jQ(this).text() == "[-]" ? $jQ(this).text("[+]") : null; $jQ(this).text() == "Réduire." ? $jQ(this).text("Lire la suite.") : null; }; }); /*$jQ(".content_lire_plus").click(function(){ if (!$jQ(this).prev().is(":visible")){ $jQ(this).siblings(".content_more").slideDown(); $jQ(this).text("Réduire"); } else { $jQ(this).siblings(".content_more").slideUp(); $jQ(this).text("Lire la suite."); }; });*/ $jQ(".elastro").click(function(){ if (!$jQ(this).next().is(":visible")){ $jQ(this).siblings(".content_more").slideDown(); } else { $jQ(this).siblings(".content_more").slideUp(); }; }); $jQ("span.email").each(function(){ var ae = $jQ(this).html().replace(/ pt /g, '.').replace(/ at /g, '@'); $jQ(this).html('' + ae + ''); $jQ(this).removeClass("email"); }); // $jQ(".accordeon>.item_>.arrow_link").click(function(){ if(!$jQ(this).hasClass("open_")){ $jQ(this).siblings(".content_").slideDown(function(){$jQ(this).addClass("open_")}); $jQ(this).parent().siblings().children(".content_").slideUp(function(){$jQ(this).removeClass("open_")}); } }); $jQ(".accordeon>.mp_item>._head").click(function(){ if(!$jQ(this).hasClass("open_")){ $jQ(this).siblings("_body").children(".mp_blue_layer").children("._body").slideDown();//function(){$jQ(this).addClass("open_")}); //$jQ(this).parent().siblings().children(".content_").slideUp(function(){$jQ(this).removeClass("open_")}); } }); // if(!$jQ("#head_presentation_aesge").children(".editor_").size() > 0){ $jQ("#head_presentation_aesge").append($jQ(".editor_")); } // $jQ(".popup_profile_pan").click(function(e){ popup_profile_pan(); }); // $jQ("#logout_btn").click(function(e){ log_user_out(); }); // $jQ(".simple_input").click(function(){ if($jQ(this).parent().hasClass("input_error")){ $jQ(this).parent().removeClass("input_error"); } }); // $jQ(".dragsharable").mouseenter(function(){ !_sliding ? draggable_add_shadow($jQ(this)) : null; }); // $jQ(".share_btn").click(function(e){ e.preventDefault(); }); /* $jQ("#fb_share").click(function(){ }); $jQ("#twitter_share").click(function(){ }); $jQ("#delicious_share").click(function(){ }); */ // strip-replace share pan content var temp = '
'; $jQ(".share_pan_holder").after(temp).remove(); // drag to share (1) : // -- drop manage ... $jQ("#targets li").droppable({ tolerance: "pointer", //show info when over target over: function() { $jQ(".dts_share", "#targets").remove(); $jQ("").addClass("dts_share").text("Partager sur " + $jQ(this).attr("id")).addClass("active").appendTo($jQ(this)).fadeIn(); }, drop: function() { var id = $jQ(this).attr("id"), baseUrl = $jQ(this).find("a").attr("href"); if (id.indexOf("twitter") != -1) { target = "/home?status=" + title + ": " + shared_url; width = 900; height = 500; } else if (id.indexOf("delicious") != -1) { target = "/save?url=" + shared_url+ "&title=" + title; width = 600; height = 550; } else if (id.indexOf("facebook") != -1) { target = "/sharer.php?u=" + shared_url+ "&t=" + title; width = 550; height = 400; } window.open(baseUrl+target,'{AESGE - Association des Étudiants Sénégalais des Grandes Écoles}','width='+width+',height='+height+',resizable=no,directories=no,menubar=no') } }); // ---- /end drag-to-share // ---- fancy $jQ("a.fancy_ajax").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn' : 600, 'zoomSpeedOut' : 500, 'easingIn' : 'easeOutBack', 'easingOut' : 'easeInBack' }); $jQ("#a_liens_utiles").fancybox({ 'frameWidth' : 600, 'frameHeight' : 500, 'hideOnContentClick': false, 'zoomSpeedIn' : 600, 'zoomSpeedOut' : 700, }); $jQ("a#lostPwd_link").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn' : 600, 'zoomSpeedOut' : 500, 'easingIn' : 'easeOutBack', 'easingOut' : 'easeInBack' }); $jQ("a#editor_link").fancybox({ 'hideOnContentClick': false, 'hideOnOverlayClick': false, 'zoomSpeedIn' : 600, 'zoomSpeedOut' : 500, 'easingIn' : 'easeOutBack', 'easingOut' : 'easeInBack', 'frameWidth' : 540, 'frameHeight' : 600 }); $jQ("a#a_aesge_sur_facebook,a#a_plaquette_09").fancybox({ 'frameWidth' : 1120, 'frameHeight' : 700 }); $jQ("a.a_user_profile").fancybox({ 'hideOnContentClick': false, 'hideOnOverlayClick': false, 'frameWidth' : 1090, 'frameHeight' : 700, 'zoomSpeedOut' : 500 }); $jQ("a#a_nous_contacter").fancybox({ 'hideOnContentClick': false, 'hideOnOverlayClick': false, 'frameWidth' : 800, 'frameHeight' : 700, 'zoomSpeedOut' : 500 }); $jQ("a#a_rejoindre").fancybox({ 'hideOnContentClick': false, 'hideOnOverlayClick': false, 'frameWidth' : 1000, 'frameHeight' : 500, 'zoomSpeedOut' : 500 }); $jQ("a#a_generateur_carte_visite").fancybox({ 'hideOnContentClick': false, 'frameWidth' : 800, 'frameHeight' : 640 }); $jQ("a#fancy_notify_link").fancybox({ 'frameWidth' : 700, 'frameHeight' : 200, 'hideOnContentClick': false, 'zoomSpeedIn' : 600, 'zoomSpeedOut' : 500, 'easingIn' : 'easeOutBack', 'easingOut' : 'easeInBack' }); // ---- fancy $jQ("#fb_connect_large_pan").fadeOut(); $jQ("#fb_connect_dbrp").mouseenter(function(){ $jQ("#fb_connect_large_pan").fadeIn(); }); $jQ("#fb_connect_dbrp").mouseleave(function(){ $jQ("#fb_connect_large_pan").fadeOut(); }); $jQ(".rp_profile_disp").mouseenter(function(){ $jQ(this).children(".profile_tooltip").fadeIn("fast"); }).mouseleave(function(){ $jQ(this).children(".profile_tooltip").fadeOut("fast"); }); // hide map ! $jQ("#map_bubble").addClass("map_hider"); // Btn Interaction // "Hover - Hover" model $jQ(".button_wrapper").mouseenter(function (e){ if(!$jQ(this).children(".bande").is(":visible")){ // .bande not visible : $jQ(".bande:visible").slideUp("normal").css("z-index",1000); $jQ(this).children(".bande").slideDown("normal").css("z-index",1010); } e.preventDefault(); }); $jQ(".button_wrapper").mouseleave(function (e){ if($jQ(this).children(".bande").is(":visible")){ // .bande not visible : $jQ(".bande:visible").slideUp("normal").css("z-index",1000); } e.preventDefault(); }); $jQ(".partner_entry").mouseenter(function(e){ // $jQ(this).children(".cover").fadeOut(); e.stopPropagation(); }); $jQ(".partner_entry").mouseleave(function(e){ // $jQ(this).children(".cover").fadeIn(); e.stopPropagation(); }); $jQ("#recuppp_icon").click(function(e){ load_project("Recup ++"); e.preventDefault(); }); $jQ("#network_icon").click(function(e){ load_project("Network !!"); e.preventDefault(); }); $jQ("#parrainage_icon").click(function(e){ load_project("Parrainage Education"); e.preventDefault(); }); $jQ("#idees_project").click(function(e){ load_idees(); }); $jQ(".gohome").click(function(e){ }); // MAPS $jQ("#show_map").click(function(e){ handle_map_display("map_link"); e.preventDefault(); e.stopPropagation(); }); $jQ("body").click(function(){ handle_map_display("body"); }); //-- maps $jQ(".featured_project_menu_link").click(function(e){ e.preventDefault(); }); } function reveal(target){ target.animate({ // width : "22.2em" }, 1500); } function get_ID(jQObj){ return jQObj.attr("id"); } function fancy_notify(html_){ $jQ("#fancy_notify_content").html(html_); $jQ("#fancy_notify_link").click(); } // anchor nav more : //Function which chek if there are anchor changes, if there are, sends the ajax petition function checkAnchor(){ // Check if it has changes if(currentAnchor != document.location.hash){ currentAnchor = document.location.hash; // if there is not anchor, the loads the default section if(currentAnchor){ // Creates the string callback. This converts the url URL/#main&id=2 in URL/?section=main&id=2 var splits = currentAnchor.substring(1).split('&'); // Get the section page= splits[0]; delete splits[0]; // Create the params string var params = splits.join('&'); }else{ // !currentAnchor query = "p=homepage"; var params = ""; page = "homepage"; } if(is_action(page)){ handle_action(page); return; } // check if the anchor requests a page if(is_page(page)){ if( ! (page in cached_pages) ){ begin_notify("Chargement en cours ..."); cached_pages[page] = ""; // mark the page as cached ! var query = "p=" + page + params; $jQ.get("page_loader.php",query, function(data){ $jQ("#"+page+"_").html(data); end_notify(); $jQ().ready(function(){setup_ui_interactions();}); toggle_page(page); }); }else{ toggle_page(page); } // and highlights the menu items ... if(is_menu_page(page)){ $jQ("#menu_"+page+"_ > img").animate({ opacity: 1 }, 600 ); // and fades others ... $jQ("#menu_"+page+"_").siblings(".menu_item_").children("img").animate({ opacity: 0.5 }, 600 ); }else{ fade_them_out(); } }// end if is page else { // neither action nor page fade_them_out(); toggle_page("404"); } } } /* Horizontal Slide *--------------------------------------- * jQ_obj neads to be abluste-positioned with left set to some value *{ * position: absolute; * left: xx; *} *---------------------------------------*/ function h_slide(jQ_obj, duration){ var _left = parseInt(jQ_obj.css('left'),10); jQ_obj.animate({ left: _left == 0 ? -jQ_obj.outerWidth() : 0 }, duration); } function handle_map_display(source){ if($jQ("#map_bubble").hasClass("map_hider") && source == "map_link"){ $jQ("#map_bubble").removeClass("map_hider"); $jQ("#map_bubble").addClass("map_shower"); $jQ("#show_map").text("Masquer GMaps"); }else{ $jQ("#map_bubble").removeClass("map_shower"); $jQ("#map_bubble").addClass("map_hider"); $jQ("#show_map").text("Voir dans GMaps"); } } function is_page(anchor){ return (jQuery.inArray(anchor+"_", all_pages)!= -1); } function is_menu_page(anchor){ return (jQuery.inArray(anchor+"_", menu_pages)!= -1); } function is_action(anchor){ // action anchor format : a_[action to do] return (anchor.length >2 && anchor.substring(0,2) == "a_"); } function handle_action(anchor){ switch(anchor){ case "a_aesge_facebook" : fade_them_out(); toggle_page("aesge_facebook"); break; deafault : break; } } function toggle_page(target_page){ $jQ("#"+ target_page+"_").slideDown("slow"); $jQ("#"+ target_page+"_").siblings(".page").slideUp("slow", function (){_sliding = false;}); } // drag to share (2) var draggable_shadower = '