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

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

[Autosize][beta] save.

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