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

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

[Autosize][beta] save

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