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

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

[Autosize][beta] fix bug in autosize.inc


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