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

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

[Autosize][beta] fix bug with pamooramic...

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