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

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

[autosize] compatiblity with gally 1.4.0

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