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

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

[Autosize][beta] compatibility whith simple


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