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

Last change on this file since 12527 was 12527, checked in by cljosse, 12 years ago

[extensions] Autosize fix buggs

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