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

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

[Autosize][beta] fix bugs with FF

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