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

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

[Autosize][beta] Opportunity to test the class "autosize" to resize objects


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