[6983] | 1 | |
---|
[7008] | 2 | //==== remplace $(... avec jQuery( ==== |
---|
| 3 | var ov_map; |
---|
| 4 | var d1 = 0; |
---|
| 5 | var init_tb = 0; |
---|
| 6 | function $(element) { |
---|
| 7 | //========== test jQuery =============== |
---|
| 8 | new_element = jQuery(element); |
---|
| 9 | jq = new_element.selector; |
---|
| 10 | |
---|
| 11 | afq = jQuery(document).data("initialized") ; //2 |
---|
| 12 | if (element == window && afq != 1) |
---|
| 13 | if (init_tb==1) { |
---|
| 14 | init_tb = 2; |
---|
| 15 | return new_element; |
---|
| 16 | } |
---|
[6983] | 17 | |
---|
[7008] | 18 | if (new_element.context && afq!=1 && afq != undefined ) { |
---|
| 19 | if (init_tb != 2) init_tb = 1; |
---|
| 20 | return new_element; |
---|
| 21 | } |
---|
| 22 | if (new_element.context) |
---|
| 23 | if (new_element.context.loaded) { |
---|
| 24 | return new_element; |
---|
| 25 | } |
---|
| 26 | init_tb = 0; |
---|
| 27 | tp1 = typeof(MooTools); |
---|
| 28 | if (tp1 != "undefined") { |
---|
| 29 | if (MooTools.version=="1.2.4" || MooTools.version=="1.11") |
---|
| 30 | return jQuery(new_element).get(0); |
---|
| 31 | } |
---|
| 32 | tp1 = typeof(Prototype); |
---|
| 33 | if (tp1 == "undefined") { return jQuery(element); } |
---|
| 34 | if (Prototype.Version != '1.6.0.2') { |
---|
| 35 | return jQuery(element); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | //======== prototype.js ===================== |
---|
| 39 | if (arguments.length > 1) { |
---|
| 40 | for (var i = 0, elements = [], length = arguments.length; i < length; i++) |
---|
| 41 | elements.push($(arguments[i])); |
---|
| 42 | new_element= elements; |
---|
| 43 | } |
---|
| 44 | if (typeof(element)=="string") |
---|
| 45 | element = jQuery("#" + element).get(0); |
---|
| 46 | try { |
---|
| 47 | new_element = Element.extend(element); |
---|
| 48 | } catch (e) { |
---|
| 49 | return new_element; |
---|
| 50 | } |
---|
| 51 | //================================================== |
---|
| 52 | if (typeof (new_element) == "undefined") { |
---|
| 53 | jQuery(document).data("initialized", 1); |
---|
| 54 | return jQuery(); |
---|
| 55 | } |
---|
| 56 | return new_element; |
---|
| 57 | |
---|
| 58 | } |
---|
| 59 | |
---|
[6932] | 60 | jQuery(document).ready( |
---|
[6912] | 61 | function (jQuery) { |
---|
[7008] | 62 | |
---|
[6978] | 63 | function Marge_haute(myObj, ajoute_h) { |
---|
[7008] | 64 | Mon_obj = jQuery(myObj); |
---|
| 65 | if (Mon_obj.length == 0) return 0; |
---|
| 66 | |
---|
[6978] | 67 | if (ajoute_h) h_p = parseInt(jQuery(myObj).height()); |
---|
| 68 | else h_p = 0; |
---|
| 69 | |
---|
| 70 | if (jQuery(myObj).css("marginTop")) |
---|
| 71 | if (jQuery(myObj).css("marginTop") != "auto") h_p += parseInt(jQuery(myObj).css("marginTop")); |
---|
| 72 | if (jQuery(myObj).css("marginBottom")) |
---|
| 73 | if (jQuery(myObj).css("marginBottom") != "auto") h_p += parseInt(jQuery(myObj).css("marginBottom")); |
---|
| 74 | if (jQuery(myObj).css("paddingTop")) |
---|
| 75 | if (jQuery(myObj).css("paddingTop") != "auto") h_p += parseInt(jQuery(myObj).css("paddingTop")); |
---|
| 76 | if (parseInt(jQuery(myObj).css("paddingBottom"))) |
---|
| 77 | if (jQuery(myObj).css("paddingBottom") != "auto") h_p += parseInt(jQuery(myObj).css("paddingBottom")); |
---|
| 78 | return h_p; |
---|
| 79 | } |
---|
[6912] | 80 | //=================================================================== |
---|
| 81 | |
---|
| 82 | jQuery(window).resize(function (event, ui) { |
---|
| 83 | if (typeof (event) == 'undefined') return; |
---|
[7008] | 84 | t = event.type; |
---|
[6936] | 85 | var Type_Img = ""; |
---|
| 86 | //====== détection du type d'images ====== |
---|
[6913] | 87 | var Image = jQuery("#theImage").find("embed"); |
---|
[6936] | 88 | if (Image.length > 0) { |
---|
| 89 | Type_Img = "embed"; |
---|
[6983] | 90 | } else if (jQuery("#map").length) { |
---|
| 91 | |
---|
| 92 | Type_Img = "map"; |
---|
| 93 | |
---|
| 94 | |
---|
[6936] | 95 | } else if (jQuery("#pamoorama").length) { |
---|
[6953] | 96 | |
---|
[6936] | 97 | Type_Img = "pamoorama"; |
---|
| 98 | } else if (jQuery("#theImage").find("img").length > 0) { |
---|
| 99 | Type_Img = "img"; |
---|
| 100 | } else if (jQuery("img").length > 0) { |
---|
| 101 | Type_Img = "img_autre"; |
---|
[6913] | 102 | } else { |
---|
[6936] | 103 | return; |
---|
[6913] | 104 | } |
---|
[7008] | 105 | var winheight = jQuery(window).height(); |
---|
| 106 | var winwidth = jQuery(window).width(); |
---|
[6936] | 107 | //================================================================= |
---|
| 108 | switch (Type_Img) { |
---|
[6983] | 109 | case "map": |
---|
[7008] | 110 | |
---|
| 111 | |
---|
| 112 | jQuery("#content").height(winheight); |
---|
[6983] | 113 | var Image = jQuery("#map"); |
---|
| 114 | var TheImg = jQuery("#map").get(0); |
---|
| 115 | position = jQuery("#map").position(); |
---|
[7008] | 116 | l2 = jQuery("#the_page").position(); |
---|
| 117 | img_height = winheight - position.top - l2.top; |
---|
| 118 | img_width = winwidth - position.left - (l2.left * 2) - 5; |
---|
[6983] | 119 | |
---|
[7008] | 120 | |
---|
[6983] | 121 | break |
---|
[6936] | 122 | case "img": |
---|
| 123 | var Image = jQuery("#theImage").find("img"); |
---|
[6978] | 124 | var TheImg = jQuery("#theImg").find("img").get(0); |
---|
| 125 | if (!TheImg) |
---|
| 126 | TheImg = jQuery(Image).get(0); |
---|
[6936] | 127 | break |
---|
| 128 | case "img_autre": |
---|
| 129 | var Image = jQuery("img"); |
---|
| 130 | var TheImg = jQuery(Image).get(0); |
---|
| 131 | break |
---|
| 132 | case "embed": |
---|
| 133 | var Image = jQuery("#theImage").find("embed"); |
---|
| 134 | var TheImg = jQuery(Image).get(0); |
---|
| 135 | img_height = TheImg.clientHeight; |
---|
| 136 | img_width = TheImg.clientWidth; |
---|
| 137 | break |
---|
| 138 | case "pamoorama": |
---|
[6978] | 139 | //========================================================= |
---|
[6936] | 140 | var Images = jQuery("#pamoorama"); |
---|
| 141 | var Image = jQuery(Images).get(0); |
---|
[6932] | 142 | |
---|
[6953] | 143 | var TheImg = jQuery("#pamoorama").get(0); |
---|
| 144 | if (!TheImg) return; |
---|
[6978] | 145 | TheImg = jQuery("#pamoorama_inner"); |
---|
| 146 | if (TheImg.length < 1) return; |
---|
| 147 | |
---|
[6936] | 148 | break |
---|
| 149 | } |
---|
| 150 | |
---|
[7008] | 151 | //================================================================================== |
---|
| 152 | |
---|
[6912] | 153 | var sel0 = jQuery(TheImg).position(); |
---|
[7008] | 154 | jQuery("#theImage").css("top", sel0.top + "px") |
---|
| 155 | jQuery().relativize("#theImage"); |
---|
[6912] | 156 | if (!sel0) return; |
---|
[6978] | 157 | type_pos = jQuery(TheImg).css("position"); //static |
---|
[7008] | 158 | |
---|
| 159 | sel0.top = 0; |
---|
| 160 | sel0.top += Marge_haute("#theHeader", true); |
---|
| 161 | |
---|
| 162 | sel0.top += Marge_haute("#imageHeaderBar", true); |
---|
| 163 | if (!theme.match(RegExp("gally", "g"))) { |
---|
| 164 | sel0.top += Marge_haute("#imageToolBar", true); |
---|
| 165 | } else { |
---|
[6978] | 166 | sel0.top += Marge_haute(TheImg, false); |
---|
| 167 | } |
---|
[7008] | 168 | if (jQuery("#theImage").css("marginTop")) |
---|
| 169 | if (jQuery("#theImage").css("marginTop") != "auto") |
---|
| 170 | sel0.top += parseInt(jQuery("#theImage").css("marginTop")); |
---|
| 171 | if (jQuery("#theImage").css("paddingTop")) |
---|
| 172 | if (jQuery("#theImage").css("paddingTop") != "auto") |
---|
| 173 | sel0.top += parseInt(jQuery("#theImage").css("paddingTop")); |
---|
[6978] | 174 | |
---|
[7008] | 175 | img_top = 0; |
---|
| 176 | |
---|
| 177 | if (theme.match(RegExp("gally", "g"))) { img_top = sel0.top } |
---|
| 178 | jQuery("#theImage").css("top", img_top + "px") |
---|
| 179 | |
---|
| 180 | |
---|
[6932] | 181 | mini_width = parseInt(mini_width); |
---|
| 182 | mini_height = parseInt(mini_height); |
---|
| 183 | |
---|
[6912] | 184 | W0 = parseInt(img_width); |
---|
[6932] | 185 | if (W0 < mini_width) return; |
---|
[6912] | 186 | |
---|
| 187 | H0 = parseInt(img_height); |
---|
[6915] | 188 | if (H0 < parseInt(mini_height)) return; |
---|
[6983] | 189 | if (Type_Img != "map") |
---|
| 190 | var rapport = (W0 / H0); |
---|
| 191 | else |
---|
| 192 | var rapport = -1; |
---|
[6912] | 193 | |
---|
[6936] | 194 | //========================================================================== |
---|
[6912] | 195 | var Licence = jQuery("#theImage").find(".licencetag"); |
---|
| 196 | if (Licence.length > 0) { |
---|
| 197 | var lmt = jQuery(Licence.get(0)).height(); |
---|
[6936] | 198 | h_p = jQuery(Licence.get(0)).height(); |
---|
| 199 | jQuery(Licence.get(0)).css("position", "relative"); |
---|
| 200 | |
---|
[6912] | 201 | jQuery(Licence.get(0)).css("top", "0px"); |
---|
| 202 | |
---|
[6936] | 203 | } else { |
---|
| 204 | var lmt = 0; |
---|
[6912] | 205 | |
---|
[6936] | 206 | } |
---|
| 207 | //==== paragraphe supplèmentaire === |
---|
| 208 | if (jQuery("#theImage").find("p")) { |
---|
| 209 | h_p = 0; |
---|
| 210 | Pars = jQuery("#theImage").find("p"); |
---|
[6912] | 211 | |
---|
[6936] | 212 | for (var i = 0; i < Pars.length; i++) { |
---|
| 213 | P0 = Pars.get(i); |
---|
[6978] | 214 | h_p += Marge_haute(P0, true); |
---|
[6936] | 215 | } |
---|
| 216 | |
---|
| 217 | // n_t = (p_p.top - Image_height) + h_p; |
---|
| 218 | |
---|
| 219 | lmt += h_p; |
---|
| 220 | jQuery("#theImage").css("paddingBottom", 0 + "px"); |
---|
| 221 | } |
---|
| 222 | |
---|
| 223 | //========================================================================== |
---|
[7008] | 224 | |
---|
[6915] | 225 | var Image_height = (winheight - sel0.top) - parseInt(marge_basse) - lmt; |
---|
[6912] | 226 | var height_user = eval(user_status + "_height"); |
---|
[6978] | 227 | |
---|
[6915] | 228 | //============================================================= |
---|
[6912] | 229 | var reg1 = new RegExp("%", "g"); |
---|
| 230 | if (height_user.match(reg1)) |
---|
| 231 | Image_height = Image_height * parseInt(height_user) / 100; |
---|
| 232 | else |
---|
| 233 | Image_height = parseInt(height_user); |
---|
[6978] | 234 | |
---|
| 235 | //============================================================ |
---|
[6936] | 236 | echelle_max = parseFloat(echelle_max, '3'); |
---|
| 237 | var echelle = parseFloat(Image_height / H0, 3); |
---|
[6912] | 238 | |
---|
[6936] | 239 | if (echelle > echelle_max) { |
---|
[6912] | 240 | echelle = echelle_max; |
---|
[6936] | 241 | Image_height = parseInt(H0 * echelle); |
---|
[6912] | 242 | } |
---|
| 243 | |
---|
[6983] | 244 | if (rapport > 0) |
---|
| 245 | var Image_Width = parseInt(Image_height * rapport); |
---|
| 246 | else |
---|
| 247 | var Image_Width = parseInt(W0); |
---|
[6978] | 248 | //=============================================================== |
---|
| 249 | twidth = jQuery("#imageHeaderBar").width(); |
---|
| 250 | img_la = jQuery(TheImg).width(); //initiale |
---|
| 251 | offset = jQuery(TheImg).position(); |
---|
[6912] | 252 | |
---|
[6978] | 253 | var width_user = eval(user_status + "_width"); |
---|
[6983] | 254 | align_auto = "center"; |
---|
[6978] | 255 | if (check_auto_w == 'checked="checked"') { |
---|
| 256 | if (Type_Img != "pamoorama") { |
---|
| 257 | widthmin = (winwidth - offset.left); |
---|
[6932] | 258 | |
---|
[6978] | 259 | if (Image_Width > widthmin) { |
---|
| 260 | //============================================================= |
---|
| 261 | if (width_user.match(reg1)) |
---|
| 262 | Image_Width = Image_Width * parseInt(width_user) / 100; |
---|
| 263 | else |
---|
| 264 | Image_Width = parseInt(width_user); |
---|
| 265 | |
---|
| 266 | var echelle_w = parseFloat(winwidth / W0, 3); |
---|
| 267 | if (echelle_w > echelle_max) { |
---|
| 268 | echelle_w = echelle_max; |
---|
| 269 | Image_Width = parseInt(W0 * echelle_w); |
---|
| 270 | } |
---|
| 271 | Image_Width = parseInt(W0 * echelle_w); |
---|
[6983] | 272 | |
---|
[6978] | 273 | align_auto = "left"; |
---|
| 274 | } else { |
---|
[6983] | 275 | |
---|
[6978] | 276 | align_auto = "center"; |
---|
| 277 | } |
---|
| 278 | Image_height = parseInt(Image_Width / rapport); |
---|
| 279 | |
---|
| 280 | } |
---|
| 281 | |
---|
| 282 | |
---|
| 283 | } |
---|
| 284 | //============================================================= |
---|
| 285 | |
---|
[6953] | 286 | if (Type_Img == "pamoorama") { |
---|
[6978] | 287 | |
---|
| 288 | |
---|
| 289 | jQuery("#pamoorama").css("height", Image_height + "px"); |
---|
| 290 | jQuery("#pamoorama").css("width", twidth + "px"); |
---|
| 291 | |
---|
| 292 | jQuery("#pamoorama").height(Image_height + "px"); |
---|
| 293 | jQuery("#pamoorama").width(twidth + "px"); |
---|
| 294 | |
---|
| 295 | |
---|
| 296 | |
---|
| 297 | jQuery("#pamoorama_outter").height(Image_height + "px"); |
---|
| 298 | jQuery("#pamoorama_outter").width(twidth + "px"); |
---|
| 299 | |
---|
[6936] | 300 | jQuery("#pamoorama_outter").css("height", Image_height + "px"); |
---|
[6978] | 301 | jQuery("#pamoorama_outter").css("width", twidth + "px"); |
---|
| 302 | |
---|
[6953] | 303 | zoom = Image_height / img_height; |
---|
[6912] | 304 | |
---|
[6978] | 305 | h_frame = jQuery("#pamoorama_frame").height(); |
---|
| 306 | h_width = jQuery("#pamoorama_frame").width(); |
---|
| 307 | jQuery(TheImg).css("zoom", zoom); |
---|
[6932] | 308 | |
---|
[6953] | 309 | |
---|
| 310 | |
---|
[6936] | 311 | } else { |
---|
[7008] | 312 | |
---|
| 313 | |
---|
[6978] | 314 | if (jQuery("#theImg").css("textAlign")) |
---|
| 315 | jQuery("#theImg").css("textAlign", align_auto); |
---|
[6983] | 316 | |
---|
[6978] | 317 | jQuery(TheImg).height(Image_height + "px"); |
---|
| 318 | jQuery(TheImg).width(Image_Width + "px"); |
---|
| 319 | jQuery(TheImg).css("height", Image_height + "px"); |
---|
| 320 | jQuery(TheImg).css("width", Image_Width + "px"); |
---|
[6932] | 321 | |
---|
[6936] | 322 | } |
---|
[7008] | 323 | try { |
---|
| 324 | if (theme.match(RegExp("gally", "g"))) { |
---|
[6936] | 325 | |
---|
[7008] | 326 | m = jQuery("#theImg"); |
---|
| 327 | if (m.length > 0) initializeImageMode('resize'); |
---|
[6936] | 328 | |
---|
[7008] | 329 | |
---|
| 330 | } else if (theme.match(RegExp("luciano", "g"))) { |
---|
| 331 | jQuery("#theImage").height(Image_height ); |
---|
| 332 | } |
---|
| 333 | } catch (e) { |
---|
| 334 | |
---|
| 335 | } |
---|
| 336 | // |
---|
| 337 | |
---|
[6912] | 338 | return; |
---|
| 339 | }); |
---|
| 340 | |
---|
| 341 | //=================================================================== |
---|
[6978] | 342 | |
---|
| 343 | |
---|
[6912] | 344 | jQuery(window).resize(); |
---|
[7008] | 345 | jQuery(window).resize(); |
---|
[6912] | 346 | |
---|
[7008] | 347 | |
---|
| 348 | /* */ |
---|
| 349 | |
---|
| 350 | |
---|
| 351 | }); |
---|
[6912] | 352 | //========================================================= |
---|
[7008] | 353 | jQuery.fn.extend({ |
---|
| 354 | //----------------------------------------------------------------- |
---|
| 355 | absolutize: function(element) { |
---|
| 356 | element = jQuery(element).get(0); |
---|
| 357 | if (element.getStyle('position') == 'absolute') return; |
---|
| 358 | // Position.prepare(); // To be done manually by Scripty when it needs it. |
---|
| 359 | |
---|
| 360 | var offsets = element.positionedOffset(); |
---|
| 361 | var top = offsets[1]; |
---|
| 362 | var left = offsets[0]; |
---|
| 363 | var width = element.clientWidth; |
---|
| 364 | var height = element.clientHeight; |
---|
| 365 | |
---|
| 366 | element._originalLeft = left - parseFloat(element.style.left || 0); |
---|
| 367 | element._originalTop = top - parseFloat(element.style.top || 0); |
---|
| 368 | element._originalWidth = element.style.width; |
---|
| 369 | element._originalHeight = element.style.height; |
---|
| 370 | |
---|
| 371 | element.style.position = 'absolute'; |
---|
| 372 | element.style.top = top + 'px'; |
---|
| 373 | element.style.left = left + 'px'; |
---|
| 374 | element.style.width = width + 'px'; |
---|
| 375 | element.style.height = height + 'px'; |
---|
| 376 | return element; |
---|
| 377 | }, |
---|
| 378 | |
---|
| 379 | relativize: function(element) { |
---|
| 380 | element = jQuery(element).get(0);; |
---|
| 381 | if (jQuery(element).css('position') == 'relative') return; |
---|
| 382 | // Position.prepare(); // To be done manually by Scripty when it needs it. |
---|
| 383 | element._originalLeft = parseFloat(element.style.left || 0); |
---|
| 384 | element._originalTop = parseFloat(element.style.top || 0); |
---|
| 385 | element._originalWidth = element.style.width; |
---|
| 386 | element._originalHeight = element.style.height; |
---|
| 387 | |
---|
| 388 | element.style.position = 'relative'; |
---|
| 389 | var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); |
---|
| 390 | var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); |
---|
| 391 | |
---|
| 392 | element.style.top = top + 'px'; |
---|
| 393 | element.style.left = left + 'px'; |
---|
| 394 | // element.style.height = element._originalHeight; |
---|
| 395 | // element.style.width = element._originalWidth; |
---|
| 396 | return element; |
---|
| 397 | } |
---|
| 398 | //========================================================= |
---|
| 399 | }); // fin extend |
---|