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

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

[Autosize][beta] fix compatiblity with theme stripped.

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