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

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

[Autosize][beta] compatibility whith stripped


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