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

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

[Autosize][beta] fix compatiblity with theme stripped.

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