source: extensions/Autosize/js/Affiche_script.js @ 10913

Last change on this file since 10913 was 10913, checked in by cljosse, 13 years ago

[extensions] autosize compatibility with pamooramics & gmaps

File size: 53.9 KB
Line 
1Parent = "#theImage";
2function Toggle_bp() {
3    cl_visible = !cl_visible;
4    if (cl_visible) src = src1;
5    else src = src2;
6    if (cl_visible) src_info = src3;
7    else src_info = src4;
8
9    jQuery('#bp_cla').attr('alt', src_info);
10    jQuery('#bp_cla').attr('title', src_info);
11
12    jQuery('#bp_img_cla').get(0).src = src;
13    jQuery('#bp_img_cla').attr('alt', src_info);
14    jQuery('#bp_img_cla').attr('title', src_info);
15    jQuery('#bp_cla').attr('Stitle', src_info);
16    jQuery('#bp_cla').attr('Stip', " ");
17    jQuery().newResize();
18
19}
20nu_img = 0;
21tempo=0;
22
23function Wait_pamoorama() {
24    if (jQuery("#pamoorama").length) {
25        mypanorama = window.myPamoorama;
26        if (!mypanorama) {
27          tempo = tempo + 1;
28          if (tempo > 10) 
29          return true;
30
31            setTimeout("Wait_pamoorama()", 500);
32            return false;
33        }
34        if (mypanorama.skipInit == false) {
35            setTimeout("Wait_pamoorama()", 500);
36            return false;
37        }
38        info_pamoorama = jQuery("#pamoorama").infos();
39        new_width = info_pamoorama.width - (info_pamoorama.borderwidth.left + info_pamoorama.borderwidth.right);
40        if (Math.abs(new_width - myPamoorama.options.width) > 10) {
41            setTimeout("Wait_pamoorama()", 500);
42            return false;
43        }
44
45        nopano = true;
46        old_window = { width: 0, height: 0 };
47        jQuery('#pamoorama').trigger('ON');
48
49    }
50}
51
52
53//==========================================================================
54function Wait_Affichage() {
55    fade_in = parseInt(fade_in);
56    if (!jQuery().newResize()) {
57        setTimeout("Wait_Affichage()", 500);
58        return
59    }
60    nu_img++;
61
62    if (fade_in == 0) {
63        jQuery(Parent).css({ opacity: "1" });
64    } else {
65        jQuery(Parent).animate({ opacity: "1" },
66                                         fade_in, "swing",
67                                         function (i) {
68                                             jQuery(Parent).css({ opacity: "1" });
69                                             if (DEBUG_autosize == "true") {
70                                                 bp1 = jQuery('.debug').get(nu_img);
71                                                 if (!bp1) nu_img = 0;
72                                                 bp1 = jQuery('.debug').get(nu_img);
73                                                 jQuery(bp1).trigger('ON');
74                                             }
75                                         }
76                                       );
77
78    }
79    //   if (nu_img > 1) return;
80
81
82
83    img_h = jQuery(TheImg).height();
84    img_w = jQuery(TheImg).width();
85
86    jQuery("#src_img_h").val(img_h);
87    jQuery("#src_img_w").val(img_w);
88    jQuery("#ret_autosize").val(src_img);
89    if (typeof Window_Affichage =="undefined" ) {
90        Window_Affichage = { height: Zone_Affichage.height,
91            width: Zone_Affichage.width
92        };
93    }
94    jQuery("#window_height").val(Window_Affichage.height);
95    jQuery("#window_width").val(Window_Affichage.width);
96    jQuery("#ret_autosize").trigger('ON', { width: img_w,
97        height: img_h,
98        theImage: TheImg,
99        src_img: src_img,
100        window_height: Window_Affichage.height,
101        window_width: Window_Affichage.width
102    });
103
104
105}
106
107//=====================================================================
108
109List_autosize = new Array();
110function Autosize_resize(Obj) {
111    if (typeof cl_visible != "undefined") return;
112
113
114    conf = jQuery(Obj).get(0).conf;
115    Obj = jQuery(Obj).get(0).obj;
116    myWindow = jQuery("#" + conf.parent).infos();
117
118    if (myWindow.width == 0) myWindow = jQuery(window).infos();
119    marge_basse = 0;
120    if (conf.MargeBasse)
121        marge_basse = jQuery().Get_Val_int(
122            conf.MargeBasse
123    );
124    marge_top = 0;
125    if (conf.MargeHaute)
126        marge_top = jQuery().Get_Val_int(
127            conf.MargeHaute
128    );
129
130    info_Obj = jQuery(Obj).infos();
131    h1_left = jQuery(Obj).absoluteLeft();
132    h1_top = jQuery(Obj).absoluteTop();
133
134    if (h1_top < info_Obj.height)
135        h1 = (myWindow.height - h1_top - marge_basse - marge_top);
136    else
137        h1 = (myWindow.height - marge_basse);
138
139
140    rap = info_Obj.height / info_Obj.width;
141    w2 = parseInt(h1 / rap);
142
143    if (w2 < info_Obj.width)
144        marginLeft = info_Obj.left + parseInt((info_Obj.width - w2) / 2) + "px";
145    else
146        marginLeft = "auto";
147
148    jQuery(Obj).css({ width: "auto", marginTop: marge_top,
149        marginLeft: "auto", marginBottom: 0 + "px",
150        verticalAlign: "middle", textAlign: "center"
151    });
152    jQuery(Obj).height(h1);
153
154    //=============================================================
155    if (conf.ResizePicture != "true") {
156
157    } else
158        imgs = jQuery(Obj).find("img");
159    Obj_w = jQuery(Obj).width();
160    Obj_h = jQuery(Obj).height();
161
162    jQuery(imgs).each(function (i) {
163        img = jQuery(this);
164
165        info_img = { width: conf.width[i], height: conf.height[i] };
166        img_rap = conf.rap[i];
167
168        if (info_img.width > Obj_w) h1 = parseInt(Obj_w / img_rap);
169        else w2 = parseInt(Obj_h * img_rap);
170        if (w2 > 0 && h1 > 0 && img.length > 0) {
171            img.height(h1);
172            img.width(w2);
173        }
174
175    });
176
177
178
179
180}
181jQuery.extend(jQuery.expr[':'], {
182    // Nom du sélecteur personnalisé
183    Autosize: function (a) {
184        n1 = a.className;
185        // personal_block
186        if (n1.match(RegExp("autosize", "gi"))) {
187            //   autoresize = "MargeBasse:30px; ResizePicture:false"
188            infconf = jQuery(a).attr("autosize");
189            n1 = typeof infconf;
190            conf = { MargeBasse: 0, NoPicture: false }
191            if (n1 == "undefined") {
192
193            } else {
194                tableau = infconf.split(";");
195                for (var i = 0; i < tableau.length; i++) {
196                    tableau2 = tableau[i].split(":");
197                    conf[jQuery.trim(tableau2[0])] = jQuery.trim(tableau2[1]);
198                }
199                imgs = jQuery(a).find("img");
200                rap = new Array();
201                width = new Array();
202                height = new Array();
203                jQuery(imgs).each(function (i) {
204                    img = jQuery(this);
205                    rap.push((img.width() / img.height()));
206                    width.push(img.width());
207                    height.push(img.height());
208                });
209
210                conf['rap'] = rap;
211                conf['width'] = width;
212                conf['height'] = height;
213
214                List_autosize.push({ obj: a, conf: conf });
215                jQuery(a).css({ opacity: 1 });
216            }
217        }
218        //  Css = jQuery(a).getStyles(a);
219
220        return false;
221
222    }
223});
224
225
226function List_autosize_resize(event, ui) {
227    if (typeof wait_resize == "undefined") wait_resize = false;
228    if (wait_resize == true) return;
229
230    wait_resize = true;
231    if (List_autosize.length == 0) return;
232    for (i = 0; i < List_autosize.length; i++) {
233        Autosize_resize(jQuery(List_autosize[i]));
234    }
235    wait_resize = false;
236
237}
238//==============================================================
239jQuery(document).ready(
240     function (jQuery) {
241       jQuery(':Autosize');
242
243       jQuery(window).unload(function () {
244         try {
245           if (TheImg) {
246             jQuery.cookie('img', TheImg.src); // créer un cookie avec une valeur
247             jQuery.cookie('img_h', jQuery(TheImg).height());
248             jQuery.cookie('img_w', jQuery(TheImg).width());
249             jQuery.cookie('window_height', Window_Affichage.height);
250             jQuery.cookie('window_width', Window_Affichage.width);
251           }
252         } catch (r) {
253
254         }
255
256       });
257
258       jQuery(window).resize(
259               function (event, ui) {
260                 List_autosize_resize(event, ui);
261                 jQuery().newResize();
262               });
263
264       jQuery(window).load(function () {
265         if (typeof img_width == "undefined") {
266
267           if (List_autosize.length == 0) return;
268           for (i = 0; i < List_autosize.length; i++) {
269             Autosize_resize(jQuery(List_autosize[i]));
270           }
271
272           return;
273         }
274         //=========================================================
275         if (typeof (options) == "undefined") {
276           options = { imageAutosizeMargin: 0, imageAutosize: false }
277         }
278
279         old_img = jQuery.cookie('img');
280         old_img_h = jQuery.cookie('img_h');
281         old_img_w = jQuery.cookie('img_w');
282         old_window_height = jQuery.cookie('window_height');
283         old_window_width = jQuery.cookie('window_width');
284
285         //============================================================
286         img_init = { height: img_height, width: img_width };  // taille initiale
287         img_defaut = { height: scaled_height, width: scaled_width };
288         img_reelle = { height: img_height, width: img_width };
289         img_finale = { height: 0, width: 0 };
290
291         img_top = "0";
292         rapport = -1;
293         marges_llgbo = 0;
294
295         //=============================================================
296         Type_Img = "";
297         TheImg = null;
298         nopano = false;
299
300         Zone_Affichage = { height: 0, width: 0 };
301         //============================================================
302         jQuery("#the_page").css({ top: "0px" });
303
304         Info_the_page = jQuery("#the_page").infos();
305         info_HeaderBar = jQuery("#imageHeaderBar").infos();
306
307         Parent = "#theImage";
308
309         Zone_Affichage = jQuery(Parent).infos();
310         //
311         var old_window = { width: 0, height: 0 };
312
313         Bandeau_bas = Info_Description_f(Parent);
314         if (typeof Bandeau_bas != "undefined") Bandeau = Bandeau_bas.top;
315         else Bandeau = 0;
316         if (typeof Bandeau_bas == "undefined") { }
317         old_window = { width: 0, height: 0 };
318         jQuery("#theImage").trigger('ON');
319
320         old_window = { width: 0, height: 0 };
321         jQuery().newResize();
322
323         //===================================================================
324         /*
325         * window .resize
326         */
327         jQuery(window).resize(
328               function (event, ui) {
329                 jQuery().newResize();
330               });
331
332         //============== initialisation ===================
333
334         var pos;
335         var set_p = false;
336
337
338       }); // window.onload
339
340       /* Extension
341       * affiche_debug
342
343       * resize
344       * :
345       */
346       //=========================================================
347       old_window = { width: 0, height: 0 };
348
349       jQuery.fn.extend({
350         //==========================================================
351         Info_description: function (e) {
352           return Info_Description_f(e);
353
354         },
355         //=============================================================
356         onPropertyChange: function (e) {
357           return;
358
359
360         },
361         /*
362         * recherche la plus grande image (hauteur ou largeur)
363         */
364         Get_Img_Maxi: function (myobj) {
365           return Get_Img_Maxi(myobj);
366         },
367         //============================================================
368         affiche_debug: function (aff_infos) {
369           affiche_debug(aff_infos);
370         },
371         //====================================================
372         newResize: function () {
373           //
374           //if (options.imageAutosize) return true ;stripped
375           if (DEBUG_autosize == "true") {
376             nu_img += 1;
377
378             bp1 = jQuery('.debug').get(nu_img);
379             if (!bp1) nu_img = 0;
380             bp1 = jQuery('.debug').get(nu_img);
381
382             jQuery(bp1).trigger('ON');
383           }
384           if (typeof cl_visible == "undefined") return;
385           if (!cl_visible == true) { return true; }
386           var chk = eval(user_status + "_enabled");
387           if (chk == "") { return true; }
388           //=================================================================
389           var winwidth = jQuery(window).width();
390           var winheight = jQuery(window).height();
391           n = winwidth - old_window.width;
392           if (Math.abs(n) < 1) {
393             n = winheight - old_window.height;
394             if (Math.abs(n) < 1)
395               return true;
396           }
397           if (Math.abs(n) > 30) nu_img = 0;
398           //if (nu_img > 10) return true;
399           old_window = jQuery(window).infos();
400           //===========================================================================
401
402           jQuery(Parent).width(winwidth);
403           jQuery(Parent).height(winheight);
404
405           var Cadre = jQuery(Parent).get(0);
406           var info_theImage = jQuery(Cadre).infos();
407           //===============  Information cadre ======
408           var info_the_page = jQuery("#the_page").infos();
409           //=============================================================================
410
411           var info_content = jQuery("#content").infos();
412           var info_titrePage = jQuery("#titrePage").infos();
413           var info_imageInfoBar = jQuery("#imageInfoBar").infos();
414           var info_theHeader = jQuery("#theHeader").infos();
415
416           var Zone_Affichage = jQuery(Parent).infos();
417           var info_ToolBar = jQuery("#imageToolBar").infos();
418           var marge = 0;
419           var marge_right = 0;
420           var marge_left = 0;
421           if (theme.match(RegExp("simple", "g"))) {
422             if (info_ToolBar.width > 0)
423               marge = (Zone_Affichage.width - info_ToolBar.width) / 2;
424             else if (info_the_page.width > 0)
425               marge = (Zone_Affichage.width - info_the_page.width) / 2;
426
427             marge_right = marge;
428             marge_left = marge;
429
430             if (info_content.width > 100) {
431
432               marge_left = (info_imageInfoBar.margin.left) + 1;
433               marge_right = (marge_left + info_imageInfoBar.margin.right) + 1;
434               winwidth = info_content.width;
435               marge_right = info_imageInfoBar.width + marge_right;
436
437             }
438           } else {
439             if (theme.match(RegExp("stripped", "gi"))) {
440
441               marge = (info_the_page.width - info_HeaderBar.width) / 2;
442               marge_right = marge;
443               marge_left = marge;
444             } else if (info_ToolBar.width > 0) {
445               marge = (info_the_page.width - info_ToolBar.width) / 2;
446
447               marge_right = marge + info_the_page.left;
448               marge_left = marge;
449
450             }
451             winwidth = info_the_page.width;
452           }
453
454
455
456           marge_right += Zone_Affichage.borderwidth.right;
457           marge_left += Zone_Affichage.borderwidth.left;
458           winwidth -= (marge_right + marge_left);
459           //---------------------------------------------
460           jQuery(Parent).width(winwidth);
461           jQuery(Parent).css({ height: "auto" });
462
463           //  jQuery(Parent).height(Zone_Affichage.height);
464           //---------------------------------------------
465
466           if (Type_Img == "pamoorama") {
467
468             mypanorama = window.myPamoorama;
469             //============================================================
470             if (typeof (mypanorama) == "undefined") return false;
471             var myPamoorama = mypanorama;
472             if (typeof (myPamoorama.skipInit) == "undefined") return false;
473             //
474
475             if (myPamoorama.skipInit == false) {
476
477               return false;
478             }
479
480             var info_pamoorama = jQuery("#pamoorama").infos();
481             var info_pamoorama_outter = jQuery("#pamoorama_outter").infos();
482             var info_pamoorama_inner = jQuery("#pamoorama_inner").infos();
483             var info_pamoorama_footer = jQuery("#pamoorama_footer").infos();
484             var info_pamoorama_frame = jQuery("#pamoorama_frame").infos();
485             TheImg = jQuery("#pamoorama");
486             obj = TheImg.get(0);
487
488           } else {
489
490
491
492
493           }
494           //=================================================================
495
496
497           switch (Type_Img) {
498             case "map":
499               img_reelle.height = winheight; // info_img.height;
500               info_map = jQuery("#mapPicture").infos();
501               jQuery("#map").css("left", info_map.width + "px");
502               Bandeau_bas.height = 10;
503
504               if (theme.match(RegExp("simple", "g"))) {
505                 img_reelle.width = winwidth; //- info_map.width -marge_right;
506               } else {
507                 img_reelle.width = winwidth - info_map.width - marge_right;
508               }
509
510
511               info_the_page = jQuery("#the_page").infos();
512               winwidth = img_reelle.width;
513
514               ;
515
516               break
517
518
519             case "panorama":
520               // return;
521
522
523               TheImg = jQuery().Get_Img_Maxi("#Panorama img");
524               info_theImage = jQuery(TheImg).infos();
525               info_the_page = jQuery("#the_page").infos();
526
527               break
528             case "img":
529
530               if (!TheImg) return true;
531               if (theme.match(RegExp("luciano", "g"))) {
532                 TheImg = jQuery("#the_page #theImg");
533               }
534               info_theImage = jQuery(TheImg).infos();
535               info_the_page = jQuery("#the_page").infos();
536
537
538               break
539             case "img_autre":
540               if (!TheImg) {
541                 if (DEBUG_autosize == "true") alert("TheImg=null");
542                 return true;
543
544               }
545               info_theImage = jQuery(TheImg).infos();
546               info_the_page = jQuery("#the_page").infos();
547
548
549               break
550             case "embed":
551               //
552
553               info_theImage = info_img;
554               info_the_page = jQuery("#the_page").infos();
555
556               if (rapport < 0) {
557                 img_height = info_img.height;
558                 img_width = info_img.width;
559
560                 img_reelle.height = img_height;
561                 img_reelle.width = img_width;
562
563               }
564
565               break
566             case "charlie":
567
568
569               info_theImage = info_img;
570               info_the_page = jQuery("#the_page").infos();
571               if (rapport < 0) {
572                 img_height = parseInt(info_img.height);
573                 img_width = parseInt(info_img.width);
574
575                 img_reelle.height = parseInt(info_img.height);
576                 img_reelle.width = parseInt(info_img.width);
577               }
578
579               break
580             case "pamoorama":
581
582               img_reelle = { height: img_height, width: img_width };
583
584               //=========================================================
585               img_reelle.height = img_height;
586               img_reelle.width = Zone_Affichage.width;
587
588
589               TheImg = myPamoorama.image;
590               info_theImage = jQuery("#pamoorama").infos();
591               info_theImage.height = img_reelle.height;
592
593
594               info_the_page = jQuery("#the_page").infos();
595
596               break
597
598
599           }
600           MinWidth = jQuery(TheImg).css("minWidth");
601           if (MinWidth == "0px")
602             MinWidth = mini_width;
603           MinHeight = jQuery(TheImg).css("minHeight");
604           if (MinHeight == "0px")
605             MinHeight = mini_height;
606
607           MaxWidth = jQuery(TheImg).css("maxWidth");
608           if (MaxWidth == "0px")
609             MaxWidth = winwidth;
610           MaxHeight = jQuery(TheImg).css("maxHeight");
611           if (MaxHeight == "0px")
612             MaxHeight = mwinheight;
613
614           //=============== Vérification taille minimale  autorizée ======================
615           var miniWidth = jQuery(TheImg).Get_Val_int(MinWidth, mini_width);
616           var miniHeight = jQuery(TheImg).Get_Val_int(MinHeight, mini_height);
617           if (winwidth < mini_width2) mini_width2 = winwidth;
618
619           var miniWidth2 = jQuery(TheImg).Get_Val_int(MinWidth, mini_width2);
620           var miniHeight2 = jQuery(TheImg).Get_Val_int(MinHeight, mini_height2);
621
622
623           var maxWidth = jQuery(TheImg).Get_Val_int(MaxWidth, winwidth, "0");
624           maxHeight = jQuery(TheImg).Get_Val_int(MaxHeight, winheight, "0");
625
626
627           mini_width = parseInt(miniWidth);
628           mini_height = parseInt(miniHeight);
629
630           img_reelle.width = parseInt(img_reelle.width);
631           jQuery(Cadre).width(mini_width);
632           if (img_reelle.width < mini_width) {
633             jQuery(Cadre).width(mini_width);
634             return true;
635
636           }
637
638           img_reelle.height = parseInt(img_reelle.height);
639           if (img_reelle.height < parseInt(mini_height)) return true;
640           //==================================================================================
641           if (rapport < 0) {
642
643             img_init.height = parseInt(img_height);
644             img_init.width = parseInt(img_width);
645
646             rapport = img_width / img_height;
647
648             if (Type_Img != "map")
649               rapport = (img_init.width / img_init.height);
650             else
651               rapport = 0;
652
653           }
654
655
656           //=============== Zone d'affichage ============================
657
658           borderW = Zone_Affichage.borderwidth.left;
659           borderW += Zone_Affichage.borderwidth.right;
660
661
662           Zone_Affichage.width = winwidth - borderW;
663
664
665
666           var Licence = jQuery(".licencetag");
667           info_Licence = jQuery(".licencetag").infos();
668
669           jQuery(Parent + " #theImg IMG").css("marginTop", "0px")
670           //========== Correction en fonction du thème =============================
671           var correction = 0;
672           if (theme.match(RegExp("sobre", "g"))) {
673
674             //   correction = -info_Licence.padding.top;
675             if (Type_Img == 'img') {
676               if (msie == true) correction = 0;
677               else correction = 0;
678               correction = 10;
679             }
680
681           } else if (theme.match(RegExp("Pure", "g"))) {
682             correction += 0; //??
683           } else if (theme.match(RegExp("luciano", "g"))) {
684             correction = 0; //??
685
686           } else if (theme.match(RegExp("simple", "g"))) {
687             correction += 0; //??
688           } else if (theme.match(RegExp("gally", "g"))) {
689             correction += 0; //??
690
691           }
692
693           //====================================================
694           if (options.imageAutosizeMargin > 0) Marge_Basse = options.imageAutosizeMargin;
695           else Marge_Basse = parseInt(marge_basse || 0); // hors bandeau
696           //==========================================================================
697           h = 0;
698
699           h = (Zone_Affichage.padding.bottom + Zone_Affichage.padding.top + Zone_Affichage.margin.top + Zone_Affichage.margin.bottom);
700           Bandeau = Bandeau_t.img_top;
701           Zone_Affichage.height = winheight - Bandeau - Marge_Basse - correction - h;
702           //=========================================================================
703           if (Zone_Affichage.height < mini_height2)
704             Zone_Affichage.height = mini_height2;
705           if (Zone_Affichage.width < mini_width2)
706             Zone_Affichage.width = mini_width2;
707           //=========================================================================
708           if (typeof (Bandeau_bas) != "undefined") {
709             Zone_Affichage.height -= (Bandeau_bas.height + Bandeau_bas.marge.top + Bandeau_bas.marge.bottom);
710
711
712           } else {
713
714           }
715
716           var Image_height = Zone_Affichage.height;
717
718           //=============================================================
719           var height_user = eval(user_status + "_height");
720           var reg1 = new RegExp("%", "g");
721           if (height_user.match(reg1))
722             Image_height = Image_height * parseInt(height_user) / 100;
723           else
724             Image_height = parseInt(height_user);
725
726           echelle_max = parseFloat(echelle_max, '3');
727           var echelle = parseFloat(Image_height / img_reelle.height, 3);
728
729           if (echelle > echelle_max) { echelle = echelle_max; }
730           Image_height = parseInt(img_reelle.height * echelle);
731           //============================================================
732
733           var Image_width;
734           if (rapport > 0)
735             Image_width = parseInt(Image_height * rapport);
736           else if (Type_Img == "map") {
737             Image_width = Zone_Affichage.width - marge_left - marge_right;
738           } else {
739             Image_width = Zone_Affichage.width;
740           }
741
742           //===============================================================
743           align_auto = "center";
744           if (jQuery("#theImg").css("textAlign"))
745             align_auto = jQuery("#theImg").css("textAlign");
746           var widthmin = winwidth;
747
748           if (check_auto_w == 'checked="checked"') {
749             // if (Type_Img != "pamoorama" && Type_Img != "panorama" ) {
750             //==== largeur à atteindre ===
751             var width_user = eval(user_status + "_width");
752             // Largeur maximale en fonction du statut
753             if (width_user.match(reg1))
754             // pourcentage
755               widthmin = widthmin * parseInt(width_user) / 100;
756             else
757               widthmin = parseInt(width_user);
758
759             var marges = 0;
760
761             if (typeof (info_img) != "undefined") {
762               widthmin -= info_img.borderwidth.left || 0;
763               widthmin -= info_img.borderwidth.right || 0;
764             }
765             widthmin -= marges;
766             widthmin -= (Bandeau_t.borderwidth.left + Bandeau_t.borderwidth.left);
767             Image_width -= (Bandeau_t.borderwidth.left + Bandeau_t.borderwidth.left);
768             if (Image_width > widthmin) {
769               //   Image_width largeur à atteindre
770               //  Calcul du rapport d'agrandissement
771               var echelle_w = parseFloat((widthmin) / img_reelle.width, 3);
772               if (echelle_w > echelle_max) { echelle_w = echelle_max; }
773               Image_width = parseInt(img_reelle.width * echelle_w);
774               if (rapport > 0)
775                 Image_height = parseInt(Image_width / rapport);
776             }
777
778
779
780           }
781
782
783           // }
784           //===================================================
785
786           img_finale.height = Image_height;
787           img_finale.width = Image_width;
788           if (theme.match(RegExp("stripped", "gi"))) {
789             img_finale.width -= (llgboframe.top * 2);
790             if (rapport > 0) img_finale.height = (img_finale.width / rapport);
791             else img_finale.height -= (llgboframe.top * 2);
792
793           }
794           zoom = echelle;
795           if (llgboframe.height > 0) {
796             //=============LLGBO2 ===========================
797             t1 = llgboframe;
798             if (!TheImg.src) {
799               TheImg = jQuery(TheImg).find("img").get(0)
800               if (!TheImg.src) {
801                 TheImg = jQuery(Parent).find("div").get(0)
802               }
803             }
804             if (TheImg.src) {
805
806
807               wingbo = img_finale.width;
808               heightgbo = img_finale.height;
809               if (Type_Img == "panorama") {
810                 heightgbo = info_theImage.height;
811                 img_finale.height = info_theImage.height;
812               }
813
814               img_finale.width -= marges_llgbo;
815               if (jQuery("#slideshow").infos().width > 0) {
816                 img_finale.height -= (marges_llgbo * 1.5);
817               } else {
818                 img_finale.height -= marges_llgbo
819               }
820
821
822               if (wingbo > winwidth) {
823                 jQuery("#gbo").width(winwidth);
824                 jQuery("#gbo").height(winheight);
825                 jQuery("#gbo").css("width", winwidth + "px");
826                 jQuery("#gbo").css("height", winheight + "px");
827               }
828               else {
829                 jQuery("#gbo").width(wingbo);
830                 jQuery("#gbo").height(heightgbo);
831                 jQuery("#gbo").css("width", wingbo + "px");
832                 jQuery("#gbo").css("height", heightgbo + "px");
833               }
834
835               a0 = jQuery("area[rel!=up][rel!=prev][rel!=next]");
836               a1 = jQuery("area[rel=prev]");
837               a2 = jQuery("area[rel=next]");
838               a3 = jQuery("area[rel=up]");
839               nb_zone = 3;
840               if (a1.length == 0) {
841                 nb_zone -= 1;
842               }
843               if (a2.length == 0) {
844                 nb_zone -= 1;
845               }
846
847
848               var Largeur_zone = (img_finale.width / nb_zone);
849               var Hauteur_zone = (img_finale.height);
850               var init_zone = 0;
851
852               if (a1.length > 0) {
853                 coord = { x0: init_zone, y0: 0, x1: Largeur_zone, y1: Hauteur_zone };
854
855                 jQuery("area[rel=prev]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
856                 init_zone += Largeur_zone;
857               }
858
859               coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
860
861               if (a0.length > 0) {
862                 jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1 / 2) + "'" });
863                 jQuery(a0).attr({ coords: "'" + coord.x0 + "," + (coord.y1 / 2) + "," + coord.x1 + "," + (coord.y1) + "'" });
864               } else {
865                 jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1) + "'" });
866               }
867               init_zone += Largeur_zone;
868
869               if (a2.length > 0) {
870                 coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
871                 jQuery("area[rel=next]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
872               }
873             }
874           }
875
876           //================ Zone affichage =========================
877
878
879           //  jQuery(Cadre).css("top", "0px");
880           jQuery("#standard").css("top", 0 + "px");
881           jQuery("#comments").css("top", 0 + "px");
882           //========== Image Remise à l'échelle =======================
883
884           img_finale.height = parseInt(img_finale.height);
885           img_finale.width = parseInt(img_finale.width);
886           //=========================================================================
887           if (jQuery("#slideshow").infos().width > 0) {
888
889
890           } else {
891
892           }
893           //=== cadre = theImage
894           jQuery(Cadre).css({ marginLeft: "auto" });
895           // jQuery(Cadre).width(Zone_Affichage.width);
896           jQuery(Cadre).css("width", "auto");
897           //   jQuery(Cadre).height(Zone_Affichage.height);
898
899           if (typeof (gmaps) != "undefined") {
900             Gmap_ = gmaps.maps[0];
901             if (Gmap_.sizeMode == 'A') {
902               jQuery("#iGMapsIcon").css({ width: old_window.width * 0.8 + "px", height: old_window.height * 0.8 + "px" });
903
904             }
905           }
906           //============= flv,mov,mpg  ok
907           /* wmv nok
908           * avi nok
909           //===========================================
910           */
911           if (Type_Img == "charlie") {
912             t1 = jQuery("#charlie").infos();
913
914             /**/
915
916             pdf = 0;
917             jQuery("#charlie div").each(function (i) {
918
919
920               p1 = jQuery(this).infos();
921               pdf += p1.padding.right + p1.padding.left;
922             });
923             img_finale.width -= pdf;
924
925             jQuery("#charlie").css({
926               width: img_finale.width + pdf,
927               height: img_finale.height,
928               margin: "auto"
929             });
930
931
932
933             jQuery("#player").css("width", img_finale.width + "px");
934             jQuery("#player").css("height", img_finale.height);
935
936             jQuery("#embedplayer").css("width", img_finale.width);
937             jQuery("#embedplayer").css("height", img_finale.height);
938
939
940             jQuery("object").width(img_finale.width);
941             jQuery("object").height(img_finale.height);
942
943
944           } else if (Type_Img == "panorama") {
945
946             // -----     jQuery(TheImg).panorama2(img_finale.height, img_finale.width);
947             // jQuery(TheImg).height(img_finale.height);
948             // jQuery(TheImg).width(img_finale.width);
949             jQuery("#Panorama div").height(img_finale.height);
950             //  class=simple_panorama
951
952             jQuery(".panorama-viewport").css("left", "2px");
953             jQuery(".panorama-viewport").css("width", "auto");
954
955
956           } else if (Type_Img == "pamoorama") {
957             info_theImage.height = Zone_Affichage.height;
958             img_height = myPamoorama.imageHeight
959             if (theme.match(RegExp("simple", "g"))) {
960               //  marge_right = 2;
961             }
962             new_width = Zone_Affichage.width - marge_right - marge_left;
963             new_width = Zone_Affichage.width - (info_theImage.borderwidth.right + info_theImage.borderwidth.left);
964
965
966
967             Zone_Affichage.height += info_pamoorama_footer.height;
968             zoom = info_theImage.height / img_height;
969             myPamoorama.options.width = new_width * zoom;
970             //  if(msie || safari) jQuery("#pamoorama_inner ").css({ zoom: zoom });
971             //====================================================
972             jQuery("#pamoorama").css({
973               marginLeft: "auto",
974               marginRight: "auto",
975               //height: Zone_Affichage.height + "px", sinon déclenchement panorama sur la hauteur;
976               width: new_width + "px"
977             });
978             jQuery("#pamoorama").width(new_width);
979
980             //====================================================
981             info_pamoorama = jQuery("#pamoorama").infos();
982             img_finale.height = info_pamoorama.height - info_pamoorama_footer.height;
983             img_finale.width = new_width;
984
985             jQuery("#pamoorama_outter").width(new_width);
986
987
988             // commenter sinon outter augmente à chaque resize
989             //  jQuery("#pamoorama_outter").height(info_pamoorama.height - info_pamoorama_footer.height);
990
991
992
993             jQuery("#pamoorama_outter").css({ width: new_width + "px" });
994             jQuery("#pamoorama_footer").css({ width: new_width + "px" });
995             //
996             //====================================================
997             info_pamoorama = jQuery("#pamoorama").infos();
998             info_pamoorama_outter = jQuery("#pamoorama_outter").infos();
999             info_pamoorama_inner = jQuery("#pamoorama_inner").infos();
1000             info_pamoorama_footer = jQuery("#pamoorama_footer").infos();
1001             info_pamoorama_frame = jQuery("#pamoorama_frame").infos();
1002
1003             info_frame = jQuery(myPamoorama.frame).infos();
1004
1005             zoom = img_finale.height / img_height;
1006
1007
1008           } else if (TheImg.src) {
1009             //--- background ?? ---
1010             jQuery(TheImg).height(img_finale.height);
1011             jQuery(TheImg).width(img_finale.width);
1012             jQuery(TheImg).css({ height: img_finale.height + "px ",
1013               width: img_finale.width + "px "
1014             });
1015
1016
1017           } else {
1018             //===map ? luciano ===
1019             jQuery(TheImg).height(img_finale.height);
1020             jQuery(TheImg).width(img_finale.width);
1021             jQuery(TheImg).css({ height: img_finale.height + "px ",
1022               width: img_finale.width + "px "
1023             });
1024             if (theme.match(RegExp("luciano", "g"))) {
1025               jQuery(Parent + " #theImg IMG").css({ height: img_finale.height + "px ",
1026                 width: img_finale.width + "px "
1027               })
1028             }
1029
1030           }
1031
1032           jQuery("#navThumbPrev").css({ overflow: "hidden" });
1033           jQuery("#navThumbNext").css({ overflow: "hidden" });
1034           n = typeof inittoolbar;
1035           if (Type_Img == "map") {
1036             jQuery("#navThumbNext").css({ display: 'none' });
1037             jQuery("#navThumbPrev").css({ display: 'none' });
1038             jQuery("#theImage").css({ marginTop: info_ToolBar.height+"px", marginLeft: "0px",
1039               width: winwidth+"px",
1040               height: winheight + "px"
1041             });
1042             //mapPicture
1043           }
1044           try {
1045             if (theme.match(RegExp("gally", "gi"))) {
1046               if (typeof inittoolbar == "function") {
1047                 if (typeof (currentTab) == "undefined") inittoolbar();
1048                 else initializeImageMode("resize");
1049               } else {
1050                 tp = gallyPP.getImageProp();
1051                 if (typeof (GallyPP) == "function")
1052                   gallyPP = new GallyPP();
1053
1054                 iph = jQuery("#imageHeaderBar").infos();
1055                 jQuery("#imageToolBar").css({ top: iph.bottom + "px", position: "absolute" });
1056                 jQuery("#theImage").width(winwidth);
1057               }
1058               //===========================================================================
1059               if (jQuery("#navThumbPrev").length > 0) {
1060                 jQuery("#navThumbPrevContainer").css({ left: "0px"
1061                 });
1062               }
1063               if (jQuery("#navThumbNext").length > 0) {
1064                 jQuery("#navThumbNextContainer").css({ left: "0px"
1065                 });
1066               }
1067               //=============================================================================
1068               if (!theme.match(RegExp("lapis", "gi"))) {
1069                 if (typeof initializeImageMode == "function") {
1070                   initializeImageMode("resize");
1071                 }
1072
1073               }
1074
1075             } else if (theme.match(RegExp("simple", "g"))) {
1076
1077               jQuery("#imageToolBar").css({ position: "static" });
1078
1079               info_imageInfoBar = jQuery("#imageInfoBar").infos();
1080               if (info_imageInfoBar.bottom < info_img.bottom) {
1081                 //   jQuery("#imageInfoBar").height(info_img.bottom);
1082               }
1083
1084             } else {
1085
1086               //    jQuery("#imageToolBar").css("position", "static");
1087             }
1088           } catch (e) {
1089
1090           }
1091           //  --- réglage de la hauteur de page en fonction du copyright-----------
1092           if (typeof (pos_copyright) == "undefined") pos_copyright = jQuery("#copyright").infos();
1093
1094           if (theme.match(RegExp("stripped", "gi"))) {
1095             var TitleBox = jQuery("#imageTitleContainer");
1096             if (TitleBox.length != 0) TitleBox.css("width", img_finale.width + "px");
1097           } else {
1098             if (pos_copyright.top > 100) {
1099               jQuery("#the_page").height(pos_copyright.top);
1100             }
1101           }
1102
1103
1104           /*
1105           if (!theme.match(RegExp("luciano", "gi"))) {
1106           jQuery("#linkNext").css({ height: "80px", width: "200px", overflow: "hidden" });
1107           jQuery("#linkPrev").css({ height: "80px", width: "200px", overflow: "hidden" });
1108           jQuery(".navThumb img").css({ height: "80px", width: "", overflow: "hidden" });
1109           }
1110           */
1111           info_frame = jQuery(Cadre).infos();
1112           if (theme.match(RegExp("stripped", "gi"))) {
1113             pos = "absolute";
1114             info_theImageBox = jQuery("#theImageAndTitle").infos();
1115             t1 = info_theImageBox.top;
1116             l1 = info_theImageBox.left;
1117             // info_theImageBox = jQuery(Parent).infos();
1118
1119           } else {
1120
1121             t1 = info_frame.top;
1122             l1 = info_frame.left;
1123             info_theImageBox = jQuery(Parent).infos(); //theImage
1124           }
1125
1126           info_theImageBox.margin.margin = info_frame.margin.margin;
1127           info_theImageBox.top = t1;
1128           info_theImageBox.left = l1;
1129           //  info_theImageBox.position = "absolute";
1130
1131           Window_Affichage = info_theImageBox;
1132           if (DEBUG_autosize == "true") {
1133             //   jQuery(Cadre).css("border", "solid green");
1134
1135             jQuery("#Debug5").css({ background: "red",
1136               position: "absolute",
1137               border: "green solid 2px",
1138               textAlign: align_auto,
1139               margin: "auto",
1140               top: Window_Affichage.top + "px",
1141               left: Window_Affichage.left + "px",
1142               width: Window_Affichage.width + "px",
1143               height: Window_Affichage.height + "px"
1144             }); //red
1145             jQuery("#Debug4").css({ top: info_frame.bottom - info_description.height + "px" }); //green
1146           }
1147
1148           Wait_Affichage();
1149
1150           return true;
1151
1152
1153
1154
1155
1156           //_____________________________________________________
1157         } // Resize();
1158
1159
1160         //======================================================================
1161
1162
1163       });            // fin extend
1164
1165
1166
1167     } // function
1168);
1169
1170
1171/*
1172* recherche la plus grande image (hauteur ou largeur)
1173*/
1174function Get_Img_Maxi(myobj) {
1175    var w00 = 0;
1176    var myImg = null;
1177    jQuery(myobj).each(function (i) {
1178        w0 = img_reelle.width;
1179        h0 = img_reelle.height;
1180        if (h0 > w0) w0 = h0;
1181        if (w0 > w00) {
1182            if (!this.src.match(RegExp(".png", "g")))
1183                if (!this.src.match(RegExp(thumbnail, "g"))) {
1184                    myImg = this;
1185                    w00 = w0;
1186                }
1187
1188        }
1189    });
1190    return myImg;
1191}
1192
1193//============================================================
1194/*
1195*
1196*/
1197
1198function Info_entete(Parent) {
1199    if (typeof (marge_top) != "undefined") return result;
1200    info_imageToolBar = jQuery("#imageToolBar").infos();
1201    if (info_imageToolBar.position == "absolute") {
1202        jQuery("#imageToolBar").css("position", "relative");
1203        jQuery("#imageToolBar").css("top", 0 + "px");
1204    }
1205    optiontop = 0;
1206
1207    info_imageInfoBar = jQuery("#imageInfoBar").infos();
1208
1209    jQuery("#" + "theImgContainer").css("marginTop", "0px");
1210    info_theImage = jQuery(Parent).infos();
1211    info_thePicturePage = jQuery("#thePicturePage").infos();
1212
1213
1214    if (theme.match(RegExp("stripped", "gi"))) {
1215
1216        info_theImageAndTitle = jQuery("#theImageAndTitle").infos();
1217        info_theImageBox = jQuery("#theImageBox").infos();
1218
1219        optiontop = (marges_llgbo / 2) + info_theImageAndTitle.margin.top;
1220
1221    }
1222
1223    if (info_theImage.position == "relative") {
1224        //--- passage relative ==> static ===/
1225        jQuery(Parent).css("position", "static");
1226        info_theImage = jQuery(Parent).infos();
1227
1228    } else {
1229
1230    }
1231    if (info_theImage.position == "absolute") {
1232        //--- passage absolute ==> static ===/
1233        jQuery(Parent).css("position", "static");
1234        info_theImage = jQuery(Parent).infos();
1235
1236    }
1237
1238    marge_top = Math.ceil(Info_the_page.top +
1239                                     Info_the_page.borderwidth.top +
1240                                     info_theImage.borderwidth.top +
1241                                     info_thePicturePage.margin.top
1242                                     );
1243
1244    img_top = Math.ceil(info_theImage.top +
1245                        info_theImage.borderwidth.top +
1246                        info_thePicturePage.margin.top + optiontop);
1247    result = info_imageToolBar;
1248    result.width = "20%";
1249    result.left = "40%";
1250    result.marge_top = marge_top;
1251    result.img_top = img_top;
1252    //=== Afficher le titre de l'image sur le cadre ===
1253    llgboh2 = jQuery("#gboh2").infos();
1254    result.img_top += llgboh2.height;
1255    return result;
1256
1257}
1258
1259/* Récupère les informations sur la description.
1260*
1261*/
1262
1263//====================================================
1264function Info_Description_f(Parent) {
1265
1266
1267    jQuery(Parent).css({ display: "block" });
1268    //====== détection du type d'images ======
1269    if (jQuery("#charlie").length > 0) {
1270        Type_Img = "charlie";
1271    } else if (jQuery("#pamoorama").length) {
1272        Type_Img = "pamoorama";
1273    } else if (jQuery(Parent + " embed").length > 0) {
1274        Type_Img = "embed";
1275    } else if (jQuery("#map").length) {
1276        Type_Img = "map";
1277
1278    } else if (jQuery("#Panorama").length) {
1279        Type_Img = "panorama";
1280    } else if (jQuery(Parent).find("img").length > 0) {
1281        Type_Img = "img";
1282    } else if (jQuery(Parent + "Box").find("img").length > 0) {
1283        Type_Img = "img";
1284        Parent = Parent + "Box";
1285    } else if (jQuery("img").length > 0) {
1286        Type_Img = "img_autre";
1287        return;
1288    } else {
1289        return;
1290    }
1291    // jQuery(Parent + " p:not(:contains(' ')) ").remove();
1292    // jQuery(Parent + " p:(:contains('')) ").remove();
1293    llgboframe = jQuery("#gbo").infos();
1294    marges_llgbo = 0;
1295
1296    if (llgboframe.height > 0) {
1297 ll2 = jQuery("#gbo div:last").infos();
1298        ll1 = jQuery("#gbo div:first").infos();
1299        ll2 ="" ;
1300        jQuery("#gbo div").each(function (i) {
1301
1302         if (  this.id=="") return ;
1303ll2=this ;
1304        });
1305       ll2 = jQuery(ll2).infos();
1306        ll1 = ll1.width;
1307        ll2 = ll2.width - ll2.borderwidth.left - ll2.borderwidth.right;
1308        marges_llgbo = (ll1 - ll2);
1309
1310    }
1311
1312    Bandeau_t = Info_entete(Parent)
1313    Bandeau = Bandeau_t.img_top;
1314
1315    info_theImgContainer = jQuery("#" + "theImgContainer").infos();
1316    info_description = jQuery("#" + "description").infos();
1317    //=============================================================================
1318    //   jQuery(Parent + " p").css({ padding: "0px", margin: "0px "    });
1319    if (theme.match(RegExp("simple", "gi"))) {
1320        jQuery(Parent).css({ padding: "0px",
1321            marginLeft: "0px",
1322            marginRight: "auto",
1323            marginTop: "0px",
1324            marginBottom: "0px"
1325
1326        });
1327    }
1328
1329
1330    if (theme.match(RegExp("luciano", "g"))) {
1331        jQuery("#imageContainer").css({ height: "auto" });
1332        TheImg = jQuery(Parent + " #theImg img");
1333        info_img = jQuery(TheImg).infos();
1334
1335
1336    } else if (Type_Img == "map") {
1337
1338        info_map = jQuery("#mapPicture").infos();
1339        marge_left = info_map.width;
1340
1341        jQuery("#map").css({ left: marge_left + "px", padding: "0px",
1342            marginLeft: "0px",
1343            marginRight: "4px",
1344            marginTop: "0px",
1345            marginBottom: "0px",
1346            position: "relative"
1347        });
1348
1349        TheImg = jQuery("#map");
1350        info_img = jQuery(TheImg).infos();
1351
1352
1353    } else if (jQuery("#charlie").length > 0) {
1354
1355        jQuery("#charlie").css({ padding: "0px"
1356
1357        });
1358        TheImg = jQuery("#charlie")
1359        info_img = jQuery(TheImg).infos();
1360
1361
1362
1363    } else if (jQuery(Parent + " embed").length > 0) {
1364
1365        TheImg = jQuery(Parent + " embed");
1366        info_img = jQuery(TheImg).infos();
1367
1368
1369
1370    } else if (Type_Img == "pamoorama") {
1371        if (!nopano) {
1372            Wait_pamoorama();
1373            return
1374        }
1375        TheImg = jQuery("#pamoorama");
1376        info_img = jQuery(TheImg).infos();
1377        info_footer = jQuery("#pamoorama_footer").infos();
1378        info_img.height = parseInt(img_reelle.height) + parseInt(info_footer.height);
1379
1380    } else {
1381        TheImg = jQuery(Parent + " img");
1382
1383        TheImg = Get_Img_Maxi(TheImg);
1384        if (!TheImg) TheImg = jQuery(Parent);   // sans img ??
1385        info_img = jQuery(TheImg).infos();
1386    }
1387    //=====================================================================================
1388
1389    switch (info_img.position) {
1390        case "relative":
1391            break;
1392        case "static":
1393            break;
1394        case "absolute":
1395            break;
1396        case "":
1397            break;
1398        default:
1399            break;
1400    }
1401
1402    info_description.marge = {
1403        bottom: info_img.padding.bottom + info_img.margin.bottom + info_img.borderwidth.bottom,
1404        top: info_img.padding.top + info_img.borderwidth.top + info_img.margin.top
1405    }
1406
1407    if (llgboframe.height > 0) info_img = llgboframe; // format de l'image+largeur du cadre
1408
1409    if (theme.match(RegExp("luciano", "g"))) {
1410
1411        info_theImgContainer = jQuery("#imageContainer").infos();
1412        info_description.bottom = jQuery("#imageInfo").infos().top;
1413        info_description.top = info_theImgContainer.bottom;
1414        Info_slidshowToolBar = jQuery("#slidshowToolBar").infos();
1415
1416        if (Info_slidshowToolBar.height > 0) {
1417            correction = (Info_slidshowToolBar.height);
1418            info_description.top = info_img.bottom;
1419            info_description.bottom = jQuery("#copyright").infos().top;
1420        }
1421
1422        //=========================================================
1423    } else if (theme.match(RegExp("stripped", "gi"))) {
1424        //options.imageAutosize
1425        //options.imageMargin
1426        if (options.imageAutosizeTitle == false) {
1427            info_description.top =   info_theImageBox.bottom;
1428
1429            info_description.bottom =info_HeaderBar.margin.top+ info_description.top +
1430                                    info_description.borderwidth.top +
1431                                    info_description.borderwidth.bottom +
1432                                      options.imageAutosizeMargin*2 +
1433                                    (marges_llgbo / 2)+4;
1434
1435        } else {
1436
1437
1438            info_description.top = info_theImageBox.bottom +
1439                        jQuery("#content").infos().top +
1440                        options.imageAutosizeMargin * 2  +
1441                        (marges_llgbo / 2)
1442                                ;
1443            info_description.bottom = jQuery("#tabZone").infos().top +
1444                        info_theImageAndTitle.margin.top;
1445           if (msie == true) info_description.bottom -= 4;
1446        };
1447        check_desc_v = true;
1448
1449    } else {
1450        info_description.bottom = info_theImage.bottom;
1451        info_description.top = info_img.height + info_theImage.top;
1452        // info_description.bottom -= info_img.top;
1453    }
1454    //
1455
1456    info_description.height = info_description.bottom - info_description.top;
1457
1458    if (check_desc_v == false) {
1459        info_description.height = 0;
1460    }
1461
1462    Debug_pos();
1463
1464    //cl_visible=false ;
1465    return info_description;
1466}
1467
1468//====================================================
1469function Debug_info(index, infos, nom) {
1470
1471    if (infos.height > 0) {
1472
1473        message = browser.browser + " -- > Info : " + nom + " " + infos.id + "\n" +
1474                 "Info nodeName: " + infos.nodeName + "\n" +
1475                 "Info width: " + infos.width + "\n" +
1476                 "Info height: " + infos.height + "\n" +
1477                 "Info top: " + infos.top + "\n" +
1478                 "Info left: " + infos.left + "\n" +
1479                 "Info position: " + infos.position + "\n";
1480
1481        myDebug = { id: "Debug" + index, texte: message,
1482            css: {
1483                color: "black",
1484                opacity: "0.5",
1485                position: "absolute",
1486                height: infos.height || 100 + "px",
1487                width: infos.width || 300 + "px",
1488                left: infos.left || 0 + "px",
1489                border: "solid 1px green",
1490                top: infos.top + "px"
1491
1492            }
1493        }
1494        return myDebug;
1495    } else {
1496        return null;
1497    }
1498
1499
1500}
1501//====================================================
1502function Debug_pos() {
1503    if (DEBUG_autosize == "true") {
1504
1505        jQuery("[id ^='Debug']").show();
1506        /*
1507        Debug2  background-color:yellow
1508        Debug3 background-color:blue
1509        Debug4 background-color:green
1510        Debug5 background-color:red
1511
1512        */
1513
1514        affiche_debug({
1515            Debug1: Debug_info(1, Bandeau_t, "Bandeau_t"),
1516            Debug4: Debug_info(4, info_description, "info_description"),
1517            Debug5: Debug_info(5, info_img, "info_img")
1518        });
1519    }
1520}
1521
1522function affiche_debug(aff_infos) {
1523    jQuery(jQuery("[id ^='Debug']")).each(function (i) {
1524        if (aff_infos[this.id]) {
1525            if (aff_infos[this.id].css) {
1526                jQuery("#" + this.id).css(aff_infos[this.id].css);
1527                jQuery("#" + this.id).text(aff_infos[this.id].texte);
1528            }
1529        }
1530    });
1531    return;
1532
1533}
1534
1535
1536
1537
1538jQuery(function () {
1539  //'gallyInterfaceReady'
1540
1541    jQuery('#pamoorama').live('ON', function (e) {
1542        jQuery(jQuery('.debug').get(1)).trigger('ON');
1543        Bandeau_bas = Info_Description_f(Parent);
1544        Bandeau = Bandeau_bas.top;
1545        old_window = { width: 0, height: 0 };
1546        Wait_Affichage();
1547    });
1548
1549    jQuery(Parent).live('ON', function (e) {
1550        jQuery(jQuery('.debug').get(1)).trigger('ON');
1551        Wait_Affichage();
1552    });
1553
1554    // Custom Event, ON to turn on a debug.
1555    jQuery('.debug').live('ON', function (e) {
1556
1557        jQuery('.debug').trigger('OFF');
1558        jQuery(this).addClass('debugOn');
1559    });
1560
1561    // On Click = debugs On
1562    jQuery('.debug').live('click', function (e) {
1563
1564        jQuery(this).trigger('ON');
1565    });
1566
1567    // Custom Event, Turn off a debug
1568    jQuery('.debug').live('OFF', function (e) {
1569
1570        jQuery(this).removeClass('debugOn');
1571    });
1572
1573    // on Double Click, remove the debug from the DOM
1574    jQuery('.debug').live('dblclick', function () {
1575
1576        jQuery(this).fadeOut(function () { $(this).remove() });
1577    });
1578
1579    // Add another debug to the DOM
1580    jQuery('#adddebugs').click(function () {
1581        jQuery('<div></div>')
1582            .addClass('debug')
1583            .appendTo('#debugsContainer');
1584    });
1585     
1586    // Add 10 testing debugs to start with
1587      jQuery(window).load(function () { 
1588            DEBUG_autosize = (typeof DEBUG_autosize != "undefined") ? DEBUG_autosize : "false";
1589        if (DEBUG_autosize == "true") {
1590            for (var i = 0; i < 10; i++) {
1591                jQuery('#adddebugs').click();
1592            }
1593            jQuery(jQuery('.debug').get(8)).click();
1594
1595         
1596
1597        }
1598    }); //on load
1599});
Note: See TracBrowser for help on using the repository browser.