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

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

[Autosize][beta] adjust width with pamooramic.

File size: 43.8 KB
Line 
1
2function Toggle_bp() {
3    cl_visible = !cl_visible;
4    if (cl_visible) src = src1;
5    else src = src2;
6    if (cl_visible) src_info = src3;
7    else src_info = src4;
8
9    jQuery('#bp_cla').attr('alt', src_info);
10    jQuery('#bp_cla').attr('title', src_info);
11
12    jQuery('#bp_img_cla').get(0).src = src;
13    jQuery('#bp_img_cla').attr('alt', src_info);
14    jQuery('#bp_img_cla').attr('title', src_info);
15    jQuery('#bp_cla').attr('Stitle', src_info);
16    jQuery('#bp_cla').attr('Stip', " ");
17    old_w = 0;
18   
19    jQuery(window).resize();
20}
21
22jQuery(document).ready(
23
24      function (jQuery) {
25
26
27          if (DEBUG == "false") {
28              jQuery("#Debug").hide();
29              jQuery("#Debug1").hide();
30              jQuery("#Debug2").hide();
31          }
32          var img_top = "0";
33
34          var old_h = 0;
35          var rapport = -1;
36          var old_w = 0;
37
38          var llgboframe = jQuery("#gbo div:first");
39          var marges_llgbo = 0;
40          if (llgboframe.length > 0) {
41              ll1 = jQuery(llgboframe).info();
42              ll2 = jQuery("#gbo div:last").info();
43              marges_llgbo = (ll1.width - ll2.width) + ll2.borderwidth.left + ll2.borderwidth.right;
44          }
45
46
47          //=========================================================
48
49          function wait_Timer() {
50              old_w = 0
51              jQuery(window).resize();
52              info_pamoorama_outter = jQuery("#pamoorama_outter").info();
53              if (info_pamoorama_outter.width == 0)
54                  setTimeout("wait_Timer()", 100);
55
56          }
57
58
59          //=============================================================
60          function cl_Timer() {
61              //   if (!jQuery.browser.msie) { jQuery(function () { alert(jQuery.browser.version); }); }
62              if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 8)
63                  alert(jQuery.browser.version);
64              panoramaContainer = jQuery(".panorama-container");
65              n = document.scripts[6]; //12--14affiche_script ;
66              t = n.src;
67
68              currentPosition = 0 - parseInt(jQuery(panoramaContainer).css('margin-left'));
69              if (currentPosition == NaN) return;
70
71
72              if (currentPosition > 1000)
73                  jQuery(panoramaContainer).css('margin-left', "0px")
74              setTimeout("cl_Timer()", 500);
75          }
76          //=============================================================
77          function onPropertyChange(e) {
78              var el = e.srcElement;
79              var new_class = el.className;
80              ID = el.id;
81              Prop = e.propertyName.split(".");
82              Property = Prop[1];
83              if (Property == "display") {
84                  Valeur = parseInt(el.currentStyle[Property]);
85                  if (Valeur == "block") {
86
87
88                  }
89              }
90              return;
91          }
92
93          /* ready
94          *
95          *
96          */
97          //============================================================
98          /*
99          *
100          */
101          function Info_entete(Parent) {
102
103              var info_imageToolBar = jQuery("#imageToolBar").info();
104              if (info_imageToolBar.position == "absolute") {
105                  jQuery("#imageToolBar").css("position", "relative");
106                  jQuery("#imageToolBar").css("top", 0 + "px");
107              }
108
109              var info_theImage = jQuery("#theImage").info();
110
111              if (info_theImage.position == "relative") {
112                  //--- passage relative ==> static ===/
113                  jQuery("#theImage").css("position", "static");
114                  info_theImage = jQuery("#theImage").info();
115
116              }
117              if (info_theImage.position == "absolute") {
118                  //--- passage absolute ==> static ===/
119                  jQuery("#theImage").css("position", "static");
120                  info_theImage = jQuery("#theImage").info();
121
122              }
123
124              marge_top = Info_the_page.top +
125                                     Info_the_page.borderwidth.top +
126                                     info_theImage.borderwidth.top;
127
128              img_top = info_theImage.top + info_theImage.borderwidth.top;
129              return { marge_top: marge_top, img_top: img_top };
130
131          }
132
133          /* Récupère les informations sur la description.
134          *
135          */
136          function Info_description(Parent) {
137              //  jQuery("#" + Parent + " p:not(:contains(' ')) ").remove();
138              //=============================================================================
139              var info_description = { top: 0, bottom: 0, height: 0 };
140              if (theme.match(RegExp("simple", "gi"))) {
141                  jQuery("#" + Parent).css({ padding: "0px",
142                      marginLeft: "0px",
143                      marginRight: "auto",
144                      marginTop: "0px",
145                      marginBottom: "0px", position: "absolute", top: Bandeau + "px"
146                  });
147              } else {
148
149                  jQuery("#" + Parent).css({ padding: "0px",
150                      marginLeft: "auto",
151                      marginRight: "auto",
152                      marginTop: "0px",
153                      marginBottom: "0px"
154                  });
155
156
157              }
158
159
160              //   jQuery("#" + Parent + " p").css({ padding: "0px", margin: "0px "    });
161
162
163              if (theme.match(RegExp("luciano", "g"))) {
164                  info_img = jQuery("#" + Parent + " #theImg img").info();
165
166              } else {
167
168                  info_img = jQuery("#" + Parent + " img").info();
169              }
170
171              info_description.marge = { bottom: info_img.padding.bottom + info_img.margin.bottom + info_img.borderwidth.bottom,
172                  top: info_img.padding.top + info_img.borderwidth.top
173              }
174
175              info_description.top = info_img.bottom + info_img.margin.bottom + info_img.borderwidth.bottom;
176              //=============================================================================
177              info_gbo = jQuery("#gbo").info();
178              if (info_description.top < info_gbo.bottom)
179                  info_description.top = info_gbo.bottom;
180              //=============================================================================
181              info_desc = jQuery("#" + Parent + " p:first").info();
182              if (info_desc.bottom < info_img.bottom)
183                  info_desc.bottom = info_img.bottom;
184
185              //  if (info_desc.top > info_img.bottom)
186              //     info_description.top = info_desc.top;
187
188              if (jQuery("#Panorama").length) {
189                  Type_Img = "panorama";
190                  //  cl_visible = false;
191
192              }
193              info_table = jQuery(".infoTable").info();
194
195              if (info_table.top > info_description.bottom)
196                  info_description.bottom = info_table.top;
197              //===========================================================================
198
199              info_licencetag = jQuery(".licencetag").info();
200
201
202              if (info_licencetag.bottom > 0) {
203                  jQuery(".licencetag").css("border", "solid 5px transparent");
204                  if (info_licencetag.bottom > info_description.bottom) {
205                      info_description.bottom = info_licencetag.bottom;
206                  }
207                  else
208                      info_description.bottom += info_table.margin.top + info_table.padding.top;
209
210              }
211              //=============================================================================
212              if (theme.match(RegExp("gally", "gi"))) {
213                  if (!theme.match(RegExp("lapis", "gi"))) {
214                      info_description.bottom = info_description.bottom
215                  }
216              }
217
218
219
220
221
222              if (info_description.top < 1)
223                  info_description.top = info_description.bottom;
224
225
226              if (info_description.bottom < info_description.top) {
227                  info_description.bottom = info_description.top;
228
229                  info_desc = jQuery("#" + Parent + " p:last").info();
230
231                  if (info_desc.bottom > info_img.bottom)
232                      info_description.bottom = info_desc.bottom;
233              }
234
235
236              if (theme.match(RegExp("gally", "g"))) {
237                  if (!theme.match(RegExp("lapis", "gi"))) {
238                      info_copyright = jQuery("#copyright").info();
239                      info_description.bottom += info_copyright.height;
240                  }
241              }
242
243              if (theme.match(RegExp("luciano", "g"))) { info_description.bottom -= 30 }
244
245              info_description.height = info_description.bottom - info_description.top;
246
247
248              if (DEBUG == "true") {
249
250                  /*  jQuery("#Debug").text(jQuery("#Debug").text() + user_status);   
251       
252
253                  info_description.width = "800";
254                  */
255                  jQuery("#Debug").css('display', 'block');
256                  jQuery("#Debug1").show();
257                  jQuery("#Debug2").show();
258                  Bandeau_bas = info_description;
259
260                  jQuery("#Debug").css({
261                      filter: 'alpha(opacity:50)',
262                      position: "absolute",
263                      width: "800px",
264                      border: "solid 1px green",
265                      top: Bandeau + "px"
266                  });
267                  jQuery("#Debug").text("Debug:Bandeau : " + Bandeau);
268
269                  jQuery("#Debug1").css({
270                      filter: 'alpha(opacity:50)',
271                      position: "absolute",
272                      border: "solid 1px green",
273                      top: Bandeau_bas.top + "px",
274                      width: (200) + "px",
275                      height: Bandeau_bas.height + "px"
276                  });
277                  jQuery("#Debug1").text("Debug1:Bandeau_bas top : " + Bandeau_bas.top + " height:" + Bandeau_bas.height);
278
279                  jQuery("#Debug2").css({
280                      filter: 'alpha(opacity:50)',
281                      position: "absolute",
282                      left: '50px',
283                      width: (300) + "px",
284                      border: "solid 1px green", top: Bandeau_bas.bottom + "px"
285                  });
286                  jQuery("#Debug2").text("Debug2:Bandeau_bas bottom :" + Bandeau_bas.bottom);
287
288              }
289
290              if (check_desc_v != 'checked="checked"') {
291                  info_description.height = 0;
292              }
293
294              return info_description;
295
296          }
297
298          /*
299          *
300          */
301          jQuery("#pamoorama_iner").bind('resize', function () {
302              wait_Timer();
303          })
304          //============================================================//==
305          jQuery("#pamoorama_outter").bind('resize', function () {
306              wait_Timer();
307          })
308
309
310
311          //============================================================
312          jQuery("#iGMapsIcon").bind('resize', function () {
313              jQuery().recentrage_widget();
314          })
315          jQuery("#icon_gmaps").bind('click', function () {
316              jQuery().recentrage_widget();
317          })
318
319
320
321
322
323
324          /* jQuery */
325          var img_init = { height: img_height, width: img_width };  // taille initiale
326          var img_defaut = { height: scaled_height, width: scaled_width };
327          var img_reelle = { height: img_height, width: img_width };
328          var img_finale = { height: 0, width: 0 };
329          var Zone_Affichage = { height: 0, width: 0 };
330
331          //============================================================
332
333          var Info_the_page = jQuery("#the_page").info();
334          var Zone_Affichage = jQuery("#theImage").info();
335
336          var Bandeau = 0;
337          var Bandeau_t = Info_entete("theImage")
338          Bandeau = Bandeau_t.img_top;
339          var Bandeau_bas = 0;
340          Bandeau_bas = Info_description("theImage");
341          //===================================================================
342          /*
343          * window .resize
344          */
345          jQuery(window).resize(function (event, ui) {
346              if (typeof (event) == 'undefined') return;
347              if (!cl_visible == true) return;
348              if (eval(user_status + "_enabled") == "") return;
349              var chk = eval(user_status + "_enabled");
350
351
352
353              //==========================================================================
354              var winwidth = jQuery(window).width();
355              var winheight = jQuery(window).height();
356              if (old_w == winwidth && old_h == winheight) return;
357
358
359
360
361              if (old_w != winwidth)
362              { old_w = winwidth; }
363              else
364              { if (old_h != winheight) old_h = winheight; }
365              //===========================================================================
366
367
368              var Type_Img = "";
369              //====== détection du type d'images ======
370              if (jQuery("#charlie").length > 0) {
371                  Type_Img = "charlie";
372              } else if (jQuery("#pamoorama").length) {
373                  Type_Img = "pamoorama";
374              } else if (jQuery("#theImage embed").length > 0) {
375                  Type_Img = "embed";
376              } else if (jQuery("#map").length) {
377                  Type_Img = "map";
378              } else if (jQuery("#Panorama").length) {
379                  Type_Img = "panorama";
380              } else if (jQuery("#theImage").find("img").length > 0) {
381                  Type_Img = "img";
382              } else if (jQuery("img").length > 0) {
383                  Type_Img = "img_autre";
384                  return;
385              } else {
386                  return;
387              }
388
389
390
391              var Cadre = jQuery("#theImage").get(0);
392              var info_Cadre = jQuery(Cadre).info();
393              //===============  Information cadre ======
394              var info_the_page = jQuery("#the_page").info();
395
396              //=============================================================================
397              var info_HeaderBar = jQuery("#imageHeaderBar").info();
398
399              var info_content = jQuery("#content").info();
400
401
402              var info_titrePage = jQuery("#titrePage").info();
403
404
405              var Zone_Affichage = jQuery("#theImage").info();
406
407              var info_ToolBar = jQuery("#imageToolBar").info();
408              var info_imageInfoBar = jQuery("#imageInfoBar").info();
409              var info_theHeader = jQuery("#theHeader").info();
410
411
412              var marge = 0;
413              if (info_ToolBar.width > 0)
414                  marge = (Zone_Affichage.width - info_ToolBar.width) / 2;
415
416              var marge_right = marge;
417              var marge_left = marge;
418
419              if (info_content.width > 100) {
420                  marge_left = 0;
421                  marge_right = info_imageInfoBar.margin.left + info_imageInfoBar.margin.right;
422                  winwidth = info_content.width;
423                  marge_right = info_imageInfoBar.width + marge_right;
424
425              }
426              else
427                  winwidth = Zone_Affichage.width;
428
429              winwidth -= (marge_right + marge_left);
430
431
432
433
434              if (Type_Img == "pamoorama") {
435                  var info_pamoorama = jQuery("#pamoorama").info();
436                  var info_pamoorama_outter = jQuery("#pamoorama_outter").info();
437                  var info_pamoorama_inner = jQuery("#pamoorama_inner").info();
438                  var info_pamoorama_footer = jQuery("#pamoorama_footer").info();
439                  TheImg = jQuery("#pamoorama");
440                  if (typeof (myPamoorama) == "undefined") {
441
442                      return
443
444                  }
445                 
446
447         
448                  po = myPamoorama;
449
450                  /*
451                  myPamoorama = new pamoorama('pamoorama',{ activateSlider:     {$PANO_ACTIVATESLIDER},
452                  width:                {$PANO_WIDTH},
453                  footercolor:          '{$PANO_FOOTERCOLOR}',
454                  captioncolor:         '{$PANO_CAPTIONCOLOR}',
455                  caption:              '{$ALT_IMG}',
456                  enableAutoscroll:     {$PANO_ENABLEAUTOSCROLL},
457                  autoscrollSpeed:      {$PANO_AUTOSCROLLSPEED},
458                  autoscrollOnLoad:     {$PANO_AUTOSCROLLONLOAD},
459                  startAutoscroll:      '{'pamooramics_startAutoscroll'|@translate}',
460                  stopAutoscroll:               '{'pamooramics_stopAutoscroll'|@translate}',
461                  loadingMessage: '{'pamooramics_loading'|@translate}',
462                  clickMessage:         '{'pamooramics_clickMessage'|@translate}',
463                  dragMessage:          '{'pamooramics_dragMessage'|@translate}'
464                  });
465                  */
466                  /*
467                  pamoorama_outter
468                  pamoorama_inner
469                  pamoorama_footer
470                  pamoorama_caption
471                  pamoorama_thumb
472                  pamoorama_frame
473                  */
474              } else {
475                  //==== récupère Img la plus grande  =====
476                  if (jQuery("#theImg")) IMG = "#theImg";
477                  else IMG = Cadre;
478
479                  TheImg2 = Get_Img_Maxi(IMG + " img");
480                  //=================================================================
481                  if (TheImg2 == null) {
482                      if (jQuery(Cadre).find("img").length > 0) {
483                          IMG = Cadre;
484                          TheImg = Get_Img_Maxi("#theImage img");
485                      }
486                  } else {
487                      TheImg = TheImg2  //luciano ?
488
489                  }
490              }
491              //=================================================================
492
493
494              switch (Type_Img) {
495                  case "map":
496                      var info_image = jQuery("#map").info();
497
498                      var info_map = jQuery("#mapPicture").info();
499
500                      marge_left = info_map.width;
501                      jQuery("#map").css("left", marge_left);
502
503                      var TheImg = jQuery("#map").get(0);
504                      img_reelle.height = info_image.height;
505                      img_reelle.width = winwidth - marge_right - marge_right;
506                      Bandeau_bas.height = 10;
507                      marge_right = 10;
508
509                      info_the_page = jQuery("#the_page").info();
510                      ;
511
512                      break
513
514
515                  case "panorama":
516                      // return;
517
518
519                      TheImg = Get_Img_Maxi("#Panorama img");
520                      info_theImage = jQuery(TheImg).info();
521                      info_the_page = jQuery("#the_page").info();
522
523                      break
524                  case "img":
525
526                      if (!TheImg) return;
527                      if (theme.match(RegExp("luciano", "g"))) {
528                          TheImg = jQuery("#the_page #theImg");
529                      }
530                      info_theImage = jQuery(TheImg).info();
531                      info_the_page = jQuery("#the_page").info();
532
533
534                      break
535                  case "img_autre":
536                      if (!TheImg) return;
537                      info_theImage = jQuery(TheImg).info();
538                      info_the_page = jQuery("#the_page").info();
539
540
541                      break
542                  case "embed":
543                      //
544
545                      TheImg = jQuery(Cadre).find("embed");
546
547                      info_theImage = jQuery(Cadre).info();
548                      info_the_page = jQuery("#the_page").info();
549                      if (rapport < 0) {
550                          img_height = parseInt(jQuery(TheImg).outerHeight());
551                          img_width = parseInt(jQuery(TheImg).outerWidth());
552
553                          img_reelle.height = img_height;
554                          img_reelle.width = img_width;
555
556                      }
557
558                      break
559                  case "charlie":
560
561                      TheImg = jQuery('#charlie object').get(0);
562                      info_theImage = jQuery(Cadre).info();
563                      info_the_page = jQuery("#the_page").info();
564                      if (rapport < 0) {
565                          img_height = parseInt(TheImg.height);
566                          img_width = parseInt(TheImg.width);
567
568                          img_reelle.height = parseInt(TheImg.height);
569                          img_reelle.width = parseInt(TheImg.width);
570                      }
571
572                      break
573                  case "pamoorama":
574                      //=========================================================
575
576
577                      if (typeof (myPamoorama.imageHeight) == "undefined") {
578                           old_w = 0;
579                          return;
580                      }
581
582                      img_reelle.height = myPamoorama.imageHeight;
583                      img_reelle.width = myPamoorama.imageWidth;
584                      TheImg = myPamoorama.image;
585                      info_theImage = jQuery("#pamoorama").info();
586                      info_the_page = jQuery("#the_page").info();
587
588                      break
589
590
591              }
592
593              //=============== Vérification taille minimale  autorizée ======================
594              var miniWidth = jQuery(TheImg).Get_Val_int(jQuery(TheImg).css("min-width"), mini_width);
595              miniHeight = jQuery(TheImg).Get_Val_int(jQuery(TheImg).css("min-height"), mini_height);
596
597
598              var maxWidth = jQuery(TheImg).Get_Val_int(jQuery(TheImg).css("max-width"), winwidth, "0");
599              maxHeight = jQuery(TheImg).Get_Val_int(jQuery(TheImg).css("max-height"), winheight, "0");
600
601              mini_width = parseInt(miniWidth);
602              mini_height = parseInt(miniHeight);
603
604              img_reelle.width = parseInt(img_reelle.width);
605
606
607              if (img_reelle.width < mini_width) return;
608
609              img_reelle.height = parseInt(img_reelle.height);
610              if (img_reelle.height < parseInt(mini_height)) return;
611              //==================================================================================   
612              if (rapport < 0) {
613
614                  img_init.height = parseInt(img_height);
615                  img_init.width = parseInt(img_width);
616
617                  rapport = img_width / img_height;
618
619                  if (Type_Img != "map")
620                      rapport = (img_init.width / img_init.height);
621                  else
622                      rapport = 0;
623
624              }
625
626
627              //=============== Zone d'affichage ============================
628
629              borderW = Zone_Affichage.borderwidth.left;
630              borderW += Zone_Affichage.borderwidth.right;
631
632
633              Zone_Affichage.width = winwidth - borderW;
634
635
636
637              var Licence = jQuery(".licencetag");
638              info_Licence = jQuery(".licencetag").info();
639
640              jQuery("#theImage #theImg IMG").css("marginTop", "0px")
641              //========== Correction en fonction du thème =============================
642              var correction = 0;
643              if (theme.match(RegExp("sobre", "g"))) {
644
645                  correction = -info_Licence.padding.top;
646
647              } else if (theme.match(RegExp("Pure", "g"))) {
648                  correction += 0; //??
649              } else if (theme.match(RegExp("luciano", "g"))) {
650                  correction = 0; //??
651
652              } else if (theme.match(RegExp("simple", "g"))) {
653                  correction += 0; //??
654              } else if (theme.match(RegExp("gally", "g"))) {
655                  correction += 0; //??
656
657              }
658              //================ Licence  ========================
659
660              if (Licence.length > 0) {
661                  jQuery(".licencetag").css("padding", "0px");
662
663              }
664              //====================================================
665              info_img = jQuery(TheImg).info();
666
667
668
669              img_top = Bandeau;
670
671              Marge_Basse = parseInt(marge_basse || 0); // hors bandeau
672              //==========================================================================
673              h = 0;
674              Zone_Affichage.height = winheight - Bandeau - Marge_Basse - correction;
675              var Image_height = Zone_Affichage.height - Bandeau_bas.height - Bandeau_bas.marge.top - Bandeau_bas.marge.bottom;
676
677              //=============================================================
678              var height_user = eval(user_status + "_height");
679              var reg1 = new RegExp("%", "g");
680              if (height_user.match(reg1))
681                  Image_height = Image_height * parseInt(height_user) / 100;
682              else
683                  Image_height = parseInt(height_user);
684
685              echelle_max = parseFloat(echelle_max, '3');
686              var echelle = parseFloat(Image_height / img_reelle.height, 3);
687
688              if (echelle > echelle_max) { echelle = echelle_max; }
689              Image_height = parseInt(img_reelle.height * echelle);
690              //============================================================
691
692              var Image_width;
693              if (rapport > 0)
694                  Image_width = parseInt(Image_height * rapport);
695              else if (Type_Img == "map") {
696                  Image_width = Zone_Affichage.width - marge_left - marge_right;
697              } else {
698                  Image_width = Zone_Affichage.width;
699              }
700
701              //===============================================================
702              align_auto = "center";
703              if (jQuery("#theImg").css("textAlign"))
704                  align_auto = jQuery("#theImg").css("textAlign");
705              var widthmin = winwidth;
706
707              if (check_auto_w == 'checked="checked"') {
708                  // if (Type_Img != "pamoorama" && Type_Img != "panorama" ) {
709                  //==== largeur à atteindre ===
710                  var width_user = eval(user_status + "_width");
711                  // Largeur maximale en fonction du statut
712                  if (width_user.match(reg1))
713                  // pourcentage
714                      widthmin = widthmin * parseInt(width_user) / 100;
715                  else
716                      widthmin = parseInt(width_user);
717                  var marges = marges_llgbo;
718                  widthmin -= info_img.borderwidth.left;
719                  widthmin -= info_img.borderwidth.right;
720
721                  widthmin -= marges;
722                  if (Image_width > widthmin) {
723                      //   Image_width largeur à atteindre
724                      //  Calcul du rapport d'agrandissement
725                      var echelle_w = parseFloat((widthmin) / img_reelle.width, 3);
726                      if (echelle_w > echelle_max) { echelle_w = echelle_max; }
727                      Image_width = parseInt(img_reelle.width * echelle_w);
728                      if (rapport > 0)
729                          Image_height = parseInt(Image_width / rapport);
730                  }
731
732
733
734              }
735
736
737              // }
738              //===================================================
739
740
741
742              zoom = echelle;
743              //=============LLGBO2 ===========================
744
745
746              if (marges_llgbo > 0) {
747
748                  t1 = jQuery(llgboframe).info();
749                  if (!TheImg.src) {
750                      TheImg = jQuery(TheImg).find("img").get(0)
751                  }
752                  if (TheImg.src) {
753
754                      Image_width -= marges_llgbo; // réduction frame
755                      Image_height -= marges_llgbo; // réduction frame
756                      if (rapport > 1) {
757                          if (Image_width > winwidth) {
758                              jQuery("#gbo").outerWidth(winwidth);
759                              jQuery("#gbo").css("width", winwidth + "px");
760                          }
761                          else {
762                              jQuery("#gbo").outerWidth(Image_width);
763                              jQuery("#gbo").css("width", Image_width + "px");
764                          }
765
766                          t1 = jQuery("#gbo div:last").info();
767
768                          Image_width = t1.width - (t1.borderwidth.left + t1.borderwidth.right);
769                          Image_height = parseInt(Image_width / rapport);
770
771                          jQuery("#gbo").outerHeight(Image_height + marges_llgbo);
772                          jQuery("#gbo").css("height", (Image_height + marges_llgbo) + "px");
773                          if (jQuery.browser.msie) {
774                              jQuery("#gbo").css("paddingBottom", 17 + "px");
775                          }
776
777                      } else {
778                          Image_height -= 4;
779                          Image_width -= 4;
780                          if (Image_width > winwidth) {
781                              jQuery("#gbo").outerWidth(winwidth);
782                              jQuery("#gbo").css("width", winwidth + "px");
783                          }
784                          else {
785                              jQuery("#gbo").outerWidth(Image_width);
786                              jQuery("#gbo").css("width", Image_width + "px");
787                          }
788
789                          jQuery("#gbo").css("height", (Image_height + marges_llgbo) + "px");
790                          jQuery("#gbo").height(Image_height + marges_llgbo);
791
792                          jQuery("#gbo").css("width", Image_width + marges_llgbo + "px");
793                          jQuery("#gbo").width(Image_width + marges_llgbo);
794
795
796
797                          if (jQuery.browser.msie) {
798                              jQuery("#gbo").css("paddingBottom", 17 + "px");
799                          }
800
801                      }
802                      //  jQuery("#" + Parent + " p:not(:contains(' ')) ").remove();
803                      a0 = jQuery("area[rel!=up][rel!=prev][rel!=next]");
804                      a1 = jQuery("area[rel=prev]");
805                      a2 = jQuery("area[rel=next]");
806                      a3 = jQuery("area[rel=up]");
807                      nb_zone = 3;
808                      if (a1.length == 0) {
809                          nb_zone -= 1;
810                      }
811                      if (a2.length == 0) {
812                          nb_zone -= 1;
813                      }
814
815
816                      var Largeur_zone = (Image_width / nb_zone);
817                      var Hauteur_zone = (Image_height);
818                      var init_zone = 0;
819
820                      if (a1.length > 0) {
821                          coord = { x0: init_zone, y0: 0, x1: Largeur_zone, y1: Hauteur_zone };
822
823                          jQuery("area[rel=prev]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
824                          init_zone += Largeur_zone;
825                      }
826
827                      coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: Image_height };
828
829                      if (a0.length > 0) {
830                          jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1 / 2) + "'" });
831                          jQuery(a0).attr({ coords: "'" + coord.x0 + "," + (coord.y1 / 2) + "," + coord.x1 + "," + (coord.y1) + "'" });
832                      } else {
833                          jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1) + "'" });
834                      }
835                      init_zone += Largeur_zone;
836
837                      if (a2.length > 0) {
838                          coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: Image_height };
839                          jQuery("area[rel=next]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
840                      }
841                  }
842              }
843
844              //================ Zone affichage =========================
845              //  Image_height, Image_width = valeur a atteindre.
846              if (theme.match(RegExp("luciano", "g"))) {
847                  //---- information en dehors du cadre
848                  Zone_Affichage.height -= Bandeau_bas.height;
849                  jQuery(Cadre).height(Zone_Affichage.height);
850
851              }
852
853              //=========================================================
854
855              //  jQuery(Cadre).css("top", "0px");
856              jQuery("#standard").css("top", 0 + "px");
857              jQuery("#comments").css("top", 0 + "px");
858
859
860              jQuery(Cadre).width(Zone_Affichage.width);
861
862              //==============================================================
863
864              img_finale.height = Image_height;
865              img_finale.width = Image_width;
866
867              //=========================================================================
868
869
870              if (typeof (gmaps) != "undefined") {
871                  Gmap_ = gmaps.maps[0];
872                  if (Gmap_.sizeMode == 'A') {
873                      jQuery("#iGMapsIcon").css({ width: old_w * 0.8 + "px", height: old_h * 0.8 + "px" });
874
875                  }
876              }
877              //==============================================================
878              if (Type_Img == "charlie") {
879                  t1 = jQuery("#charlie").info();
880                  /**/
881                  pdf = 2 * parseInt(jQuery(".none_2").css("paddingRight"));
882                  jQuery("#charlie").css({
883                      width: Image_width + pdf,
884                      height: Image_height,
885                      margin: "auto"
886                  });
887
888
889                  jQuery("#player").css("width", Image_width + 100 + "px");
890                  jQuery("#player").css("height", Image_height);
891
892                  jQuery("#embedplayer").css("width", Image_width);
893                  jQuery("#embedplayer").css("height", Image_height);
894
895
896                  jQuery("object").width(Image_width);
897                  jQuery("object").height(Image_height);
898              } else if (Type_Img == "panorama") {
899
900                  // -----     jQuery(TheImg).panorama2(img_finale.height, img_finale.width);
901                  // jQuery(TheImg).height(img_finale.height);
902                  // jQuery(TheImg).width(img_finale.width);
903                  jQuery("#Panorama div").height(Image_height);
904                  //  class=simple_panorama
905
906                  jQuery(".panorama-viewport").css("left", "2px");
907                  jQuery(".panorama-viewport").css("width", "auto");
908                  //   setTimeout("cl_Timer()", 500);
909
910              } else if (Type_Img == "pamoorama") {
911
912                  img_height = myPamoorama.imageHeight
913
914                  marge_left += 0;
915                  new_width = Zone_Affichage.width - marge_right - marge_left;
916                  new_width -= 4;
917                  jQuery("#pamoorama").css({ marginLeft: "auto",
918                      marginRight: "auto",
919
920                      height: Image_height + info_pamoorama_footer.height + "px",
921                      width: new_width + "px"
922                  });
923
924                  myPamoorama.options.width = new_width;
925                  jQuery("#pamoorama").width(new_width);
926
927
928
929
930                  jQuery("#pamoorama_outter").css({
931                      left: marge_left + "px",
932                      height: myPamoorama.imageHeight + "px",
933                      width: (new_width) + "px"
934                  });
935                  jQuery("#pamoorama_outter").width(new_width);
936                  h = info_theImage.height;
937                  jQuery("#pamoorama").css({ height: h + "px" });
938
939                  jQuery("#pamoorama_footer").width(new_width);
940                  jQuery("#pamoorama_footer").css('width', new_width + "px");
941
942                  jQuery("#linkNext").css({ width: "200px", overflow: "hidden" });
943                  jQuery("#linkPrev").css({ width: "200px", overflow: "hidden" });
944                  zoom = Image_height / img_height;
945                 
946
947
948
949              } else if (TheImg.src) {
950                  //--- background ?? ---
951                  jQuery(TheImg).height(img_finale.height);
952                  jQuery(TheImg).width(img_finale.width);
953                  jQuery(TheImg).css("height", img_finale.height + "px");
954                  jQuery(TheImg).css("width", img_finale.width + "px");
955
956              } else {
957                  //===map ? ===
958                  jQuery(TheImg).height(img_finale.height);
959                  jQuery(TheImg).width(img_finale.width);
960                  jQuery(TheImg).css("height", img_finale.height + "px");
961                  jQuery(TheImg).css("width", img_finale.width + "px");
962
963              }
964
965              /*
966              jQuery("#Debug1").css({
967              position: "absolute",
968              top: Bandeau + "px",
969              textAlign: align_auto,
970              margin: "0px auto",
971
972
973              border: "solid 1px red",
974
975              width: Image_width + "px",
976              height: Image_height + "px"
977
978              });
979              //===================================================
980              jQuery("#Debug2").css({ position: "absolute",
981              left: Zone_Affichage.left + 'px',
982              border: "solid 1px green",
983              top: Zone_Affichage.top + "px",
984              width: Zone_Affichage.width / 2 + "px",
985              height: Zone_Affichage.height + "px"
986
987              });
988              jQuery("#Debug2").text(info_Cadre.bottom);
989              */
990
991              try {
992                  if (theme.match(RegExp("gally", "g"))) {
993
994                      //===========================================================================
995
996                      if (jQuery("#navThumbPrev").length > 0) {
997                          jQuery("#navThumbPrev").css({ height: info_img.height + "px",
998                              top: info_img.top
999                          });
1000                      }
1001                      if (jQuery("#navThumbNext").length > 0) {
1002                          jQuery("#navThumbNext").css({ height: info_img.height + "px",
1003                              top: info_img.top
1004                          });
1005                      }
1006                      if (!theme.match(RegExp("lapis", "gi"))) { }
1007                  } else if (theme.match(RegExp("simple", "g"))) {
1008
1009                      jQuery("#imageToolBar").css("position", "static");
1010                      info_imageInfoBar = jQuery("#imageInfoBar").info();
1011                      if (info_imageInfoBar.bottom < info_img.bottom) {
1012                          jQuery("#imageInfoBar").height(info_img.bottom);
1013                      }
1014
1015                  } else {
1016
1017                      //    jQuery("#imageToolBar").css("position", "static");
1018                  }
1019              } catch (e) {
1020
1021              }
1022              // 
1023              if (!pos) pos = jQuery("#copyright").info();
1024              if (pos != jQuery("#copyright").info())
1025                  pos = jQuery("#copyright").info();
1026              if (pos.top > 100) jQuery("#the_page").height(pos.top);
1027              if (old_w == jQuery(window).width() && old_h == jQuery(window).height()) return;
1028              jQuery(window).resize();
1029              return;
1030          });
1031          var pos;
1032          //===================================================================   
1033          jQuery(window).resize();
1034          /*
1035          * recherche la plus grande image (hauteur ou largeur)
1036          */
1037
1038
1039          function Get_Img_Maxi(myobj) {
1040              var w00 = 0;
1041              var TheImg = null;
1042              jQuery(myobj).each(function (i) {
1043                  w0 = img_reelle.width;
1044                  h0 = img_reelle.height;
1045                  if (h0 > w0) w0 = h0;
1046                  if (w0 > w00) {
1047                      if (!this.src.match(RegExp(".png", "g")))
1048                          if (!this.src.match(RegExp(thumbnail, "g"))) {
1049                              TheImg = this;
1050                              w00 = w0;
1051                          }
1052
1053                  }
1054              });
1055              return TheImg;
1056          }
1057
1058
1059      } // function
1060);                                                                                                                                                                                                                                                                                                                                                                                                                                                          // ready
1061    /*
1062*
1063*/
1064    jQuery.extend(jQuery.expr[':'], {
1065        // Nom du sélecteur personnalisé
1066        Description: function (a) {
1067            n = jQuery(a).info();
1068            return a;
1069
1070        }
1071    });
1072
1073    /* Extension
1074    * absolutize:
1075    * relativize:
1076    */
1077//=========================================================
1078    jQuery.fn.extend({
1079        recentrage_widget: function () {
1080            jQuery('html,body').stop().scrollTop(0);
1081            jQuery('html,body').stop().scrollLeft(0);
1082            jQuery(".ui-widget-overlay").css("opacity", "0.75");
1083
1084            l1 = (jQuery(window).width() - (jQuery(".gmapsPopup").width()))/2;
1085            h1 = (jQuery(window).height() - (jQuery(".gmapsPopup").height()))/2;
1086 
1087            jQuery(".gmapsPopup").css("left", l1 + "px");
1088            jQuery(".gmapsPopup").css("top", h1 + "px");
1089
1090        },
1091        //-------------------------------------------------------
1092        absolutize: function (element) {
1093            element = jQuery(element).get(0);
1094            if (element.getStyle('position') == 'absolute') return;
1095            // Position.prepare(); // To be done manually by Scripty when it needs it.
1096
1097            var offsets = element.positionedOffset();
1098            var top = offsets[1];
1099            var left = offsets[0];
1100            var width = element.clientWidth;
1101            var height = element.clientHeight;
1102
1103            element._originalLeft = left - parseFloat(element.style.left || 0);
1104            element._originalTop = top - parseFloat(element.style.top || 0);
1105            element._originalWidth = element.style.width;
1106            element._originalHeight = element.style.height;
1107
1108            element.style.position = 'absolute';
1109            element.style.top = top + 'px';
1110            element.style.left = left + 'px';
1111            element.style.width = width + 'px';
1112            element.style.height = height + 'px';
1113            return element;
1114        },
1115
1116        relativize: function (element) {
1117            element = jQuery(element).get(0); ;
1118            if (jQuery(element).css('position') == 'relative') return;
1119            // Position.prepare(); // To be done manually by Scripty when it needs it.
1120            element._originalLeft = parseFloat(element.style.left || 0);
1121            element._originalTop = parseFloat(element.style.top || 0);
1122            element._originalWidth = element.style.width;
1123            element._originalHeight = element.style.height;
1124
1125            element.style.position = 'relative';
1126            var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
1127            var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
1128
1129            element.style.top = top + 'px';
1130            element.style.left = left + 'px';
1131            //  element.style.height = element._originalHeight;
1132            // element.style.width  = element._originalWidth;
1133            return element;
1134        }
1135        //=========================================================
1136    });          // fin extend
Note: See TracBrowser for help on using the repository browser.