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

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

[Autosize][beta] fix bug whith user tags


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