1 | // problème avec GMaps+diaporama: |
---|
2 | // corriger gmaps_pip.class.inc.php ajouter ligne 90 if ( !isset($_GET['slideshow'])) |
---|
3 | //============================================================== |
---|
4 | jQuery.Affiche_script = { version: '2.0.0' }; |
---|
5 | /******************************************** |
---|
6 | * document ready |
---|
7 | ********************************************/ |
---|
8 | |
---|
9 | |
---|
10 | jQuery(document).ready(function (jQuery) { |
---|
11 | var Type_Img; |
---|
12 | var theImg; |
---|
13 | var Zone_image; |
---|
14 | |
---|
15 | /****************************************** |
---|
16 | * test_theme("mont,pur") ... |
---|
17 | ******************************************/ |
---|
18 | |
---|
19 | test_theme = function (param) { |
---|
20 | if (!param) return |
---|
21 | if (!options.theme) return; |
---|
22 | |
---|
23 | regx = new RegExp(param, "gi"); |
---|
24 | return (options.theme.match(regx)) |
---|
25 | |
---|
26 | } |
---|
27 | /****************************************** |
---|
28 | * Save_cookies |
---|
29 | ******************************************/ |
---|
30 | Save_cookies = function (parametres) { |
---|
31 | parametres.windowHeight = jQuery(window).height(); |
---|
32 | parametres.windowWidth = jQuery(window).width(); |
---|
33 | try { |
---|
34 | if (parametres.pictureSelType) jQuery.cookie('picture_sel_type', parametres.pictureSelType, { path: COOKIE_PATH }); |
---|
35 | if (parametres.pictureDeriv) jQuery.cookie('picture_deriv', parametres.pictureDeriv, { path: COOKIE_PATH }); |
---|
36 | if (parametres.pictureMap) jQuery.cookie('picture_map', parametres.pictureMap, { path: COOKIE_PATH }); |
---|
37 | if (parametres.imgSrc) jQuery.cookie('img_src', parametres.imgSrc, { path: COOKIE_PATH }); |
---|
38 | if (parametres.theMainImageHeight) jQuery.cookie('theMainImageHeight', parametres.theMainImageHeight, { path: COOKIE_PATH }); |
---|
39 | if (parametres.theMainImageWidth) jQuery.cookie('theMainImageWidth', parametres.theMainImageWidth, { path: COOKIE_PATH }); |
---|
40 | if (parametres.theImageHeight) jQuery.cookie('theImageHeight', parametres.theImageHeight, { path: COOKIE_PATH }); |
---|
41 | if (parametres.theImageWidth) jQuery.cookie('theImageWidth', parametres.theImageWidth, { path: COOKIE_PATH }); |
---|
42 | if (parametres.windowHeight) jQuery.cookie('windowHeight', parametres.windowHeight, { path: COOKIE_PATH }); |
---|
43 | if (parametres.windowWidth) jQuery.cookie('windowWidth', parametres.windowWidth, { path: COOKIE_PATH }); |
---|
44 | if (parametres.theImageTop) jQuery.cookie('theImageTop', parametres.theImageTop, { path: COOKIE_PATH }); |
---|
45 | if (parametres.theImageLeft) jQuery.cookie('theImageLeft', parametres.theImageLeft, { path: COOKIE_PATH }); |
---|
46 | if (parametres.theImageRight) jQuery.cookie('theImageRight', parametres.theImageRight, { path: COOKIE_PATH }); |
---|
47 | if (parametres.theImageBottom) jQuery.cookie('theImageBottom', parametres.theImageBottom, { path: COOKIE_PATH }); |
---|
48 | if (parametres.theImageMargeZone) { |
---|
49 | jQuery.cookie('theImageMargeWidth', parametres.theImageMargeZone.width, { path: COOKIE_PATH }); |
---|
50 | jQuery.cookie('theImageMargeHeight', parametres.theImageMargeZone.height, { path: COOKIE_PATH }); |
---|
51 | } |
---|
52 | } catch (e) { |
---|
53 | |
---|
54 | } |
---|
55 | |
---|
56 | |
---|
57 | } |
---|
58 | //____________________ Save_cookies _____________________________ |
---|
59 | /************************************************ |
---|
60 | * Get COOKIE |
---|
61 | *************************************************/ |
---|
62 | Get_cookies = function () { |
---|
63 | parametres = { |
---|
64 | pictureDeriv: jQuery.cookie('picture_deriv'), |
---|
65 | pictureMap: jQuery.cookie('picture_map'), |
---|
66 | imgSrc: jQuery.cookie('img_src'), |
---|
67 | pictureSelType: jQuery.cookie('picture_sel_type'), |
---|
68 | theMainImageHeight: jQuery.cookie('theMainImageHeight'), |
---|
69 | theMainImageWidth: jQuery.cookie('theMainImageWidth'), |
---|
70 | |
---|
71 | |
---|
72 | windowHeight: jQuery.cookie('windowHeight'), |
---|
73 | windowWidth: jQuery.cookie('windowWidth'), |
---|
74 | |
---|
75 | theImageHeight: jQuery.cookie('theImageHeight'), |
---|
76 | theImageWidth: jQuery.cookie('theImageWidth'), |
---|
77 | theImageTop: jQuery.cookie('theImageTop'), |
---|
78 | theImageLeft: jQuery.cookie('theImageLeft'), |
---|
79 | theImageBottom: jQuery.cookie('theImageBottom'), |
---|
80 | theImageRight: jQuery.cookie('theImageRight'), |
---|
81 | theImageMargeZone: { width: jQuery.cookie('theImageMargeWidth'), |
---|
82 | height: jQuery.cookie('theImageMargeHeight') |
---|
83 | } |
---|
84 | |
---|
85 | |
---|
86 | } |
---|
87 | return parametres; |
---|
88 | } |
---|
89 | //____________________ Get_cookies _____________________________ |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | /************************************************* |
---|
94 | * Recupère le Type d'mage |
---|
95 | *************************************************/ |
---|
96 | Get_type_img = function (e) { |
---|
97 | //====== détection du type d'images ====== |
---|
98 | |
---|
99 | if (jQuery("#charlie").length > 0) { |
---|
100 | Type_Img = "charlie"; |
---|
101 | } else if (jQuery("#Panorama").length > 0) { |
---|
102 | Type_Img = "panorama"; |
---|
103 | |
---|
104 | } else if (jQuery("#pamoorama").length > 0) { |
---|
105 | Type_Img = "pamoorama"; |
---|
106 | options.valide = true; |
---|
107 | |
---|
108 | infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true }); |
---|
109 | |
---|
110 | } else if (jQuery("#map").length > 0 || jQuery("#mapPicture").length > 0) { |
---|
111 | Type_Img = "map"; |
---|
112 | } else if (jQuery("#Panorama").length) { |
---|
113 | Type_Img = "panorama"; |
---|
114 | } else if ((jQuery("#theImage" + " iframe").length + jQuery("#theImage" + " object").length + jQuery("#theImage" + " embed").length) > 0) { |
---|
115 | |
---|
116 | if (jQuery("#theImage" + " object").length > 0) { |
---|
117 | |
---|
118 | type_src = "object"; |
---|
119 | |
---|
120 | } else if (jQuery("#theImage" + " embed").length > 0) { |
---|
121 | |
---|
122 | type_src = "embed"; |
---|
123 | |
---|
124 | } else { |
---|
125 | |
---|
126 | type_src = "iframe"; |
---|
127 | } |
---|
128 | nbf = jQuery("#theImage" + " " + type_src).length; |
---|
129 | frm1 = jQuery("#theImage" + " " + type_src).get(0); |
---|
130 | Type_Img = "iframe"; |
---|
131 | |
---|
132 | //'fb - xfbml - like - button |
---|
133 | |
---|
134 | objs = jQuery("#theImage" + " div").get(0); |
---|
135 | if (jQuery(objs).length > 0) { |
---|
136 | id_0 = jQuery(objs).attr("id"); |
---|
137 | if (id_0 == "") { |
---|
138 | jQuery(objs).attr("id", "charlie"); |
---|
139 | } else { |
---|
140 | if (nbf > 1) { |
---|
141 | jQuery(frm1).attr("id", "charlie"); |
---|
142 | } else { |
---|
143 | Type_Img = "img"; |
---|
144 | } |
---|
145 | } |
---|
146 | } else { |
---|
147 | jQuery(frm1).attr("id", "iframe"); |
---|
148 | } |
---|
149 | |
---|
150 | |
---|
151 | } else if (jQuery("#theImage").find("img").length > 0) { |
---|
152 | Type_Img = "img"; |
---|
153 | } else if (jQuery("#theImage" + "Box").find("img").length > 0) { |
---|
154 | Type_Img = "img"; |
---|
155 | Parent = Parent + "Box"; |
---|
156 | } else if (jQuery("img").length > 0) { |
---|
157 | Type_Img = "img_autre"; |
---|
158 | return; |
---|
159 | } else { |
---|
160 | return; |
---|
161 | } |
---|
162 | } |
---|
163 | //____________________ Get_type_img _____________________________ |
---|
164 | |
---|
165 | //==================================== |
---|
166 | // set_cl |
---|
167 | //==================================== |
---|
168 | set_cl = function (Valid) { |
---|
169 | if (typeof Valid == "undefined") Valid = options.pictureSelType.match(RegExp("Autosize", "gi")) || false; |
---|
170 | if (typeof options.cl_visible == "undefined") return; |
---|
171 | if (typeof src1 == "undefined") return; |
---|
172 | if (options.cl_visible) src = src1; |
---|
173 | else src = src2; |
---|
174 | |
---|
175 | if (typeof options.pictureSelType != "undefined" && (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi")) { |
---|
176 | if (options.pictureSelType == "SelMaxi") src = src6; |
---|
177 | } else { |
---|
178 | Valid = false; |
---|
179 | src = src2; |
---|
180 | jQuery("#bp_cla span").text(""); |
---|
181 | } |
---|
182 | if (options.cl_visible) { |
---|
183 | src_info = src3; |
---|
184 | src_infos_1 = src3; |
---|
185 | } else { |
---|
186 | src_info = src4; |
---|
187 | src_infos_1 = src5; |
---|
188 | } |
---|
189 | src_info = options.pictureDeriv; |
---|
190 | if (!Valid) { |
---|
191 | Zone_image.image.height = Zone_image.image_init.height; |
---|
192 | Zone_image.image.width = Zone_image.image_init.width; |
---|
193 | |
---|
194 | } |
---|
195 | if ((typeof Zone_image != "undefined") && typeof Zone_image.image != "undefined") { |
---|
196 | Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height); |
---|
197 | zoom_cl = parseInt(100 * Zone_image.zoom) + "%"; ; |
---|
198 | if (!Valid) { |
---|
199 | if (options.pictureSelType == "SelMaxi") |
---|
200 | zoom_cl = options.pictureSelType + " [" + options.pictureDeriv + "]"; |
---|
201 | else { |
---|
202 | zoom_cl = ""; |
---|
203 | src_info = options.pictureDeriv; |
---|
204 | } |
---|
205 | } |
---|
206 | jQuery('#bp_cla').attr('alt', src_info); |
---|
207 | jQuery('#bp_cla').attr('title', src_info); |
---|
208 | jQuery('#bp_cla').attr('Stitle', src_info); |
---|
209 | jQuery('#bp_cla').attr('Stip', zoom_cl); |
---|
210 | r = { width: jQuery("#theMainImage").width(), height: jQuery("#theMainImage").height(), |
---|
211 | rap: jQuery("#theMainImage").width() / jQuery("#theMainImage").height(), |
---|
212 | rap_init: Zone_image.image_init.rapport |
---|
213 | } |
---|
214 | jQuery('#bp_cla span').text(zoom_cl); |
---|
215 | color_back = jQuery('#imageToolBar').css("backgroundColor"); |
---|
216 | try { |
---|
217 | if (color_back.match(new RegExp("rgb", "gi"))) { |
---|
218 | color_back = color_back.split("(")[1].split(")")[0].split(","); |
---|
219 | color_back = "rgb(" + Math.abs(255 - color_back[0]) + "," |
---|
220 | + Math.abs(255 - color_back[1]) + "," |
---|
221 | + Math.abs(255 - color_back[2]) + ")"; |
---|
222 | } |
---|
223 | else if (color_back.match(new RegExp("#", "gi"))) |
---|
224 | color_back = Math.abs("#65536" - color_back); |
---|
225 | else |
---|
226 | color_back = jQuery('body').css("color"); |
---|
227 | jQuery('#bp_cla span').css({ color: color_back, aling: "center" }); |
---|
228 | } catch (e) { |
---|
229 | |
---|
230 | } |
---|
231 | if (options.pictureDeriv) { |
---|
232 | jQuery('.auto_details').text(" (" + Zone_image.image.width + " x " + Zone_image.image.height + ") " + options.pictureDeriv); |
---|
233 | } |
---|
234 | //=============================================== |
---|
235 | } else { |
---|
236 | src = src6; |
---|
237 | jQuery('.auto_details').text(""); |
---|
238 | |
---|
239 | } |
---|
240 | bp_scr = jQuery('#bp_img_cla'); |
---|
241 | if (bp_scr.length > 0) { |
---|
242 | src_enc = bp_scr.attr("src"); |
---|
243 | if (!src_enc.match(src)) { |
---|
244 | bp_scr.get(0).src = src; |
---|
245 | jQuery('#bp_img_cla').attr('alt', src_info); |
---|
246 | jQuery('#bp_img_cla').attr('title', src_info); |
---|
247 | } |
---|
248 | } |
---|
249 | |
---|
250 | } |
---|
251 | //____________________ set_cl _____________________________ |
---|
252 | |
---|
253 | /******************************** |
---|
254 | * Set__llbgo |
---|
255 | *********************************/ |
---|
256 | Set_llbgo = function (Force) { |
---|
257 | |
---|
258 | if (options.marges_llgbo == 0) return; |
---|
259 | if (Type_Img == "pamoorama") { |
---|
260 | |
---|
261 | } |
---|
262 | if (Force) |
---|
263 | if (typeof LlgboFr_Resize == "function") { |
---|
264 | LlgboFr_Resize(); |
---|
265 | } |
---|
266 | if (Type_Img == "pamoorama" || Type_Img == "charlie") { |
---|
267 | return; |
---|
268 | } |
---|
269 | if (!theImg) return; |
---|
270 | |
---|
271 | if (theImg.useMap) |
---|
272 | nom_map = theImg.useMap.replace("#", ""); |
---|
273 | else |
---|
274 | nom_map = "Autosize"; |
---|
275 | |
---|
276 | maps = jQuery("map[name='" + nom_map + "']"); |
---|
277 | if (maps.length == 0) return; |
---|
278 | // nom_map = maps[0].name; |
---|
279 | maps = jQuery("map[name='" + nom_map + "'] area"); |
---|
280 | nb_zone = maps.length; |
---|
281 | Largeur_zone = (Zone_image.image.width / nb_zone); |
---|
282 | Hauteur_zone = (Zone_image.image.height); |
---|
283 | init_zone = 0; |
---|
284 | j = 0; |
---|
285 | maps.each(function (e) { |
---|
286 | init_zone = Largeur_zone * j; |
---|
287 | rel = jQuery(this).attr("rel"); |
---|
288 | title = jQuery(this).attr("title"); |
---|
289 | alt = jQuery(this).attr("alt"); |
---|
290 | H = Hauteur_zone; |
---|
291 | if (rel == "up") { |
---|
292 | H = Hauteur_zone / 4; |
---|
293 | } |
---|
294 | coord = { x0: init_zone, y0: 0, x1: Math.ceil(init_zone + Largeur_zone), y1: Hauteur_zone }; |
---|
295 | jQuery(this).attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" }); |
---|
296 | j++; |
---|
297 | }); |
---|
298 | |
---|
299 | return; |
---|
300 | } |
---|
301 | //__________ Set_llbgo _______________ |
---|
302 | |
---|
303 | /******************************************** |
---|
304 | * window LOAD |
---|
305 | ********************************************/ |
---|
306 | jQuery(window).load(function () { |
---|
307 | href = location.href; |
---|
308 | var aff_ok = false; |
---|
309 | //======================================================================= |
---|
310 | infos_theImage = jQuery(theImage_id).infos({ absolute: true }); |
---|
311 | infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true }); |
---|
312 | infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general |
---|
313 | |
---|
314 | if (infos_theMainImage.width == 0) { |
---|
315 | if (Type_Img == "charlie") { |
---|
316 | infos_theMainImage = jQuery("#charlie").infos(true); |
---|
317 | theMainImage_id = "charlie"; |
---|
318 | options.valide = true; |
---|
319 | } else if (Type_Img == "iframe") { |
---|
320 | |
---|
321 | infos_theMainImage = jQuery("#iframe").infos(true); |
---|
322 | theMainImage_id = "iframe"; |
---|
323 | options.valide = true; |
---|
324 | |
---|
325 | infos_theMainImage.width = infos_theImage.general.width; |
---|
326 | infos_theMainImage.height = infos_window.height - infos_theImage.top - options.marge_basse; |
---|
327 | jQuery("#iframe").width(infos_theMainImage.width); |
---|
328 | jQuery("#iframe").height(infos_theMainImage.height); |
---|
329 | |
---|
330 | } else if (Type_Img == "pamoorama") { |
---|
331 | infos_theMainImage = jQuery("#pamoorama").infos(true); |
---|
332 | theMainImage_id = "#pamoorama"; |
---|
333 | options.valide = true; |
---|
334 | |
---|
335 | } else { |
---|
336 | |
---|
337 | jQuery("img").each(function (i) { |
---|
338 | |
---|
339 | imgSrc = options.imgSrc; |
---|
340 | n = this.src; |
---|
341 | |
---|
342 | }); |
---|
343 | infos_theMainImage = jQuery("#theImage img").infos(); |
---|
344 | |
---|
345 | } |
---|
346 | if (infos_theMainImage.id == "") |
---|
347 | jQuery("#theImage img").attr("id", "theMainImage"); |
---|
348 | infos_theMainImage = jQuery(theMainImage_id).infos(); |
---|
349 | } |
---|
350 | |
---|
351 | infos_theImage = jQuery(theImage_id).infos(true); // conteneur |
---|
352 | |
---|
353 | |
---|
354 | if (test_theme("simple")) { |
---|
355 | jQuery(theMainImage_id).css({ maxWidth: "none" }); |
---|
356 | theImageAndInfos_id = "#content"; |
---|
357 | infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general |
---|
358 | infos_theImage.height = infos_window.height - infos_theImage.top; |
---|
359 | // jQuery(theImage_id).height(infos_theImage.height); |
---|
360 | |
---|
361 | } else { |
---|
362 | infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general |
---|
363 | if (infos_theImageAndInfos.visible == false) |
---|
364 | theImageAndInfos_id = "#imageContainer"; |
---|
365 | } |
---|
366 | |
---|
367 | |
---|
368 | imageInfos_id = "#imageInfos"; |
---|
369 | |
---|
370 | content_id = "#content"; |
---|
371 | infos_content = jQuery(content_id).infos(true); // conteneur |
---|
372 | infos_theImage = jQuery(theImage_id).infos(true); // conteneur |
---|
373 | infos_imageInfos = jQuery(imageInfos_id).infos(true); // information |
---|
374 | infos_theMainImage = jQuery(theMainImage_id).infos(true); // Image |
---|
375 | infos_copyright = jQuery("#copyright").infos(true); |
---|
376 | |
---|
377 | |
---|
378 | if (infos_theImage.top > infos_window.height) { |
---|
379 | zheight = infos_window.height - infos_content.top; |
---|
380 | } else { |
---|
381 | zheight = infos_window.height - (infos_theImage.top); |
---|
382 | } |
---|
383 | |
---|
384 | |
---|
385 | if (options.check_desc_v) { } |
---|
386 | |
---|
387 | infos_comments = jQuery("#comments").infos(true); |
---|
388 | infos_Licence = jQuery(".licencetag").infos(true); |
---|
389 | infos_imageComment = jQuery(imageComment_id).infos(true); |
---|
390 | |
---|
391 | |
---|
392 | |
---|
393 | if (test_theme("simple")) { |
---|
394 | |
---|
395 | |
---|
396 | } else { |
---|
397 | if (test_theme("stripped")) { |
---|
398 | |
---|
399 | } else |
---|
400 | |
---|
401 | if (test_theme("blanc , pure, hr_ ")) { |
---|
402 | options.marge_gauche += 10; |
---|
403 | options.marge_droite += 10; |
---|
404 | } |
---|
405 | } |
---|
406 | |
---|
407 | |
---|
408 | Zone_image = { image_init: { |
---|
409 | width: infos_theMainImage.width, |
---|
410 | height: infos_theMainImage.height, |
---|
411 | rapport: infos_theMainImage.width / infos_theMainImage.height |
---|
412 | }, |
---|
413 | image: { |
---|
414 | width: infos_theImage.general.width, |
---|
415 | height: infos_window.height - infos_theImage.top - options.marge_basse, |
---|
416 | rapport: infos_theMainImage.width / infos_theMainImage.height |
---|
417 | }, |
---|
418 | container: { |
---|
419 | width: infos_theImage.general.width, |
---|
420 | height: zheight, |
---|
421 | margesWidth: infos_window.width - infos_theImage.width |
---|
422 | }, marges: { |
---|
423 | height: 0, |
---|
424 | width: 0 |
---|
425 | } |
---|
426 | } |
---|
427 | |
---|
428 | |
---|
429 | Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height); |
---|
430 | |
---|
431 | |
---|
432 | |
---|
433 | |
---|
434 | /*********************************************************** |
---|
435 | * RESIZE (une fois document chargé) |
---|
436 | ***********************************************************/ |
---|
437 | var new_dim; |
---|
438 | jQuery(window).resize(function (event, ui) { |
---|
439 | Autosize_resize(true, options); |
---|
440 | |
---|
441 | return; |
---|
442 | |
---|
443 | |
---|
444 | |
---|
445 | }); |
---|
446 | //_____________ widow.resize _______________ |
---|
447 | |
---|
448 | type_src = "div"; |
---|
449 | old_window = { width: 0, height: 0 }; |
---|
450 | List_autosize = new Array(); |
---|
451 | nu_img = 0; |
---|
452 | tempo = 0; |
---|
453 | |
---|
454 | |
---|
455 | infos_llgbo = jQuery(llgbo_id).infos(true); |
---|
456 | infos_llgboh2 = jQuery("#llgboh2").infos(true); |
---|
457 | marges_llgbo = 0; |
---|
458 | //========================================================================================== |
---|
459 | if (options.valide) { |
---|
460 | |
---|
461 | init_gen(); |
---|
462 | |
---|
463 | |
---|
464 | } |
---|
465 | |
---|
466 | }); |
---|
467 | //__________________window.onload_________________ |
---|
468 | |
---|
469 | /******************************************** |
---|
470 | * window unLOAD |
---|
471 | ********************************************/ |
---|
472 | jQuery(window).unload(function () { |
---|
473 | // return; |
---|
474 | }); |
---|
475 | //_________ unload ___________ |
---|
476 | |
---|
477 | //=================== |
---|
478 | // VARIABLES |
---|
479 | |
---|
480 | |
---|
481 | //=================== |
---|
482 | // options |
---|
483 | //=================== |
---|
484 | |
---|
485 | //========================================================= |
---|
486 | /*messages = "This frame uses the W3C box model: <span>" + jQuery.support.boxModel + "</span>"; |
---|
487 | messages += "This frame uses the html5Clone: <span>" + jQuery.support.html5Clone + "</span>";*/ |
---|
488 | // jQuery("p").html(messages); |
---|
489 | if (typeof (options) == "undefined") { |
---|
490 | options = { imageAutosize: false } |
---|
491 | } |
---|
492 | options = jQuery.extend(Autosize_options, options); |
---|
493 | var COOKIE_PATH = options.COOKIE_PATH; |
---|
494 | var cookies = Get_cookies(); |
---|
495 | |
---|
496 | var defaults = { |
---|
497 | imageAutosizeMargin: 0, |
---|
498 | imageAutosize: false, |
---|
499 | marge_basse: options.imageAutosizeMargin || 0, |
---|
500 | DEBUG_autosize: false |
---|
501 | }; |
---|
502 | |
---|
503 | options = jQuery.extend(defaults, options); |
---|
504 | |
---|
505 | |
---|
506 | for (i = 0; i < options.liste_type.length; i++) { |
---|
507 | options.liste_type[i] = options.liste_type[i].split(","); |
---|
508 | } |
---|
509 | |
---|
510 | options.theMainImageWidth = options.theMainImageWidth; |
---|
511 | options.theMainImageHeight = options.theMainImageHeight; |
---|
512 | |
---|
513 | jQuery("#form_autosize_picture").addClass("Autosize"); |
---|
514 | //===== marges suplémentaires en fonction theme === |
---|
515 | options.valide = jQuery(".Autosize").css("display") != "none"; |
---|
516 | |
---|
517 | options.marge_haute = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("top")); |
---|
518 | options.marge_basse = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("bottom")); |
---|
519 | options.marge_gauche = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("left")); |
---|
520 | options.marge_droite = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("right")); |
---|
521 | fade_in = options.fade_in || 0; |
---|
522 | imageComment_id = ".imageComment"; |
---|
523 | if (test_theme("simple")) { |
---|
524 | jQuery("#theImage p").addClass("imageComment"); |
---|
525 | } |
---|
526 | if (test_theme("mont")) { |
---|
527 | jQuery("#content").css({ marginLeft: 'auto' }); //monblanc |
---|
528 | } |
---|
529 | |
---|
530 | DEBUG_autosize = options.DEBUG_autosize; |
---|
531 | Get_type_img(); |
---|
532 | |
---|
533 | var theMainImage_id = "#theMainImage"; |
---|
534 | var theImage_id = "#theImage"; |
---|
535 | var theImageAndInfos_id = "#theImageAndInfos"; |
---|
536 | var infos_window = jQuery(window).infos(); |
---|
537 | var infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general |
---|
538 | var infos_content; |
---|
539 | var infos_body; |
---|
540 | var infos_the_page = jQuery("#the_page").infos(true); |
---|
541 | var nopano; |
---|
542 | var llgbo_id = "#llgbo0"; |
---|
543 | var marges_llgbo = 0; |
---|
544 | |
---|
545 | var useMap = options.pictureMap; // #mapxxx |
---|
546 | var user_status = options.user_status; |
---|
547 | |
---|
548 | var pictureDeriv = options.pictureDeriv; // xxx |
---|
549 | var pictureSelType_user = eval("options." + user_status + "_type"); //limite taille |
---|
550 | if (Type_Img == "pamoorama") |
---|
551 | options.pictureSelType = "Autosize"; |
---|
552 | |
---|
553 | if (pictureSelType_user != options.pictureSelType) { |
---|
554 | if (pictureDeriv == null) |
---|
555 | pictureDeriv = pictureDeriv_user; |
---|
556 | else |
---|
557 | pictureDeriv_user = pictureDeriv; |
---|
558 | } |
---|
559 | |
---|
560 | if (!options.valide) { |
---|
561 | |
---|
562 | pictureDeriv = "medium"; |
---|
563 | pictureDeriv_user = pictureDeriv; |
---|
564 | options.pictureDeriv = pictureDeriv; |
---|
565 | } |
---|
566 | |
---|
567 | |
---|
568 | |
---|
569 | jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden'); |
---|
570 | jQuery('#derivativeChecked' + options.pictureSelType).css('visibility', 'visible'); |
---|
571 | //====================================================================================== |
---|
572 | href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "SelMaxi" + "')"; |
---|
573 | |
---|
574 | /* */ |
---|
575 | // jQuery('#derivativeCheckedSelMaxi').hide(); |
---|
576 | jQuery('#derivativeCheckedSelMaxi').next().show(); |
---|
577 | jQuery('#derivativeCheckedSelMaxi').next().next().show(); |
---|
578 | |
---|
579 | spans = jQuery("#derivativeCheckedSelMaxi").next(); |
---|
580 | spans.attr("href", href_path); |
---|
581 | spans.attr("name", "SelMaxi"); |
---|
582 | |
---|
583 | spans = spans.find("span"); |
---|
584 | spans.attr("name", "SelMaxi"); |
---|
585 | spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")"); |
---|
586 | spans = spans.find("span"); |
---|
587 | spans.text(options.pictureDeriv); |
---|
588 | //========================================================== |
---|
589 | href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "Autosize" + "')"; |
---|
590 | |
---|
591 | spans = jQuery("#derivativeCheckedAutosize").next(); |
---|
592 | spans.attr("href", href_path); |
---|
593 | spans.attr("name", "Autosize"); |
---|
594 | spans = spans.find("span"); |
---|
595 | spans.attr("name", "Autosize"); |
---|
596 | spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")"); |
---|
597 | spans.next().text(options.pictureDeriv); |
---|
598 | //========================================================== |
---|
599 | /* |
---|
600 | jQuery('#derivativeCheckedAutosize').hide(); |
---|
601 | jQuery('#derivativeCheckedAutosize').next().hide(); |
---|
602 | jQuery('#derivativeCheckedAutosize').next().next().hide(); |
---|
603 | */ |
---|
604 | //============================================================= |
---|
605 | // REPONSE ACTION |
---|
606 | //============================================================= |
---|
607 | theMainImage_st = false; |
---|
608 | jQuery("#reset").click(function () { |
---|
609 | location.reload(); |
---|
610 | }); |
---|
611 | |
---|
612 | |
---|
613 | //=========================================================== |
---|
614 | // REPONSE TRIGGER |
---|
615 | //=========================================================== |
---|
616 | jQuery('#ret_autosize').live('ON', function (e) { |
---|
617 | if (nu_img == "") nu_img = 8; |
---|
618 | jQuery(jQuery('.debug').get(nu_img)).trigger('ON'); |
---|
619 | |
---|
620 | }); |
---|
621 | |
---|
622 | //========================================================== |
---|
623 | jQuery("map area").mouseover(function (e) { |
---|
624 | try { |
---|
625 | nok = theImg.useMap; |
---|
626 | hok = this; |
---|
627 | } |
---|
628 | catch (r) { |
---|
629 | |
---|
630 | } |
---|
631 | }); |
---|
632 | |
---|
633 | //================================== |
---|
634 | // jQuery("#llgbo").trigger("ON"); |
---|
635 | //================================== |
---|
636 | jQuery(llgbo_id).live('ON', function (e) { |
---|
637 | n_id = this; |
---|
638 | infos_llgbo = jQuery(llgbo_id).infos(); |
---|
639 | if (infos_llgbo.visible == false) return; |
---|
640 | |
---|
641 | marges_llgbo = 0; |
---|
642 | if (infos_llgbo.height > 0) { |
---|
643 | infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos(); |
---|
644 | infos_llgboframe31 = jQuery(llgbo_id + " div:first").infos(); |
---|
645 | //============================================= |
---|
646 | ll2 = infos_llgboframe1.width; // llgboframe1 interieur |
---|
647 | ll1 = infos_llgboframe31.exterieur.width; // llgboframe31 avec border width |
---|
648 | options.marges_llgbo = (ll1 - ll2); |
---|
649 | infos_llgboh2 = jQuery("#llgboh2").infos(); |
---|
650 | } |
---|
651 | }); |
---|
652 | //============================== |
---|
653 | // jQuery("#mapPicture").trigger("ON"); |
---|
654 | //============================== |
---|
655 | jQuery("#mapPicture").live('ON', function (e) { |
---|
656 | p2 = jQuery("#infoSwitcher").infos(); |
---|
657 | }); |
---|
658 | //============================== |
---|
659 | // jQuery("#map").trigger("ON"); |
---|
660 | //============================== |
---|
661 | jQuery("#map").live('ON', function (e) { |
---|
662 | p2 = jQuery("#map").infos(); |
---|
663 | }); |
---|
664 | //=================================== |
---|
665 | // jQuery("#theImage").trigger("ON"); |
---|
666 | //=================================== |
---|
667 | jQuery("#imageInfos").live('on', function (e) { |
---|
668 | target = e.target.id; |
---|
669 | }); |
---|
670 | |
---|
671 | //=================================== |
---|
672 | // jQuery("#theImage").trigger("ON"); |
---|
673 | //=================================== |
---|
674 | jQuery("#theImage").live('ON', function (e) { |
---|
675 | target = e.target.id; |
---|
676 | |
---|
677 | id = this.id; |
---|
678 | Select_Image(); //+calcul |
---|
679 | }); |
---|
680 | |
---|
681 | |
---|
682 | |
---|
683 | |
---|
684 | //================================================================= |
---|
685 | jQuery(document).live('gallyInterfaceReady', function (e) { |
---|
686 | i = jQuery(this).text(); |
---|
687 | jQuery(this).trigger('ON'); |
---|
688 | } |
---|
689 | |
---|
690 | ); |
---|
691 | |
---|
692 | |
---|
693 | /********************************* |
---|
694 | * |
---|
695 | ********************************/ |
---|
696 | var old_width; |
---|
697 | |
---|
698 | jQuery("#theImage").resize(function (e) { |
---|
699 | |
---|
700 | }); |
---|
701 | |
---|
702 | |
---|
703 | |
---|
704 | jQuery("#menuSwitcher,#infoSwitcher").click(function (e) { |
---|
705 | options.set_sw = this.id; |
---|
706 | setTimeout(function () { div_resize() }, 10); |
---|
707 | nu_img = 0; |
---|
708 | }); |
---|
709 | |
---|
710 | div_resize = function (i) { |
---|
711 | |
---|
712 | jQuery("#theImage").trigger("resize"); |
---|
713 | /* |
---|
714 | if (jQuery("#theImage").width() != old_width) { |
---|
715 | setTimeout(function () { div_resize() }, 10); |
---|
716 | } |
---|
717 | */ |
---|
718 | } |
---|
719 | //=========================================== |
---|
720 | // jQuery("#theImageAndInfos").trigger("ON"); |
---|
721 | //=========================================== |
---|
722 | jQuery("#theImageAndInfos").live('ON', function (e) { |
---|
723 | infos_theImageAndInfos = jQuery("#theImageAndInfos").infos(); |
---|
724 | // setTimeout(function () { Autosize_resize(true) }, 100); |
---|
725 | nu_img = 0; |
---|
726 | }); // fin click #theImageAndInfos ON |
---|
727 | |
---|
728 | |
---|
729 | jQuery("#theImageAndInfos").resize(function (e) { |
---|
730 | |
---|
731 | }); |
---|
732 | |
---|
733 | |
---|
734 | jQuery("#linkAutosize").click(function (e) { |
---|
735 | nu_img = 0; |
---|
736 | }); |
---|
737 | //================================== |
---|
738 | // |
---|
739 | //=================================== |
---|
740 | jQuery('#derivativeCheckedAutosize').click(function () { |
---|
741 | try { |
---|
742 | pathnames = jQuery(this).attr("href").split(":"); |
---|
743 | |
---|
744 | // eval(pathnames[1]); |
---|
745 | } catch (e) { |
---|
746 | n = false; |
---|
747 | } |
---|
748 | }); // fin click derivativeCheckedAutosize |
---|
749 | //==================================================== |
---|
750 | if (typeof decode_href != 'function') { |
---|
751 | function decode_href(myObj) { |
---|
752 | href_path = jQuery(myObj).attr("href"); |
---|
753 | pt = href_path.split("("); |
---|
754 | pt = pt[1].split(")"); |
---|
755 | pt = pt[0].replace(RegExp("'", "g"), ""); |
---|
756 | pt = pt.replace(RegExp(" ", "g"), ""); |
---|
757 | pt = pt.split(","); |
---|
758 | source = pt[0]; |
---|
759 | pictureDeriv = pt[1]; |
---|
760 | pictureMap = pt[2]; |
---|
761 | if (pt.length > 3) |
---|
762 | pictureSelType = pt[3]; |
---|
763 | else |
---|
764 | pictureSelType = pt[1]; |
---|
765 | |
---|
766 | return { source: source, |
---|
767 | pictureDeriv: pictureDeriv, |
---|
768 | pictureMap: pictureMap, |
---|
769 | pictureSelType: pictureSelType |
---|
770 | } |
---|
771 | } |
---|
772 | } |
---|
773 | |
---|
774 | jQuery("#derivativeSwitchBox a").click(function (e) { |
---|
775 | retour = decode_href(this); |
---|
776 | theImg = document.getElementById(theMainImage_id.replace("#", "")); |
---|
777 | if (theImg) { |
---|
778 | // options.pictureDeriv = retour.pictureDeriv; |
---|
779 | options.pictureSelType = retour.pictureSelType; |
---|
780 | options.pictureDeriv = retour.pictureDeriv; |
---|
781 | options.pictureMap = retour.pictureDeriv; |
---|
782 | |
---|
783 | if (this.name) { |
---|
784 | options.pictureSelType = this.name; |
---|
785 | n = Get_dimensions(true, options); |
---|
786 | } else { |
---|
787 | } |
---|
788 | |
---|
789 | jQuery("#derivativeSwitchBox span").removeClass("auto_details linkAutosize"); |
---|
790 | jQuery("#derivativeSwitchBox a").removeClass("auto_details linkAutosize"); |
---|
791 | if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") { |
---|
792 | spans = jQuery("#derivativeChecked" + options.pictureSelType).next(); |
---|
793 | spans.addClass("linkAutosize"); |
---|
794 | spans.find("span").addClass("auto_details"); |
---|
795 | jQuery(".auto_details").text(""); |
---|
796 | } |
---|
797 | Autosize_resize(true, options); |
---|
798 | } |
---|
799 | }); |
---|
800 | //__________ fin click #derivativeSwitchBox a ____________ |
---|
801 | |
---|
802 | jQuery("input").click(function () { |
---|
803 | if (this.name.match(RegExp("_enabled", "gi"))) { |
---|
804 | sel = "[name*=" + this.name + "]"; |
---|
805 | obj = jQuery("tr" + sel); |
---|
806 | |
---|
807 | if (this.checked) |
---|
808 | obj.css({ backgroundColor: "green", color: "white" }); |
---|
809 | else |
---|
810 | obj.css({ backgroundColor: "red", color: "white" }); |
---|
811 | return; |
---|
812 | } |
---|
813 | return; |
---|
814 | }); |
---|
815 | |
---|
816 | |
---|
817 | //==================================== |
---|
818 | Autosize_init = function (name, value) { |
---|
819 | img_defaut = { height: options.scaled_height, width: options.scaled_width }; |
---|
820 | img_reelle = { height: options.theImageHeight, width: options.theImageWidth }; |
---|
821 | img_init = { height: options.theImageHeight, width: options.theImageWidth }; // taille initiale |
---|
822 | |
---|
823 | img_finale = img_init; |
---|
824 | |
---|
825 | useMap = infos_theMainImage.useMap; // #mapmedium |
---|
826 | |
---|
827 | useMap = options.pictureMap; // #mapxxx |
---|
828 | pictureDeriv = options.pictureDeriv; //picturederiv xxx |
---|
829 | |
---|
830 | |
---|
831 | old_img = options.imgSrc; |
---|
832 | old_window_height = options.windowHeight || jQuery(window).height(); |
---|
833 | old_window_width = options.windowWidth || jQuery(window).width(); |
---|
834 | old_img_h = options.imgHeight; |
---|
835 | old_img_w = options.imgWidth; |
---|
836 | if (infos_theMainImage.visible == true) { |
---|
837 | theImg = document.getElementById(theMainImage_id.replace("#", "")); |
---|
838 | theImg.useMap = useMap; |
---|
839 | } |
---|
840 | fade_in = parseInt(options.fade_in || 0); |
---|
841 | |
---|
842 | } |
---|
843 | //____________________ Autosize_init _____________________ |
---|
844 | |
---|
845 | /*************************** |
---|
846 | * Autosize_resize |
---|
847 | ***************************/ |
---|
848 | Autosize_resize = function (force, parametres) { |
---|
849 | n = Get_dimensions(true, options); |
---|
850 | if (n == false) return; |
---|
851 | Save_cookies(options); |
---|
852 | if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") { |
---|
853 | /**/ |
---|
854 | jQuery(theImg).width(Zone_image.image_init.width); |
---|
855 | jQuery(theImg).height(Zone_image.image_init.height); |
---|
856 | |
---|
857 | set_cl("no"); |
---|
858 | Set_llbgo(true); |
---|
859 | return; |
---|
860 | |
---|
861 | } |
---|
862 | infos_theImage = jQuery(theImage_id).infos(true); |
---|
863 | if (typeof img_finale == "undefined") img_finale = { width: Zone_image.image.width, height: Zone_image.image.height }; |
---|
864 | if (img_finale.width && (img_finale.width != Zone_image.image.width || img_finale.height != Zone_image.image.height)) { |
---|
865 | img_finale = { width: Zone_image.image.width, height: Zone_image.image.height }; |
---|
866 | } |
---|
867 | r1 = Zone_image.image.width / Zone_image.image.height; |
---|
868 | //====================================================== |
---|
869 | |
---|
870 | affiche_debug({ |
---|
871 | |
---|
872 | Debug1: Debug_info(1, "Cont:" + infos_theImage.width |
---|
873 | + " X " + infos_theImage.height |
---|
874 | + " IMG: " + img_finale.width |
---|
875 | + " X " + img_finale.height |
---|
876 | + " mgw : " + Zone_image.marges.width |
---|
877 | , "->") |
---|
878 | }); |
---|
879 | |
---|
880 | if (Type_Img == "pamoorama") {// img_finale.width |
---|
881 | jQuery("#pamoorama").width(img_finale.width); |
---|
882 | jQuery("#pamoorama").height(img_finale.height); |
---|
883 | |
---|
884 | |
---|
885 | infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true }); |
---|
886 | |
---|
887 | Set_Pamoorama({ width: img_finale.width, height: img_finale.height }); |
---|
888 | if (nopano) |
---|
889 | if (window.myPamoorama.options.autoscrollOnLoad) { |
---|
890 | window.myPamoorama.startAnimRight(); |
---|
891 | } |
---|
892 | |
---|
893 | //jQuery(theMainImage_id).height(Zone_image.image.height); |
---|
894 | } else { |
---|
895 | if (options.imageAutosize == false) |
---|
896 | if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") { |
---|
897 | jQuery(theMainImage_id).height(Zone_image.image.height); |
---|
898 | jQuery(theMainImage_id).width(Zone_image.image.width); |
---|
899 | |
---|
900 | } else { |
---|
901 | jQuery(theMainImage_id).width(Zone_image.image_init.width); |
---|
902 | jQuery(theMainImage_id).height(Zone_image.image_init.height); |
---|
903 | } |
---|
904 | |
---|
905 | |
---|
906 | if (Type_Img == "charlie" || Type_Img == "iframe") { |
---|
907 | swfobj = jQuery("#" + Type_Img).infos({ absolute: true }); |
---|
908 | |
---|
909 | // jQuery("#" + Type_Img).attr({ height: Zone_image.image.height, width: Zone_image.image.width - 50 }); |
---|
910 | // jQuery(theMainImage_obj).attr({ height: Zone_image.image.height, width: Zone_image.image.width - 50 }); |
---|
911 | // jQuery(theMainImage_emb).attr({ height: Zone_image.image.height, width: Zone_image.image.width }); |
---|
912 | |
---|
913 | } |
---|
914 | |
---|
915 | |
---|
916 | } |
---|
917 | |
---|
918 | set_cl(); |
---|
919 | Set_llbgo(true); |
---|
920 | return true; |
---|
921 | }; |
---|
922 | //_________________Autosize ____________________________________ |
---|
923 | |
---|
924 | /***************** |
---|
925 | * changeImgSrc |
---|
926 | ******************/ |
---|
927 | changeImgSrc = function (url, typeSave, typeMap, type) { |
---|
928 | if (url) { |
---|
929 | if (url.match(RegExp("i.php", "gi"))) { |
---|
930 | urls = url.split("?"); |
---|
931 | } |
---|
932 | } |
---|
933 | url2 = jQuery("#theMainImage").attr("src"); |
---|
934 | |
---|
935 | |
---|
936 | jQuery("#theMainImage").removeAttr("width height").attr("src", url) |
---|
937 | .load(function (i) { |
---|
938 | if (!init_img(this)) |
---|
939 | return; |
---|
940 | //======================================================================= |
---|
941 | jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden'); |
---|
942 | newtype = options.pictureSelType; |
---|
943 | if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) { |
---|
944 | jQuery('#derivativeChecked' + type).css('visibility', 'visible'); |
---|
945 | document.cookie = 'picture_sel_type=' + type + ';path=' + COOKIE_PATH; |
---|
946 | } else { |
---|
947 | jQuery('#derivativeChecked' + typeSave).css('visibility', 'visible'); |
---|
948 | document.cookie = 'picture_sel_type=' + typeSave + ';path=' + COOKIE_PATH; |
---|
949 | } |
---|
950 | options.pictureMap = typeMap; |
---|
951 | options.pictureDeriv = typeSave; |
---|
952 | document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH; |
---|
953 | |
---|
954 | }) |
---|
955 | .live("ON", function (e) { |
---|
956 | theMainImage_st = this.complete; |
---|
957 | imgsrc = this.src; |
---|
958 | // alert(this.src + ' Image does not exist !!'); |
---|
959 | }).error(function (i) { |
---|
960 | imgsrc = this.src; |
---|
961 | }); |
---|
962 | /*********************** |
---|
963 | * |
---|
964 | **********************/ |
---|
965 | jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ") |
---|
966 | .error(function (e) { |
---|
967 | if (!this.complete) { |
---|
968 | // le fichier n'est pas present |
---|
969 | src = jQuery(this).attr("src").replace("./_data/i/", "", 1); |
---|
970 | src = this.src.split("/_data/i")[1]; |
---|
971 | url = 'i.php?' + src + "&ajaxload=true"; |
---|
972 | jQuery(theMainImage_id).attr("src", url); |
---|
973 | /* |
---|
974 | jQuery.ajax({ |
---|
975 | type: 'GET', |
---|
976 | url: 'i.php?' + src + "&ajaxload=true", |
---|
977 | dataType: 'json', |
---|
978 | success: (function (data) { |
---|
979 | j = data.url; |
---|
980 | // jQuery(theMainImage_id).attr("src", data.url); |
---|
981 | |
---|
982 | }) |
---|
983 | |
---|
984 | }); |
---|
985 | */ |
---|
986 | |
---|
987 | |
---|
988 | |
---|
989 | } |
---|
990 | |
---|
991 | }) |
---|
992 | .bind("Finish", function (e, data) { |
---|
993 | if (typeof imageInfos_id == "undefined") return; |
---|
994 | |
---|
995 | }) |
---|
996 | .bind("ON", function (e, data) { |
---|
997 | if (data.status != "ok") { |
---|
998 | popup = jQuery(".errors"); |
---|
999 | if (popup.length == 0) { |
---|
1000 | jQuery("#theImage").append("<div class='errors'><span></span></div>"); |
---|
1001 | } |
---|
1002 | jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText); |
---|
1003 | jQuery(".errors").show().delay(10000).hide(2000); |
---|
1004 | return; |
---|
1005 | } |
---|
1006 | if (data.src) { |
---|
1007 | if (typeof imageInfos_id == "undefined") return; |
---|
1008 | if (!data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) { |
---|
1009 | Autosize_resize(true, options); |
---|
1010 | } |
---|
1011 | } |
---|
1012 | }); |
---|
1013 | //_________ theMainImage ___________ |
---|
1014 | |
---|
1015 | |
---|
1016 | document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH; |
---|
1017 | } |
---|
1018 | |
---|
1019 | //__________________ changeImgSrc ______________________ |
---|
1020 | |
---|
1021 | /***************************** |
---|
1022 | * pamoorama |
---|
1023 | ******************************/ |
---|
1024 | |
---|
1025 | jQuery("#pamoorama").bind("on", function () { alert($(this).text()); }); |
---|
1026 | jQuery("#pamoorama").bind("on", function (e) { |
---|
1027 | myPamoorama = window.myPamoorama; |
---|
1028 | }); |
---|
1029 | jQuery("#pamoorama_inner").live("on", function (e) { |
---|
1030 | myPamoorama = window.myPamoorama; |
---|
1031 | }); |
---|
1032 | jQuery('#pamoorama').live('ON', function (e) { |
---|
1033 | jQuery(jQuery('.debug').get(1)).trigger('ON'); |
---|
1034 | Autosize_resize(true, options); |
---|
1035 | }); |
---|
1036 | |
---|
1037 | //=============================================== |
---|
1038 | // jQuery("#theImage").trigger("Start_right"); |
---|
1039 | //=============================================== |
---|
1040 | jQuery("#theImage").live('Start_right', function (e) { |
---|
1041 | if (typeof Zone_image == "undefined") return |
---|
1042 | test_w = window.myPamoorama.autoSlideFx.to; |
---|
1043 | test_w = window.myPamoorama.autoScrollFx.to; |
---|
1044 | nf = jQuery("#pamoorama_thumb").height(); |
---|
1045 | jQuery("#pamoorama_thumb img").width(200); |
---|
1046 | jQuery("#pamoorama_thumb img").height(nf); |
---|
1047 | // 200=window.myPamoorama.imageWidth |
---|
1048 | // frame = Zone_image.container.width |
---|
1049 | nw = (200 * Zone_image.image.width) / window.myPamoorama.imageWidth; |
---|
1050 | jQuery("#pamoorama_frame").width(nw); |
---|
1051 | }); |
---|
1052 | //=============================================== |
---|
1053 | // jQuery("#theImage").trigger("Start_left"); |
---|
1054 | //=============================================== |
---|
1055 | jQuery("#theImage").live('Start_left', function (e) { |
---|
1056 | if (typeof Zone_image == "undefined") return |
---|
1057 | jQuery("#theImage").show(0); |
---|
1058 | window.myPamoorama.autoSlideFx.to = 0; |
---|
1059 | test_w = window.myPamoorama.autoSlideFx.to; |
---|
1060 | test_w = window.myPamoorama.autoScrollFx.to; |
---|
1061 | nf = jQuery("#pamoorama_thumb").height(); |
---|
1062 | jQuery("#pamoorama_thumb img").width(200); |
---|
1063 | jQuery("#pamoorama_thumb img").height(nf); |
---|
1064 | }); |
---|
1065 | |
---|
1066 | /************************************ |
---|
1067 | * Wait_pamoorama |
---|
1068 | ************************************/ |
---|
1069 | Wait_pamoorama = function () { |
---|
1070 | if (Type_Img != "pamoorama") return; |
---|
1071 | tempo = 0; |
---|
1072 | Wait_pamoorama_st = false; |
---|
1073 | |
---|
1074 | |
---|
1075 | while (Wait_pamoorama_st == false) { |
---|
1076 | Wait_pamoorama_st = Wait_pamoorama_time(); |
---|
1077 | jQuery.noop(); |
---|
1078 | } |
---|
1079 | tempo = 0; |
---|
1080 | if (nopano) { |
---|
1081 | if (window.myPamoorama.options.autoscrollOnLoad) { |
---|
1082 | window.myPamoorama.startAnimRight(); |
---|
1083 | jQuery.delay(100); |
---|
1084 | } |
---|
1085 | |
---|
1086 | |
---|
1087 | |
---|
1088 | } |
---|
1089 | |
---|
1090 | } |
---|
1091 | //__________________ Wait_pamoorama ______________________ |
---|
1092 | jQuery(".pwg-icon-clock-minus, .pwg-icon-clock-plus").click(function (i) { |
---|
1093 | |
---|
1094 | |
---|
1095 | |
---|
1096 | |
---|
1097 | |
---|
1098 | }).mouseover(function (i) { |
---|
1099 | |
---|
1100 | }) |
---|
1101 | |
---|
1102 | |
---|
1103 | Wait_pamoorama_time = function () { |
---|
1104 | if (nopano == true) return true; |
---|
1105 | |
---|
1106 | |
---|
1107 | |
---|
1108 | if (jQuery("#pamoorama").length) { |
---|
1109 | tempo = tempo + 1; |
---|
1110 | |
---|
1111 | mypanorama = window.myPamoorama; |
---|
1112 | if (!mypanorama) { |
---|
1113 | if (tempo > 500) return true; |
---|
1114 | setTimeout("Wait_pamoorama_time()", 500); |
---|
1115 | return false; |
---|
1116 | |
---|
1117 | } |
---|
1118 | |
---|
1119 | if (mypanorama.skipInit == false) { |
---|
1120 | if (tempo > 500) return true; |
---|
1121 | setTimeout("Wait_pamoorama_time()", 500); |
---|
1122 | return false; |
---|
1123 | } |
---|
1124 | //============================================================= |
---|
1125 | if (Math.abs(mypanorama.imageHeight) < 100) { |
---|
1126 | setTimeout("Wait_pamoorama_time()", 500); |
---|
1127 | return false; |
---|
1128 | } |
---|
1129 | |
---|
1130 | if (jQuery(".infos").length > 0) { |
---|
1131 | jQuery(".infos").empty(); |
---|
1132 | jQuery(".infos").hide(); |
---|
1133 | } |
---|
1134 | |
---|
1135 | nopano = true; |
---|
1136 | |
---|
1137 | Zone_image = { image_init: { width: mypanorama.imageWidth, |
---|
1138 | height: mypanorama.imageHeight |
---|
1139 | } |
---|
1140 | } |
---|
1141 | jQuery("#pamoorama").trigger("ON"); |
---|
1142 | return true; |
---|
1143 | |
---|
1144 | } |
---|
1145 | } |
---|
1146 | //__________________ Wait_pamoorama time______________________ |
---|
1147 | |
---|
1148 | /********************** |
---|
1149 | * |
---|
1150 | ***********************/ |
---|
1151 | Wait_Affichage = function () { |
---|
1152 | Wait_Affichage_st = false; |
---|
1153 | while (Wait_Affichage_st == false) { |
---|
1154 | jQuery.noop(); |
---|
1155 | Wait_Affichage_st = Wait_Affichage_time(); |
---|
1156 | } |
---|
1157 | } |
---|
1158 | //__________________ Wait_Affichage ______________________ |
---|
1159 | |
---|
1160 | |
---|
1161 | Wait_Affichage_time = function () { |
---|
1162 | if (typeof fade_in == "undefined") fade_in = 1000; |
---|
1163 | fade_in = parseInt(fade_in); |
---|
1164 | /* |
---|
1165 | if (!Autosize_resize()) { |
---|
1166 | setTimeout("Wait_Affichage()", 500); |
---|
1167 | return |
---|
1168 | } |
---|
1169 | nu_img++; |
---|
1170 | */ |
---|
1171 | if (typeof fade_in == "undefined") fade_in = 0; |
---|
1172 | |
---|
1173 | // if (nu_img > 1) return; |
---|
1174 | if (typeof stb != "undefined") |
---|
1175 | stb.stop().fadeTo(3500, 0); |
---|
1176 | if (typeof theMainImage_id == "undefined") return true; |
---|
1177 | |
---|
1178 | if (theMainImage_id.selector) { |
---|
1179 | theMainImage_id = theMainImage_id.selector; |
---|
1180 | } |
---|
1181 | if (theMainImage_id == null) return; |
---|
1182 | |
---|
1183 | if (jQuery(theMainImage_id).length == 0) { |
---|
1184 | if (jQuery("#pamoorama_inner").length > 0) { |
---|
1185 | return true; |
---|
1186 | } |
---|
1187 | //=== attente Image chargée === |
---|
1188 | if (tempo > 100) return true; |
---|
1189 | tempo++; |
---|
1190 | setTimeout("Wait_Affichage_time()", 500); |
---|
1191 | return false; |
---|
1192 | |
---|
1193 | } else { |
---|
1194 | |
---|
1195 | img_h = jQuery(theMainImage_id).height(); |
---|
1196 | img_w = jQuery(theMainImage_id).width(); |
---|
1197 | |
---|
1198 | if (typeof infos_theImage == "undefined") return; |
---|
1199 | jQuery("#ret_autosize").trigger('ON', { |
---|
1200 | width: img_w, |
---|
1201 | height: img_h, |
---|
1202 | theImage: theMainImage_id, |
---|
1203 | img_src: infos_theMainImage.src, |
---|
1204 | window_height: infos_theImage.height, |
---|
1205 | window_width: infos_theImage.width |
---|
1206 | }); |
---|
1207 | } |
---|
1208 | return true; |
---|
1209 | } |
---|
1210 | //______________ Wait_affichage ______ |
---|
1211 | |
---|
1212 | |
---|
1213 | /*********************** |
---|
1214 | * |
---|
1215 | **********************/ |
---|
1216 | init_img = function (theImg) { |
---|
1217 | if (theImg.complete == false) { |
---|
1218 | return; |
---|
1219 | } |
---|
1220 | name_src = theImg.src; |
---|
1221 | img_init = { width: jQuery(theImg).width(), height: jQuery(theImg).height() } |
---|
1222 | |
---|
1223 | if (typeof theImg.naturalWidth != "undefined") |
---|
1224 | img_init.width = theImg.naturalWidth; |
---|
1225 | if (typeof theImg.naturalHeight != "undefined") |
---|
1226 | img_init.height = theImg.naturalHeight; |
---|
1227 | img_init.rapport = img_init.width / img_init.height; |
---|
1228 | if (typeof Zone_image == "undefined") Zone_image = { image: {} }; |
---|
1229 | if (typeof Zone_image.image == "undefined") Zone_image.image = { height: Zone_image.image_init.height, width: Zone_image.image_init.width }; |
---|
1230 | // theImg.height = img_init.height; |
---|
1231 | // theImg.width = img_init.width; |
---|
1232 | |
---|
1233 | Zone_image.image_init = { height: img_init.height, width: img_init.width, rapport: img_init.rapport }; |
---|
1234 | Zone_image.zoom = Zone_image.image_init.height / img_init.height; |
---|
1235 | |
---|
1236 | if (typeof Zone_image.src == "undefined") { |
---|
1237 | Zone_image.src = name_src; |
---|
1238 | return false; |
---|
1239 | } |
---|
1240 | stx = name_src.match(RegExp(Zone_image.src, "gi")); |
---|
1241 | return stx; |
---|
1242 | } |
---|
1243 | //___________ init_img _______ |
---|
1244 | |
---|
1245 | |
---|
1246 | |
---|
1247 | //=========================================== |
---|
1248 | // |
---|
1249 | //=========================================== |
---|
1250 | Set_Map = function (nds) { |
---|
1251 | p0 = jQuery("#map").offset(); |
---|
1252 | if (!p0) return; |
---|
1253 | infos_mapPicture = jQuery("#mapPicture").infos({ absolute: true }); |
---|
1254 | infos_theImage = jQuery("#theImage").infos({ absolute: true }); |
---|
1255 | jQuery("#map").removeAttr("height"); |
---|
1256 | jQuery("#map").removeAttr("width"); |
---|
1257 | jQuery("#map").width(infos_theImage.width - (infos_mapPicture.width)); |
---|
1258 | jQuery("#map").height(jQuery(window).height() - infos_theImage.top - infos_theImage.general.marges.height); |
---|
1259 | return true; |
---|
1260 | } |
---|
1261 | |
---|
1262 | jQuery("map [name='#Autosize'] area").mouseover(function (e) { |
---|
1263 | return; |
---|
1264 | }); |
---|
1265 | //___ Set_Map ___ |
---|
1266 | |
---|
1267 | //===================================== |
---|
1268 | // |
---|
1269 | //===================================== |
---|
1270 | Get_Maxi = function (Maxi_image) { |
---|
1271 | var pt = options.liste_type; |
---|
1272 | if (pt.length > 0) { |
---|
1273 | tw = Maxi_image.width; // valeur maxi |
---|
1274 | th = Maxi_image.height; // valeur maxi |
---|
1275 | n = 0; |
---|
1276 | maxi_size = { w: Maxi_image.width, h: Maxi_image.height, idx: -1 }; |
---|
1277 | mini_size = { w: tw, h: th, idx: 0 }; |
---|
1278 | size_derive = { w: 0, h: 0 }; |
---|
1279 | size_encours = { w: tw, h: th }; |
---|
1280 | //================================= |
---|
1281 | jQuery(pt).each(function (i) { |
---|
1282 | vn = this; |
---|
1283 | size_derive = { w: parseInt(vn[2]), h: parseInt(vn[3]) }; |
---|
1284 | if (vn[0] == options.pictureSelType) { |
---|
1285 | maxi_size = size_derive; |
---|
1286 | maxi_size.idx = n; |
---|
1287 | return false |
---|
1288 | } |
---|
1289 | if (vn[0] != "square" && vn[0] != "thumb" && vn[0] != "SelMaxi" && vn[0] != "Autosize") { |
---|
1290 | if (size_derive.h > size_encours.h) { |
---|
1291 | if (maxi_size.idx < 0) { |
---|
1292 | maxi_size = size_derive; |
---|
1293 | maxi_size.idx = n; |
---|
1294 | if (options.pictureSelType == "SelMaxi" || options.pictureSelType == "Autosize") |
---|
1295 | return false |
---|
1296 | } |
---|
1297 | } |
---|
1298 | if (size_derive.h < size_encours.h && size_derive.h > 10) { |
---|
1299 | mini_size = size_derive; |
---|
1300 | mini_size.idx = n; |
---|
1301 | } |
---|
1302 | } |
---|
1303 | n++; |
---|
1304 | }); |
---|
1305 | n = maxi_size.idx; |
---|
1306 | if (n < 0) { |
---|
1307 | n = mini_size.idx; |
---|
1308 | } |
---|
1309 | if (options.pictureSelType.match(RegExp("SelMaxi", "gi"))) { |
---|
1310 | n = mini_size.idx; |
---|
1311 | |
---|
1312 | } |
---|
1313 | if (options.pictureSelType.match(RegExp("Autosize", "gi"))) { |
---|
1314 | |
---|
1315 | } |
---|
1316 | |
---|
1317 | options.pictureDeriv = pt[n][0]; |
---|
1318 | return { url: pt[n][1], pictureDeriv: pt[n][0], pictureMap: pt[n][0], width: pt[n][2], height: pt[n][3] }; |
---|
1319 | } |
---|
1320 | return { imgSrc: "", pictureDeriv: "", width: "", height: "" }; |
---|
1321 | } |
---|
1322 | //_______________ Get_Maxi ______ |
---|
1323 | |
---|
1324 | /******************** |
---|
1325 | * |
---|
1326 | ********************/ |
---|
1327 | Select_Image = function () { |
---|
1328 | var pt = options.liste_type; |
---|
1329 | |
---|
1330 | |
---|
1331 | if (pt.length > 0) { |
---|
1332 | //===== calcul Image === |
---|
1333 | if (typeof imageInfos_id == "undefined") return; |
---|
1334 | Calcul_Image(); |
---|
1335 | options.theImageMargeZone = Zone_image.marges; |
---|
1336 | if (Type_Img != 'charlie') { |
---|
1337 | /* |
---|
1338 | if (options.pictureSelType != "SelMaxi" && options.pictureSelType != "Autosize") { |
---|
1339 | options.pictureMap = options.pictureDeriv; |
---|
1340 | |
---|
1341 | imgSrc = options.liste_type[6]; |
---|
1342 | changeImgSrc(imgSrc, options.pictureDeriv, options.pictureMap, options.pictureSelType); |
---|
1343 | src = theImg.src; |
---|
1344 | return; |
---|
1345 | } else { |
---|
1346 | IMg = Get_Maxi(Zone_image.image); |
---|
1347 | } |
---|
1348 | */ |
---|
1349 | IMg = Get_Maxi(Zone_image.image); |
---|
1350 | imgSrc = IMg.url; |
---|
1351 | if (options.imgSrc.match(RegExp(imgSrc, "gi"))) |
---|
1352 | options.imgSrc = imgSrc; |
---|
1353 | |
---|
1354 | img_width = IMg.width; |
---|
1355 | img_height = IMg.height; |
---|
1356 | |
---|
1357 | Zone_image.image_init = { height: IMg.height, |
---|
1358 | width: IMg.width, |
---|
1359 | rapport: IMg.width / IMg.height |
---|
1360 | |
---|
1361 | }; |
---|
1362 | if (typeof Zone_image.image == "undefined") |
---|
1363 | Zone_image.image = { height: IMg.height, |
---|
1364 | width: IMg.width, |
---|
1365 | rapport: IMg.width / IMg.height |
---|
1366 | |
---|
1367 | }; |
---|
1368 | } else { |
---|
1369 | return; |
---|
1370 | } |
---|
1371 | Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height; |
---|
1372 | if (typeof Zone_image.src == "undefined") Zone_image.src = " "; |
---|
1373 | |
---|
1374 | identique = Zone_image.src.match(RegExp(imgSrc, "gi")); |
---|
1375 | if (identique) return; |
---|
1376 | href_path = "javascript:changeImgSrc('" + imgSrc + "', '" + IMg.pictureMap + "', '" + IMg.pictureDeriv + "', '" + options.pictureSelType + "')"; |
---|
1377 | jQuery(".linkAutosize").attr("href", href_path); |
---|
1378 | theImg = document.getElementById(theMainImage_id.replace("#", "")); |
---|
1379 | |
---|
1380 | if ((theImg == null) || theImg.tagName != "IMG") { |
---|
1381 | imgSrc_i = jQuery(theImg).css("backgroundImage"); |
---|
1382 | imgSrc_j = jQuery(theImg).css("background-image"); |
---|
1383 | return; |
---|
1384 | } else { |
---|
1385 | changeImgSrc(imgSrc, IMg.pictureDeriv, IMg.pictureMap, options.pictureSelType); |
---|
1386 | } |
---|
1387 | |
---|
1388 | theImg.useMap = "#map" + IMg.pictureMap; |
---|
1389 | return true; |
---|
1390 | |
---|
1391 | |
---|
1392 | theImg = document.getElementById(theMainImage_id.replace("#", "")); |
---|
1393 | if (init_img(theImg)) { |
---|
1394 | |
---|
1395 | return true; |
---|
1396 | } |
---|
1397 | return false; |
---|
1398 | |
---|
1399 | } else { |
---|
1400 | |
---|
1401 | |
---|
1402 | return false; |
---|
1403 | } |
---|
1404 | |
---|
1405 | |
---|
1406 | }; //_______________ Select_Image ______ |
---|
1407 | |
---|
1408 | |
---|
1409 | /************************************************* |
---|
1410 | * correction pamoorama |
---|
1411 | *************************************************/ |
---|
1412 | |
---|
1413 | Set_Pamoorama = function (Format) { |
---|
1414 | myPamoorama = window.myPamoorama; |
---|
1415 | if (Type_Img == "pamoorama") { |
---|
1416 | |
---|
1417 | if (!nopano) { |
---|
1418 | theMainImage_Id = "#pamoorama"; |
---|
1419 | nopano = false; |
---|
1420 | Wait_pamoorama(); |
---|
1421 | infos_theMainImage = jQuery(theMainImage_Id).infos(); |
---|
1422 | //theMainImage_Id = "#pamoorama"; |
---|
1423 | } |
---|
1424 | |
---|
1425 | |
---|
1426 | if (typeof myPamoorama == "undefined") { |
---|
1427 | return; |
---|
1428 | } |
---|
1429 | //========================================================= |
---|
1430 | if (!nopano) { |
---|
1431 | //theMainImage_Id = "#pamoorama"; |
---|
1432 | nopano = false; |
---|
1433 | Wait_pamoorama(); |
---|
1434 | infos_theMainImage = jQuery(theMainImage_Id).infos(); |
---|
1435 | //theMainImage_Id = "#pamoorama"; |
---|
1436 | } |
---|
1437 | |
---|
1438 | |
---|
1439 | infos_pamoorama_outter = jQuery("#pamoorama_outter").infos({ absolute: true }); |
---|
1440 | infos_pamoorama_inner = jQuery("#pamoorama_inner").infos({ absolute: true }); |
---|
1441 | infos_pamoorama_frame = jQuery("#pamoorama_frame").infos({ absolute: true }); |
---|
1442 | infos_frame = jQuery(myPamoorama.frame).infos({ absolute: true }); |
---|
1443 | |
---|
1444 | |
---|
1445 | //==================================================== |
---|
1446 | marges_w = infos_pamoorama.general.marges.width; |
---|
1447 | marges_h = infos_pamoorama.general.marges.height; |
---|
1448 | |
---|
1449 | jQuery("#pamoorama_footer").css({ |
---|
1450 | width: Format.width + "px" |
---|
1451 | }); |
---|
1452 | infos_pamoorama_footer = jQuery("#pamoorama_footer").infos(); |
---|
1453 | marges_h += infos_pamoorama_footer.general.height; |
---|
1454 | outter_height = Format.height; |
---|
1455 | |
---|
1456 | Zoom_pano = (Format.height - marges_h) / Zone_image.image_init.height; |
---|
1457 | new_image = { height: Math.ceil(Zone_image.image_init.height * Zoom_pano), |
---|
1458 | width: Math.ceil(Zone_image.image_init.width * Zoom_pano) |
---|
1459 | } |
---|
1460 | |
---|
1461 | jQuery("#pamoorama_inner").css({ |
---|
1462 | width: new_image.width + "px", height: new_image.height + "px", "background-size": "100%" |
---|
1463 | }); |
---|
1464 | //---------- test largeur image |
---|
1465 | new_width = Format.width - (options.marge_right + options.marge_left); |
---|
1466 | |
---|
1467 | if (new_width > new_image.width) { |
---|
1468 | new_width = new_image.width; |
---|
1469 | jQuery("#pamoorama_outter").css({ |
---|
1470 | |
---|
1471 | align: "center", |
---|
1472 | margin: "0" |
---|
1473 | }); |
---|
1474 | } |
---|
1475 | outter_width = new_width; |
---|
1476 | |
---|
1477 | jQuery("#pamoorama_outter").css({ |
---|
1478 | align: 'center', |
---|
1479 | margin: 'auto', |
---|
1480 | width: outter_width + "px", |
---|
1481 | height: Format.height - marges_h + "px" |
---|
1482 | }); |
---|
1483 | //============= Mise à l'echelle ================== |
---|
1484 | window.myPamoorama.options.width = Math.ceil(Format.width); |
---|
1485 | //================================================================== |
---|
1486 | new_max_left = new_image.width - outter_width; |
---|
1487 | if (!window.myPamoorama.outter) return; |
---|
1488 | window.myPamoorama.outter.scrollTo(new_max_left, 0); |
---|
1489 | |
---|
1490 | if (typeof window.myPamoorama.autoScrollFx != "undefined") window.myPamoorama.autoScrollFx.to = new Array(new_max_left, 0); |
---|
1491 | window.myPamoorama.ratio = Math.ceil(new_image.width / 200); |
---|
1492 | window.myPamoorama.imageWidth = new_image.width; |
---|
1493 | window.myPamoorama.imageHeight = new_image.height; |
---|
1494 | nf = jQuery("#pamoorama_thumb").height(); |
---|
1495 | jQuery("#pamoorama_thumb img").width(180); |
---|
1496 | jQuery("#pamoorama_thumb img").height(nf); |
---|
1497 | |
---|
1498 | jQuery("#pamoorama_thumb").css({ |
---|
1499 | /* position: "absolute", */ |
---|
1500 | left: (Format.width - 215) + "px" |
---|
1501 | |
---|
1502 | }); |
---|
1503 | jQuery("#pamoorama_thumb img").css({ |
---|
1504 | |
---|
1505 | }); |
---|
1506 | // 200=window.myPamoorama.width |
---|
1507 | // frame = Zone_image.container.width |
---|
1508 | |
---|
1509 | nw = (window.myPamoorama.image.width * Format.width) / window.myPamoorama.imageWidth; |
---|
1510 | jQuery("#pamoorama_frame").width(nw); |
---|
1511 | |
---|
1512 | |
---|
1513 | } // |
---|
1514 | } // Set_Pamoorama |
---|
1515 | |
---|
1516 | /*********************************************************/ |
---|
1517 | |
---|
1518 | Toggle_bp = function () { |
---|
1519 | options.cl_visible = !options.cl_visible; |
---|
1520 | Autosize_resize(); |
---|
1521 | Wait_Affichage(); |
---|
1522 | |
---|
1523 | } |
---|
1524 | |
---|
1525 | //==================================== |
---|
1526 | // |
---|
1527 | //==================================== |
---|
1528 | Calcul_Image = function () { |
---|
1529 | |
---|
1530 | /****************************************/ |
---|
1531 | if (typeof imageInfos_id == "undefined") return; |
---|
1532 | infos_imageInfos = jQuery(imageInfos_id).infos({ absolute: true }); // information |
---|
1533 | infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true }); // Image |
---|
1534 | // commentContent |
---|
1535 | // copyright |
---|
1536 | |
---|
1537 | |
---|
1538 | |
---|
1539 | pos_top = options.pos_top; |
---|
1540 | // pos_top = infos_theImage.top; |
---|
1541 | |
---|
1542 | pos = jQuery(theImage_id).offset(); |
---|
1543 | infos_theImage = jQuery(theImage_id).infos(true); // container |
---|
1544 | infos_window = jQuery(window).infos(true); // window |
---|
1545 | w = infos_theImage.general.marges.width |
---|
1546 | |
---|
1547 | container = { |
---|
1548 | height: infos_window.height - options.theImageTop, |
---|
1549 | width: infos_window.width - options.theImageLeft - options.theImageRight |
---|
1550 | } |
---|
1551 | marge_left = options.marge_left | 0; |
---|
1552 | marge_right = options.marge_right | 0; |
---|
1553 | marge_top = options.marge_top | 0; |
---|
1554 | marge_bottom = options.marge_bottom | 0; |
---|
1555 | |
---|
1556 | //========================================================== |
---|
1557 | if (test_theme("stripped")) { |
---|
1558 | infos_the_page.margin.left = 20; //taille fleche |
---|
1559 | infos_the_page.margin.right = 20; |
---|
1560 | } |
---|
1561 | |
---|
1562 | |
---|
1563 | if (test_theme("elegant")) { |
---|
1564 | |
---|
1565 | if (infos_imageInfos.visible == true) { |
---|
1566 | // marge_right += infos_imageInfos.general.width; ; |
---|
1567 | |
---|
1568 | } else { |
---|
1569 | marge_right += 0; |
---|
1570 | |
---|
1571 | } |
---|
1572 | marge_right += 1; |
---|
1573 | marge_left += 1; |
---|
1574 | |
---|
1575 | } else if (test_theme("stripped")) { |
---|
1576 | |
---|
1577 | } else if (test_theme("simple")) { |
---|
1578 | |
---|
1579 | |
---|
1580 | |
---|
1581 | } else if (test_theme("OS")) { |
---|
1582 | |
---|
1583 | } else if (test_theme("pur")) { |
---|
1584 | marge_right += 0; |
---|
1585 | // marge_right += 25; |
---|
1586 | } else if (test_theme("mont")) { |
---|
1587 | marge_right += 0; |
---|
1588 | |
---|
1589 | // marge_right += 25; |
---|
1590 | |
---|
1591 | |
---|
1592 | } else { |
---|
1593 | |
---|
1594 | |
---|
1595 | |
---|
1596 | } |
---|
1597 | |
---|
1598 | |
---|
1599 | retrait_img = {}; |
---|
1600 | //========== Format Image ============== |
---|
1601 | retrait_img.height = Math.ceil(options.marges_llgbo || 0) |
---|
1602 | + Math.ceil(infos_theMainImage.general.marges.height); |
---|
1603 | retrait_img.height += 2; |
---|
1604 | |
---|
1605 | |
---|
1606 | //=============================================================== |
---|
1607 | retrait_img.width = Math.ceil(infos_theMainImage.general.marges.width); // borderwidth+padding |
---|
1608 | retrait_img.width = Math.ceil(infos_theImage.general.marges.width); // borderwidth+padding |
---|
1609 | retrait_img.width += Math.ceil(options.marges_llgbo || 0); |
---|
1610 | retrait_img.width += 2; |
---|
1611 | if (!options.check_desc_v) |
---|
1612 | marge_bottom = 0; |
---|
1613 | |
---|
1614 | //================== Limite Format Image ===================== |
---|
1615 | container.height_interne = container.height - marge_top - marge_bottom; |
---|
1616 | container.width_interne = container.width - marge_left - marge_right; |
---|
1617 | |
---|
1618 | container.height_interne = Math.max(container.height_interne, Math.ceil(options.mini_height) + retrait_img.height), |
---|
1619 | container.width_interne = Math.max(container.width_interne, Math.ceil(options.mini_width) + retrait_img.width) |
---|
1620 | |
---|
1621 | |
---|
1622 | image_max = { |
---|
1623 | height: (container.height_interne - retrait_img.height), |
---|
1624 | width: (container.width_interne - retrait_img.width) |
---|
1625 | } |
---|
1626 | //========================= |
---|
1627 | // test débordement |
---|
1628 | //========================= |
---|
1629 | height_theMainImage = Math.ceil(image_max.height); |
---|
1630 | width_theMainImage = Math.ceil(image_max.width); |
---|
1631 | |
---|
1632 | if (typeof Zone_image.image_init.rapport == "undefined") { |
---|
1633 | Zone_image.image_init.rapport = options.ratio; |
---|
1634 | } |
---|
1635 | if (Type_Img == "charlie") { |
---|
1636 | |
---|
1637 | } else if (Type_Img == "pamoorama") { |
---|
1638 | if (height_theMainImage > container.height_interne) { |
---|
1639 | n = options.pictureSelType; |
---|
1640 | } |
---|
1641 | } else { |
---|
1642 | |
---|
1643 | height_theMainImage = Math.ceil(width_theMainImage / options.ratio); |
---|
1644 | |
---|
1645 | |
---|
1646 | |
---|
1647 | if (height_theMainImage > container.height_interne) { |
---|
1648 | image_max.height = container.height_interne; |
---|
1649 | image_max.width = image_max.height * Zone_image.image_init.rapport; |
---|
1650 | width_theMainImage = Math.ceil(image_max.width); |
---|
1651 | height_theMainImage = Math.ceil(image_max.height); |
---|
1652 | } |
---|
1653 | if (width_theMainImage > container.width_interne) { |
---|
1654 | image_max.width = container.width_interne; |
---|
1655 | image_max.height = image_max.width / Zone_image.image_init.rapport; |
---|
1656 | width_theMainImage = Math.ceil(image_max.width); |
---|
1657 | height_theMainImage = Math.ceil(image_max.height); |
---|
1658 | |
---|
1659 | } else if (width_theMainImage > container.width) { |
---|
1660 | |
---|
1661 | } else { |
---|
1662 | |
---|
1663 | } |
---|
1664 | } |
---|
1665 | //================================================================= |
---|
1666 | Zone_image.image = { |
---|
1667 | width: width_theMainImage, |
---|
1668 | height: height_theMainImage, |
---|
1669 | rapport: width_theMainImage / height_theMainImage |
---|
1670 | }; |
---|
1671 | Zone_image.marges = { width: marge_left + marge_right + retrait_img.width, |
---|
1672 | height: marge_top + marge_bottom + retrait_img.height |
---|
1673 | } |
---|
1674 | Zone_image.src = jQuery(theMainImage_id).attr("src"); |
---|
1675 | } |
---|
1676 | |
---|
1677 | /********************************************* |
---|
1678 | * Calcul les dimensions. |
---|
1679 | *********************************************/ |
---|
1680 | Get_dimensions = function (force, parametres) { |
---|
1681 | new_img = jQuery(theMainImage_id).infos({ absolute: true }); |
---|
1682 | new_dim = jQuery(theImage_id).infos({ absolute: true }); |
---|
1683 | new_win = jQuery(window).infos({ absolute: true }); // avec ascenseur |
---|
1684 | options.theImageTop = new_dim.top; |
---|
1685 | options.theImageLeft = new_dim.left; |
---|
1686 | options.theImageRight = (new_win.width - new_dim.right); |
---|
1687 | options.theImageBottom = new_win.height - new_dim.out.bottom; |
---|
1688 | options.marge_top = Math.ceil(new_img.top - new_dim.top); |
---|
1689 | options.marge_bottom = Math.ceil(new_dim.out.bottom - new_img.out.bottom); |
---|
1690 | if (options.theImageBottom < 0) { |
---|
1691 | options.theImageBottom = 0; |
---|
1692 | } |
---|
1693 | options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight; |
---|
1694 | options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop; |
---|
1695 | var chk = eval("options." + user_status + "_enabled"); |
---|
1696 | if (chk == "") { return; } |
---|
1697 | |
---|
1698 | if (Type_Img != "map") |
---|
1699 | Select_Image(); |
---|
1700 | infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true }); |
---|
1701 | Zone_image.src = infos_theMainImage.src; |
---|
1702 | useMap = options.pictureSelType; |
---|
1703 | /* |
---|
1704 | if (useMap) { |
---|
1705 | if (!useMap.match(RegExp("Autosize", "gi"))) { |
---|
1706 | if (typeof img_height != "undefined") { |
---|
1707 | jQuery(theImg).height(img_height); |
---|
1708 | jQuery(theImg).width(img_width); |
---|
1709 | } |
---|
1710 | return; |
---|
1711 | } |
---|
1712 | } |
---|
1713 | |
---|
1714 | if (options.imageAutosize) { |
---|
1715 | return true; //stripped |
---|
1716 | } |
---|
1717 | |
---|
1718 | if (typeof options.cl_visible == "undefined") return; |
---|
1719 | if (!options.cl_visible == true) { return; } |
---|
1720 | */ |
---|
1721 | |
---|
1722 | //================================================================= |
---|
1723 | switch (Type_Img) { |
---|
1724 | case "map": |
---|
1725 | if (Set_Map(true)) return false; |
---|
1726 | break |
---|
1727 | case "panorama": |
---|
1728 | if (!theMainImage_id) { |
---|
1729 | |
---|
1730 | } |
---|
1731 | infos_theImage = jQuery(theMainImage_id).infos(); |
---|
1732 | infos_the_page = jQuery("#the_page").infos(); |
---|
1733 | img_finale.height = infos_theImage.height; |
---|
1734 | break |
---|
1735 | case "img": |
---|
1736 | |
---|
1737 | |
---|
1738 | |
---|
1739 | |
---|
1740 | |
---|
1741 | break |
---|
1742 | case "img_autre": |
---|
1743 | if (!theMainImage_id) { |
---|
1744 | if (DEBUG_autosize.match("true", gi)) alert("The_MainImage=null"); |
---|
1745 | return; |
---|
1746 | |
---|
1747 | } |
---|
1748 | |
---|
1749 | infos_the_page = jQuery("#the_page").infos(); |
---|
1750 | |
---|
1751 | |
---|
1752 | break |
---|
1753 | case "embed": |
---|
1754 | // |
---|
1755 | if (infos_theMainImage.width == 0) |
---|
1756 | infos_theMainImage = jQuery("#thePicturePage").infos(); |
---|
1757 | if (infos_theMainImage.width == 0) |
---|
1758 | infos_theMainImage = jQuery("#the_page").infos(); |
---|
1759 | |
---|
1760 | |
---|
1761 | iph1 = jQuery("#theImage div").infos(); |
---|
1762 | |
---|
1763 | break |
---|
1764 | case "charlie": |
---|
1765 | |
---|
1766 | break |
---|
1767 | |
---|
1768 | case "iframe": |
---|
1769 | Zone_image.image.width = options.theImageWidth; |
---|
1770 | Zone_image.image.height = options.theImageHeight; |
---|
1771 | break |
---|
1772 | case "pamoorama": |
---|
1773 | Wait_pamoorama(); |
---|
1774 | break |
---|
1775 | } |
---|
1776 | |
---|
1777 | |
---|
1778 | |
---|
1779 | //================================================= |
---|
1780 | if (Zone_image.image.height < options.mini_height2) { |
---|
1781 | Zone_image.image.height = parseInt(options.mini_height2); |
---|
1782 | Zone_image.image.width = Math.ceil(Zone_image.image.height * Zone_image.image_init.rapport); |
---|
1783 | } |
---|
1784 | if (Zone_image.image.width < options.mini_width2) { |
---|
1785 | Zone_image.image.width = parseInt(options.mini_width2); |
---|
1786 | Zone_image.image.height = Math.ceil(Zone_image.image.width / Zone_image.image_init.rapport); |
---|
1787 | } |
---|
1788 | //================================================== |
---|
1789 | // ImageWidthidth largeur à atteindre |
---|
1790 | // Calcul du rapport d'agrandissement |
---|
1791 | |
---|
1792 | echelle_max = parseFloat(options.echelle_max, '3'); |
---|
1793 | if (Zone_image.zoom > echelle_max) { |
---|
1794 | Zone_image.zoom = echelle_max; |
---|
1795 | Zone_image.image.width = parseInt(Zone_image.image_init.width * Zone_image.zoom); |
---|
1796 | if (Zone_image.image_init.rapport > 0) |
---|
1797 | Zone_image.image.height = parseInt(Zone_image.image_init.width / Zone_image.image_init.rapport); |
---|
1798 | } |
---|
1799 | if (Type_Img != "pamoorama") { |
---|
1800 | mxi = Math.ceil(Zone_image.image.height + Zone_image.marges.height); |
---|
1801 | Zone_image.container.height = Math.max(Zone_image.container.height, mxi); |
---|
1802 | } |
---|
1803 | img_finale = { width: Zone_image.image.width, height: Zone_image.image.height }; |
---|
1804 | return true; |
---|
1805 | } |
---|
1806 | //________________ Get_dimensions ___________________ |
---|
1807 | |
---|
1808 | |
---|
1809 | /***************************** |
---|
1810 | * init_gen |
---|
1811 | *****************************/ |
---|
1812 | init_gen = function (e) { |
---|
1813 | theImg = document.getElementById(theMainImage_id.replace("#", "")); |
---|
1814 | //================================================== |
---|
1815 | marges_llgbo = 0; |
---|
1816 | options.marges_llgbo = 0; |
---|
1817 | if (jQuery(llgbo_id).length > 0) { |
---|
1818 | infos_llgbo = jQuery(llgbo_id).infos(true); |
---|
1819 | if (infos_llgbo.visible == true) { |
---|
1820 | if (infos_llgbo.height > 0) { |
---|
1821 | infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos(); |
---|
1822 | infos_llgboframe31 = jQuery(llgbo_id + " div:first").infos(); |
---|
1823 | //============================================= |
---|
1824 | ll2 = infos_llgboframe1.width; // llgboframe1 |
---|
1825 | ll1 = infos_llgboframe31.general.width; // llgboframe31 |
---|
1826 | options.marges_llgbo = (ll1 - ll2); |
---|
1827 | infos_llgboh2 = jQuery("#llgboh2").infos(); |
---|
1828 | } |
---|
1829 | } |
---|
1830 | |
---|
1831 | marges_llgbo = options.marges_llgbo; |
---|
1832 | } |
---|
1833 | |
---|
1834 | //========= Récupération des informations ============= |
---|
1835 | |
---|
1836 | options.marge_top = 0; |
---|
1837 | pAll = jQuery(llgbo_id).absoluteAll({ absolute: true }); |
---|
1838 | infos_llgbo.top = pAll.Top; |
---|
1839 | infos_llgbo.bottom = pAll.Bottom; |
---|
1840 | pAll = jQuery(theMainImage_id).absoluteAll({ absolute: true }); |
---|
1841 | pos_top = pAll.Top; ; |
---|
1842 | pos_bottom = pAll.Bottom; ; |
---|
1843 | |
---|
1844 | if (infos_llgbo.top > 0) { |
---|
1845 | pos_top = infos_llgbo.top; |
---|
1846 | |
---|
1847 | options.marge_top = infos_theMainImage.top - infos_theImage.top; |
---|
1848 | } else |
---|
1849 | pos_top = infos_theImageAndInfos.top; |
---|
1850 | |
---|
1851 | options.pos_top = pos_top; |
---|
1852 | options.marge_left = infos_theImage.general.marges.left + Math.ceil(options.marge_gauche); |
---|
1853 | options.marge_right = infos_theImage.general.marges.right + Math.ceil(options.marge_droite); |
---|
1854 | options.marge_top += infos_theImage.general.marges.top + infos_content.general.marges.top + Math.ceil(options.marge_haute); |
---|
1855 | options.marge_bottom = Math.ceil(options.marge_basse); // +infos_content.general.marges.bottom; ; |
---|
1856 | if (options.pictureDeriv == null) |
---|
1857 | options.first = true; |
---|
1858 | else |
---|
1859 | options.first = false; |
---|
1860 | //=================== Gestion liste photos size ============================ |
---|
1861 | us = 0; |
---|
1862 | if (!options.theMainImageWidth) options.theMainImageWidth = options.scaledWidth; |
---|
1863 | if (!options.theMainImageHeight) options.theMainImageHeight = options.scaledHeight; |
---|
1864 | |
---|
1865 | if (options.first) { |
---|
1866 | if (options.pictureDeriv) { |
---|
1867 | |
---|
1868 | pictureSelType = options.pictureSelType; |
---|
1869 | options.pictureMap = options.pictureDeriv; |
---|
1870 | |
---|
1871 | } else { |
---|
1872 | IMg = Get_Maxi(Zone_image.image); |
---|
1873 | options.pictureDeriv = IMg.pictureDeriv; |
---|
1874 | imgSrc = IMg.url; |
---|
1875 | width = IMg.width; |
---|
1876 | height = IMg.height; |
---|
1877 | options.pictureDeriv = IMg.pictureDeriv; |
---|
1878 | options.pictureMap = IMg.pictureMap; |
---|
1879 | } |
---|
1880 | } |
---|
1881 | if (pictureSelType_user != options.pictureSelType) { |
---|
1882 | /* |
---|
1883 | user_status = options.user_status; |
---|
1884 | pictureSelType_user = eval("options." + user_status + "_type"); //limite taille |
---|
1885 | */ |
---|
1886 | pictureDeriv_user = options.pictureDeriv; |
---|
1887 | options.pictureDeriv_user = pictureDeriv_user; |
---|
1888 | pictureSelType = options.pictureSelType; |
---|
1889 | } |
---|
1890 | //========================================================== |
---|
1891 | href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "SelMaxi" + "')"; |
---|
1892 | spans = jQuery("#derivativeCheckedSelMaxi").next(); |
---|
1893 | spans.attr("href", href_path); |
---|
1894 | spans.attr("name", "SelMaxi"); |
---|
1895 | spans = spans.find("span"); |
---|
1896 | spans.attr("name", "SelMaxi"); |
---|
1897 | spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")"); |
---|
1898 | //========================================================== |
---|
1899 | href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "Autosize" + "')"; |
---|
1900 | |
---|
1901 | spans = jQuery("#derivativeCheckedAutosize").next(); |
---|
1902 | spans.attr("href", href_path); |
---|
1903 | spans.attr("name", "Autosize"); |
---|
1904 | spans = spans.find("span"); |
---|
1905 | spans.attr("name", "Autosize"); |
---|
1906 | spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")"); |
---|
1907 | //========================================================== |
---|
1908 | |
---|
1909 | if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") { |
---|
1910 | spans = jQuery("#derivativeChecked" + options.pictureSelType).next(); |
---|
1911 | spans.addClass("linkAutosize"); |
---|
1912 | spans.find("span").addClass("auto_details"); |
---|
1913 | } |
---|
1914 | pictureDeriv = options.pictureDeriv; |
---|
1915 | Autosize_resize(true, options); |
---|
1916 | Autosize_resize(true, options); |
---|
1917 | return; |
---|
1918 | |
---|
1919 | IMg = Get_Maxi(Zone_image.image); |
---|
1920 | imgSrc = IMg.url; |
---|
1921 | |
---|
1922 | width = IMg.width; |
---|
1923 | height = IMg.height; |
---|
1924 | |
---|
1925 | n = 0; |
---|
1926 | var pt = new Array(); |
---|
1927 | |
---|
1928 | |
---|
1929 | //uyu = jQuery(uyu + " span"); |
---|
1930 | // |
---|
1931 | |
---|
1932 | // auto_details |
---|
1933 | //==== limite affichage selection = pictureSelType ==== |
---|
1934 | jQuery("#derivativeSwitchBox a").css('visibility', 'hidden'); |
---|
1935 | jQuery("#derivativeSwitchBox a").each(function (i) { |
---|
1936 | href_path = jQuery(this).attr("href"); |
---|
1937 | pt[i] = href_path.split("'"); |
---|
1938 | tsz = pt[i][5]; |
---|
1939 | |
---|
1940 | jQuery(this).css('visibility', 'visible'); |
---|
1941 | //--- recherche limite --- |
---|
1942 | if (tsz.match(RegExp(pictureSelType_user, "gi"))) { |
---|
1943 | if (tsz.match(RegExp(options.pictureSelType, "gi"))) { |
---|
1944 | us = n; |
---|
1945 | } else { |
---|
1946 | return false; |
---|
1947 | } |
---|
1948 | } |
---|
1949 | //--- type en cours --- |
---|
1950 | if (tsz.match(RegExp("^" + pictureDeriv, "gi"))) { |
---|
1951 | us = n; |
---|
1952 | } |
---|
1953 | |
---|
1954 | n++; |
---|
1955 | }); |
---|
1956 | jQuery(".switchCheck").css('visibility', 'hidden'); |
---|
1957 | jQuery("derivativeChecked" + pictureSelType_user).css('visibility', 'visible'); |
---|
1958 | /* */ |
---|
1959 | //==== en cours ============ |
---|
1960 | if (options.imgSrc) { |
---|
1961 | changeImgSrc(options.imgSrc, options.pictureDeriv, options.pictureDeriv, options.pictureSelType); |
---|
1962 | imgSrc = options.imgSrc; |
---|
1963 | } |
---|
1964 | |
---|
1965 | href_path = ""; |
---|
1966 | |
---|
1967 | }; |
---|
1968 | //_______________________ init_gen _______________________ |
---|
1969 | |
---|
1970 | |
---|
1971 | /********************************************* |
---|
1972 | * DEBUG .... |
---|
1973 | *********************************************/ |
---|
1974 | /* |
---|
1975 | if (DEBUG_autosize.match("true",gi)) { |
---|
1976 | for (var i = 0; i < 10; i++) { |
---|
1977 | jQuery('#adddebugs').click(); |
---|
1978 | } |
---|
1979 | jQuery(jQuery('.debug').get(i - 1)).click(); |
---|
1980 | } |
---|
1981 | */ |
---|
1982 | |
---|
1983 | // Custom Event, ON to turn on a debug. |
---|
1984 | jQuery('.debug').live('ON', function (e) { |
---|
1985 | |
---|
1986 | nu_img = jQuery(this).text(); |
---|
1987 | jQuery('.debug').trigger('OFF'); |
---|
1988 | jQuery(this).addClass('debugOn'); |
---|
1989 | |
---|
1990 | }); |
---|
1991 | |
---|
1992 | // On Click = debugs On |
---|
1993 | jQuery('.debug').live('click', function (e) { |
---|
1994 | i = jQuery(this).text(); |
---|
1995 | jQuery(this).trigger('ON'); |
---|
1996 | }); |
---|
1997 | |
---|
1998 | // Custom Event, Turn off a debug |
---|
1999 | jQuery('.debug').live('OFF', function (e) { |
---|
2000 | jQuery(this).removeClass('debugOn'); |
---|
2001 | }); |
---|
2002 | |
---|
2003 | // on Double Click, remove the debug from the DOM |
---|
2004 | jQuery('.debug').live('dblclick', function () { |
---|
2005 | jQuery(this).fadeOut(function () { jQuery(this).remove() }); |
---|
2006 | }); |
---|
2007 | |
---|
2008 | // Add another debug to the DOM |
---|
2009 | jQuery('#adddebugs').click(function () { |
---|
2010 | i = jQuery('.debug').length; |
---|
2011 | jQuery('<div>' + i + '</div>') |
---|
2012 | .addClass('debug') |
---|
2013 | .appendTo('#debugsContainer'); |
---|
2014 | }); |
---|
2015 | |
---|
2016 | |
---|
2017 | |
---|
2018 | if (DEBUG_autosize.match("mouse", "gi")) { |
---|
2019 | var mouseLocation = new Point(-500, -500); |
---|
2020 | function Point(x, y) { |
---|
2021 | this.x = x; this.y = y; |
---|
2022 | } |
---|
2023 | register_position(); |
---|
2024 | |
---|
2025 | function register_position() { |
---|
2026 | mouse_x = 0; |
---|
2027 | mouse_y = 0; |
---|
2028 | // document.onmousemove = position; |
---|
2029 | |
---|
2030 | } |
---|
2031 | |
---|
2032 | function position(evt) { |
---|
2033 | if (!evt) evt = window.event; |
---|
2034 | mouseLocation.x = evt.clientX; |
---|
2035 | mouseLocation.y = evt.clientY; |
---|
2036 | } |
---|
2037 | |
---|
2038 | jQuery("div,a,img").mousemove(function (evt) { |
---|
2039 | |
---|
2040 | if (!evt) evt = window.event; |
---|
2041 | mouseLocation.x = evt.clientX; |
---|
2042 | mouseLocation.y = evt.clientY; |
---|
2043 | Context = jQuery(this).context.nodeName; |
---|
2044 | obj_id = "#" + this.id.toString(); |
---|
2045 | infos_g = jQuery(obj_id).infos(true); |
---|
2046 | infos_g.top = jQuery(obj_id).absoluteTop(); |
---|
2047 | wg = jQuery("body").width() - infos_g.right; |
---|
2048 | |
---|
2049 | affiche_debug({ |
---|
2050 | |
---|
2051 | Debug1: Debug_info(1, "x:" + mouseLocation.x |
---|
2052 | + " y: " + mouseLocation.y |
---|
2053 | + " id: " + obj_id |
---|
2054 | + " top: " + infos_g.top, |
---|
2055 | +" Node: " + Context |
---|
2056 | , "->") |
---|
2057 | , |
---|
2058 | Debug2: Debug_info(2, "W:" + infos_g.general.width |
---|
2059 | + " H: " + infos_g.general.height |
---|
2060 | + " right: " + (wg) |
---|
2061 | + " left: " + infos_g.left |
---|
2062 | + " Node: " + Context |
---|
2063 | , "->") |
---|
2064 | }); |
---|
2065 | |
---|
2066 | }); |
---|
2067 | |
---|
2068 | } |
---|
2069 | |
---|
2070 | |
---|
2071 | //======================================================================================= |
---|
2072 | Debug_info = function (index, infos, Nom_str) { |
---|
2073 | if (typeof infos == "undefined") return; |
---|
2074 | width_g = Math.ceil(jQuery("body").width() / 5) - 10; |
---|
2075 | if (typeof infos.height != "undefined") { |
---|
2076 | message = " -- > Info : " + Nom_str + " " + infos.id + "\n" + |
---|
2077 | "Info nodeName: " + infos.nodeName + "\n" + |
---|
2078 | "Info width: " + infos.width + "\n" + |
---|
2079 | "Info height: " + infos.height + "\n" + |
---|
2080 | "Info top: " + infos.top + "\n" + |
---|
2081 | "Info left: " + infos.left + "\n" + |
---|
2082 | "Info position: " + infos.position + "\n"; |
---|
2083 | |
---|
2084 | myDebug = { id: "Debug" + index, texte: message, |
---|
2085 | css: { |
---|
2086 | color: "black", |
---|
2087 | opacity: "1", |
---|
2088 | position: "absolute", |
---|
2089 | height: infos.height || pos_top - 30 + "px", |
---|
2090 | width: infos.width || width_g + "px", |
---|
2091 | left: infos.left || 0 + "px", |
---|
2092 | border: "solid 1px green", |
---|
2093 | top: infos.top + "px" |
---|
2094 | } |
---|
2095 | } |
---|
2096 | return myDebug; |
---|
2097 | |
---|
2098 | } else { |
---|
2099 | if (typeof old_messages == "undefined") { |
---|
2100 | old_messages = new Array(); |
---|
2101 | |
---|
2102 | } |
---|
2103 | if (infos != "" && infos != "undefined") { |
---|
2104 | nc0 = old_messages[index] || ""; |
---|
2105 | if (typeof nc0 != "undefined") { |
---|
2106 | nc0 = nc0.toString().split("<br />"); |
---|
2107 | if (nc0.length > 4) nc0.shift(); |
---|
2108 | old_messages[index] = nc0.join("<br />"); |
---|
2109 | } |
---|
2110 | old_messages[index] += "" + Nom_str + "->" + infos + "<br />"; |
---|
2111 | message = old_messages[index]; |
---|
2112 | colors = Array('black', 'white', 'white', 'white', 'white', 'white', 'red'); |
---|
2113 | myDebug = { id: "Debug" + index, texte: message, |
---|
2114 | css: { display: "block", |
---|
2115 | color: colors[index - 1], |
---|
2116 | opacity: "1", |
---|
2117 | position: "absolute", |
---|
2118 | align: "left", |
---|
2119 | height: 80 + "px", |
---|
2120 | width: width_g + "px", |
---|
2121 | left: ((index - 1) * width_g) + "px", |
---|
2122 | border: "solid 1px green", |
---|
2123 | top: 0 + "px" |
---|
2124 | } |
---|
2125 | } |
---|
2126 | return myDebug; |
---|
2127 | } |
---|
2128 | } |
---|
2129 | |
---|
2130 | |
---|
2131 | } //Debug_info |
---|
2132 | //==================================================== |
---|
2133 | affiche_debug = function (aff_infos) { |
---|
2134 | jQuery(jQuery("[id ^='Debug']")).each(function (i) { |
---|
2135 | if (aff_infos[this.id]) { |
---|
2136 | if (aff_infos[this.id].css) { |
---|
2137 | jQuery("#" + this.id).css(aff_infos[this.id].css); |
---|
2138 | jQuery("#" + this.id).html(aff_infos[this.id].texte); |
---|
2139 | } |
---|
2140 | } |
---|
2141 | }); |
---|
2142 | return; |
---|
2143 | } |
---|
2144 | //___________ affiche_debug ____ |
---|
2145 | //==================================================== |
---|
2146 | function Debug_pos() { |
---|
2147 | return; |
---|
2148 | if (DEBUG_autosize.match("true", gi)) { |
---|
2149 | |
---|
2150 | jQuery("[id ^='Debug']").show(); |
---|
2151 | /* |
---|
2152 | Debug2 background-color:yellow |
---|
2153 | Debug3 background-color:blue |
---|
2154 | Debug4 background-color:green |
---|
2155 | Debug5 background-color:red |
---|
2156 | |
---|
2157 | */ |
---|
2158 | |
---|
2159 | affiche_debug({ |
---|
2160 | Debug5: Debug_info(5, infos_theMainImage, "infos_theMainImage") |
---|
2161 | }); |
---|
2162 | } |
---|
2163 | } // Debug_pos |
---|
2164 | //========================================================== |
---|
2165 | |
---|
2166 | |
---|
2167 | |
---|
2168 | |
---|
2169 | |
---|
2170 | |
---|
2171 | |
---|
2172 | |
---|
2173 | |
---|
2174 | }); // ready |
---|
2175 | |
---|
2176 | |
---|
2177 | jQuery("#derivativeSwitchBox a").click(function (e) { |
---|
2178 | k1 = 0; |
---|
2179 | }); |
---|