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

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

[Autosize][beta] fix warning on jquery


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