function Editor_AjaxConnector(page, params, contentHandler, errorHandler) { var request = typeof(XMLHttpRequest) != "undefined" ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); var url = page + "?" + params.join("&"); request.open("GET", url, true); request.onreadystatechange = function() { if (request.readyState == 4) { var code = request.status; if (code != 200) { //errorHandler(code, page); //return; } // end if contentHandler(request.responseText); } // end if } // end function request.send(null); } // end function function editor_ajaxError(code, message) { alert("Probleme de communication avec le serveur : " + code + " - " + message); } // end function function checkFormContact(t,a,e){var i={lang:a,contact:e},s=!0;return $(t).find("input").each(function(){"check"==$(this).attr("rel")&&(""!=$(this).val()&&$(this).val()!=$(this).attr("alt")||(s=!1)),"text"==$(this).attr("type")&&$(this).attr("id").toLowerCase().search("mail")>-1&&!isEmail(this)&&(s=!1),"submit"!=$(this).attr("type")&&"button"!=$(this).attr("type")&&(i[$(this).attr("id")]=$(this).val()!=$(this).attr("alt")?$(this).val():"")}),$(t).find("textarea").each(function(){"check"==$(this).attr("rel")&&""==$(this).val()&&(s=!1),i[$(this).attr("id")]=$(this).val()}),s?$.ajax({type:"POST",data:i,url:domain+"sys/php/sendContactMail.php",success:function(a){"ok"==a?(alert("Votre e-mail a été envoyé. Merci de nous avoir contacté."),$(t).find("input").each(function(){"submit"!=$(this).attr("type")&&$(this).val("")}),$(t).find("textarea").each(function(){$(this).val("")})):alert("Votre e-mail n'a pas pu être envoyé. Nous vous prions de recommencer ultérieurement.")}}):alert("Veuillez remplir tous les champs."),!1}function setFieldValue(t,a){""==a?$(t).val()==$(t).attr("alt")&&($(t).val(""),$(t).removeClass("field-inactive")):""==$(t).val()&&($(t).val($(t).attr("alt")),$(t).addClass("field-inactive"))}function isEmail(t){var a=!0;return null==new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i).exec($(t).val())&&(a=!1),a} /* ---------------------------------------------- Class Diaporama Créé Par Julien Cousseau pour Egami Creation Modifiée le 20 octobre 2014 Elle permet de zoomer les photos et de les passer en mode diaporama -----------------------------------------------*/ var Diaporama = function(_target, _galery){ var $current = $(_target).attr('src') !== undefined ? _target : $(_target).find('img').eq(0); var $this = this; var $mask; var $container; var $photo; var $title; var $galery = _galery; // objet HTML qui contient toutes les photos du diapo var $max_percent_size = 85; // taille maximale en pourcentage par rapport à la taille de la fenêtre /* création du masque noir et du container ----------------------------------------------*/ $this.init = function(){ // création du mask $mask = $('
'); $mask.click($this.close); $('body').append($mask); // création du container de la photo $container = $('
'); $container.css("display", "none"); $container.css("opacity", 0); $('body').append($container); // création de l'objet img $photo = $('') $photo.click($this.close); $container.append($photo); // création de la zone de texte $title = $('

'); $container.append($title); // création de la nav si plusieurs photos if(typeof($galery) !== "undefined" && $($galery).find("img").length > 1){ $this.nav(); } // end if } // end function init /* création de la navigation ----------------------------------------------*/ $this.nav = function(){ var nav = $('
précédentsuivant
'); $container.append(nav); // action des boutons $('.photozoom-transition-buttons #photozoom-button-next-photo').click($this.nextPhoto); $('.photozoom-transition-buttons #photozoom-button-prev-photo').click($this.prevPhoto); } // end function nav /* initialisation de la photo à afficher ----------------------------------------------*/ $this.initPhoto = function(){ $.ajax({ type: "GET", url: domain+"sys/php/getImageSize.php", data: {url: $($current).attr('src').substr(0, domain.length) == domain ? $($current).attr('src').substr(domain.length) : $($current).attr('src'), type_url:$($current).attr('src').substr(0, domain.length) == domain ? "relative" : "absolute"}, success: function(_data){ // tailles originales var default_size = _data.split(";"); // calcule des nouvelles tailles var size = $this.resize(default_size); // affichage de la photo $this.display(size); } // end success }); // end ajax } // end function initPhoto /* calcule de la taille de la nouvelle photo ----------------------------------------------*/ $this.resize = function(_size){ var default_height = Number(_size[1]); var default_width = Number(_size[0]); var screen_height = $(window).height(); var screen_width = $(window).width(); var mode = "paysage"; var height = 0; var width = 0; // mode d'affichage if(default_height > default_width){ mode = "portrait"; } // end if // calcule des tailles if(mode == "portrait"){ height = $this.setSize(default_height, screen_height); width = Math.round(default_width*(height/default_height)); // on vérifie que la largeur calculée n'est pas plus grande que la taille de l'écran if(width > Math.round(screen_width*$max_percent_size/100)){ width = $this.setSize(width, screen_width); height = Math.round(default_height*(width/default_width)); } // end if }else{ width = $this.setSize(default_width, screen_width); height = Math.round(default_height*(width/default_width)); // on vérifie que la largeur calculée n'est pas plus grande que la taille de l'écran if(height > Math.round(screen_height*$max_percent_size/100)){ height = $this.setSize(height, screen_height); width = Math.round(default_width*(height/default_height)); } // end if } // end if return [width, height]; } // end function resize /* redimentionne une dimension hauteur ou largeur ----------------------------------------------*/ $this.setSize = function(_default, _max){ var size = 0; if(_default > Math.round(_max*$max_percent_size/100)){ size = Math.round(_max*$max_percent_size/100); }else{ size = _default; } // end if return size; } // end function setSize /* affichage de la photo ----------------------------------------------*/ $this.display = function(_size){ // création de la photo $photo.attr('src', $($current).attr('src')); $photo.attr('width', _size[0]); // positionnement du container au centre de l'écran $container.css("top", ($(window).height()-Number(_size[1]))/2+"px"); $container.css("left", ($(window).width()-$container.outerWidth())/2+"px"); // affichage du container $container.css("display", "block"); $container.stop().animate({opacity: 1}, 250); // affichage du titre $title.html($($current).attr('title') != undefined ? $($current).attr('title') : ""); } // end function display /* passage à la photo suivante ----------------------------------------------*/ $this.nextPhoto = function(){ for(var i = 0; i < $($galery).find('img').length; i++){ if($($galery).find('img').eq(i).attr('src') == $($current).attr('src')){ $current = i+1 < $($galery).find('img').length ? $($galery).find('img').eq(i+1) : $($galery).find('img').eq(0); $this.initPhoto(); break; } // end if } // end for i } // end function nextPhoto /* passage à la photo précédente ----------------------------------------------*/ $this.prevPhoto = function(){ for(var i = 0; i < $($galery).find('img').length; i++){ if($($galery).find('img').eq(i).attr('src') == $($current).attr('src')){ $current = i-1 >= 0 ? $($galery).find('img').eq(i-1) : $($galery).find('img').eq($($galery).find('img').length-1); $this.initPhoto(); break; } // end if } // end for i } // end function prevPhoto /* fermeture du diapo ----------------------------------------------*/ $this.close = function(){ $container.remove(); $mask.remove(); } // end function close /* lancement de la classe ----------------------------------------------*/ $this.init(); $this.initPhoto(); } // end class Diaporama /* Ancienne fonction ----------------------------------------------*/ function photoZoom(url, transition, _galery_url, type, position, total, id_project, id_block, title){ // do nothing } // end function