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

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

[Autosize][beta] compatibility whith piwishack


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