//==== remplace $(... avec jQuery( ==== var ov_map; var d1 = 0; var init_tb = 0; function $(element) { //========== test jQuery =============== new_element = jQuery(element); jq = new_element.selector; afq = jQuery(document).data("initialized") ; //2 if (element == window && afq != 1) if (init_tb==1) { init_tb = 2; return new_element; } if (new_element.context && afq!=1 && afq != undefined ) { if (init_tb != 2) init_tb = 1; return new_element; } if (new_element.context) if (new_element.context.loaded) { return new_element; } init_tb = 0; tp1 = typeof(MooTools); if (tp1 != "undefined") { if (MooTools.version=="1.2.4" || MooTools.version=="1.11") return jQuery(new_element).get(0); } tp1 = typeof(Prototype); if (tp1 == "undefined") { return jQuery(element); } if (Prototype.Version != '1.6.0.2') { return jQuery(element); } //======== prototype.js ===================== if (arguments.length > 1) { for (var i = 0, elements = [], length = arguments.length; i < length; i++) elements.push($(arguments[i])); new_element= elements; } if (typeof(element)=="string") element = jQuery("#" + element).get(0); try { new_element = Element.extend(element); } catch (e) { return new_element; } //================================================== if (typeof (new_element) == "undefined") { jQuery(document).data("initialized", 1); return jQuery(); } return new_element; } jQuery(document).ready( function (jQuery) { function Marge_haute(myObj, ajoute_h) { Mon_obj = jQuery(myObj); if (Mon_obj.length == 0) return 0; if (ajoute_h) h_p = parseInt(jQuery(myObj).height()); else h_p = 0; if (jQuery(myObj).css("marginTop")) if (jQuery(myObj).css("marginTop") != "auto") h_p += parseInt(jQuery(myObj).css("marginTop")); if (jQuery(myObj).css("marginBottom")) if (jQuery(myObj).css("marginBottom") != "auto") h_p += parseInt(jQuery(myObj).css("marginBottom")); if (jQuery(myObj).css("paddingTop")) if (jQuery(myObj).css("paddingTop") != "auto") h_p += parseInt(jQuery(myObj).css("paddingTop")); if (parseInt(jQuery(myObj).css("paddingBottom"))) if (jQuery(myObj).css("paddingBottom") != "auto") h_p += parseInt(jQuery(myObj).css("paddingBottom")); return h_p; } //=================================================================== jQuery(window).resize(function (event, ui) { if (typeof (event) == 'undefined') return; t = event.type; var Type_Img = ""; //====== détection du type d'images ====== var Image = jQuery("#theImage").find("embed"); if (Image.length > 0) { Type_Img = "embed"; } else if (jQuery("#map").length) { Type_Img = "map"; } else if (jQuery("#pamoorama").length) { Type_Img = "pamoorama"; } else if (jQuery("#theImage").find("img").length > 0) { Type_Img = "img"; } else if (jQuery("img").length > 0) { Type_Img = "img_autre"; } else { return; } var winheight = jQuery(window).height(); var winwidth = jQuery(window).width(); //================================================================= switch (Type_Img) { case "map": jQuery("#content").height(winheight); var Image = jQuery("#map"); var TheImg = jQuery("#map").get(0); position = jQuery("#map").position(); l2 = jQuery("#the_page").position(); img_height = winheight - position.top - l2.top; img_width = winwidth - position.left - (l2.left * 2) - 5; break case "img": var Image = jQuery("#theImage").find("img"); var TheImg = jQuery("#theImg").find("img").get(0); if (!TheImg) TheImg = jQuery(Image).get(0); break case "img_autre": var Image = jQuery("img"); var TheImg = jQuery(Image).get(0); break case "embed": var Image = jQuery("#theImage").find("embed"); var TheImg = jQuery(Image).get(0); img_height = TheImg.clientHeight; img_width = TheImg.clientWidth; break case "pamoorama": //========================================================= var Images = jQuery("#pamoorama"); var Image = jQuery(Images).get(0); var TheImg = jQuery("#pamoorama").get(0); if (!TheImg) return; TheImg = jQuery("#pamoorama_inner"); if (TheImg.length < 1) return; break } //================================================================================== var sel0 = jQuery(TheImg).position(); jQuery("#theImage").css("top", sel0.top + "px") jQuery().relativize("#theImage"); if (!sel0) return; type_pos = jQuery(TheImg).css("position"); //static sel0.top = 0; sel0.top += Marge_haute("#theHeader", true); sel0.top += Marge_haute("#imageHeaderBar", true); if (!theme.match(RegExp("gally", "g"))) { sel0.top += Marge_haute("#imageToolBar", true); } else { sel0.top += Marge_haute(TheImg, false); } if (jQuery("#theImage").css("marginTop")) if (jQuery("#theImage").css("marginTop") != "auto") sel0.top += parseInt(jQuery("#theImage").css("marginTop")); if (jQuery("#theImage").css("paddingTop")) if (jQuery("#theImage").css("paddingTop") != "auto") sel0.top += parseInt(jQuery("#theImage").css("paddingTop")); img_top = 0; if (theme.match(RegExp("gally", "g"))) { img_top = sel0.top } jQuery("#theImage").css("top", img_top + "px") mini_width = parseInt(mini_width); mini_height = parseInt(mini_height); W0 = parseInt(img_width); if (W0 < mini_width) return; H0 = parseInt(img_height); if (H0 < parseInt(mini_height)) return; if (Type_Img != "map") var rapport = (W0 / H0); else var rapport = -1; //========================================================================== var Licence = jQuery("#theImage").find(".licencetag"); if (Licence.length > 0) { var lmt = jQuery(Licence.get(0)).height(); h_p = jQuery(Licence.get(0)).height(); jQuery(Licence.get(0)).css("position", "relative"); jQuery(Licence.get(0)).css("top", "0px"); } else { var lmt = 0; } //==== paragraphe supplèmentaire === if (jQuery("#theImage").find("p")) { h_p = 0; Pars = jQuery("#theImage").find("p"); for (var i = 0; i < Pars.length; i++) { P0 = Pars.get(i); h_p += Marge_haute(P0, true); } // n_t = (p_p.top - Image_height) + h_p; lmt += h_p; jQuery("#theImage").css("paddingBottom", 0 + "px"); } //========================================================================== var Image_height = (winheight - sel0.top) - parseInt(marge_basse) - lmt; var height_user = eval(user_status + "_height"); //============================================================= var reg1 = new RegExp("%", "g"); if (height_user.match(reg1)) Image_height = Image_height * parseInt(height_user) / 100; else Image_height = parseInt(height_user); //============================================================ echelle_max = parseFloat(echelle_max, '3'); var echelle = parseFloat(Image_height / H0, 3); if (echelle > echelle_max) { echelle = echelle_max; Image_height = parseInt(H0 * echelle); } if (rapport > 0) var Image_Width = parseInt(Image_height * rapport); else var Image_Width = parseInt(W0); //=============================================================== twidth = jQuery("#imageHeaderBar").width(); img_la = jQuery(TheImg).width(); //initiale offset = jQuery(TheImg).position(); var width_user = eval(user_status + "_width"); align_auto = "center"; if (check_auto_w == 'checked="checked"') { if (Type_Img != "pamoorama") { widthmin = (winwidth - offset.left); if (Image_Width > widthmin) { //============================================================= if (width_user.match(reg1)) Image_Width = Image_Width * parseInt(width_user) / 100; else Image_Width = parseInt(width_user); var echelle_w = parseFloat(winwidth / W0, 3); if (echelle_w > echelle_max) { echelle_w = echelle_max; Image_Width = parseInt(W0 * echelle_w); } Image_Width = parseInt(W0 * echelle_w); align_auto = "left"; } else { align_auto = "center"; } Image_height = parseInt(Image_Width / rapport); } } //============================================================= if (Type_Img == "pamoorama") { jQuery("#pamoorama").css("height", Image_height + "px"); jQuery("#pamoorama").css("width", twidth + "px"); jQuery("#pamoorama").height(Image_height + "px"); jQuery("#pamoorama").width(twidth + "px"); jQuery("#pamoorama_outter").height(Image_height + "px"); jQuery("#pamoorama_outter").width(twidth + "px"); jQuery("#pamoorama_outter").css("height", Image_height + "px"); jQuery("#pamoorama_outter").css("width", twidth + "px"); zoom = Image_height / img_height; h_frame = jQuery("#pamoorama_frame").height(); h_width = jQuery("#pamoorama_frame").width(); jQuery(TheImg).css("zoom", zoom); } else { if (jQuery("#theImg").css("textAlign")) jQuery("#theImg").css("textAlign", align_auto); jQuery(TheImg).height(Image_height + "px"); jQuery(TheImg).width(Image_Width + "px"); jQuery(TheImg).css("height", Image_height + "px"); jQuery(TheImg).css("width", Image_Width + "px"); } try { if (theme.match(RegExp("gally", "g"))) { m = jQuery("#theImg"); if (m.length > 0) initializeImageMode('resize'); } else if (theme.match(RegExp("luciano", "g"))) { jQuery("#theImage").height(Image_height ); } } catch (e) { } // return; }); //=================================================================== jQuery(window).resize(); jQuery(window).resize(); /* */ }); //========================================================= jQuery.fn.extend({ //----------------------------------------------------------------- absolutize: function(element) { element = jQuery(element).get(0); if (element.getStyle('position') == 'absolute') return; // Position.prepare(); // To be done manually by Scripty when it needs it. var offsets = element.positionedOffset(); var top = offsets[1]; var left = offsets[0]; var width = element.clientWidth; var height = element.clientHeight; element._originalLeft = left - parseFloat(element.style.left || 0); element._originalTop = top - parseFloat(element.style.top || 0); element._originalWidth = element.style.width; element._originalHeight = element.style.height; element.style.position = 'absolute'; element.style.top = top + 'px'; element.style.left = left + 'px'; element.style.width = width + 'px'; element.style.height = height + 'px'; return element; }, relativize: function(element) { element = jQuery(element).get(0);; if (jQuery(element).css('position') == 'relative') return; // Position.prepare(); // To be done manually by Scripty when it needs it. element._originalLeft = parseFloat(element.style.left || 0); element._originalTop = parseFloat(element.style.top || 0); element._originalWidth = element.style.width; element._originalHeight = element.style.height; element.style.position = 'relative'; var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); element.style.top = top + 'px'; element.style.left = left + 'px'; // element.style.height = element._originalHeight; // element.style.width = element._originalWidth; return element; } //========================================================= }); // fin extend