Ignore:
Timestamp:
Sep 28, 2012, 11:13:50 AM (12 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix compatibility with 2.4, add theme directive

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/js/Affiche_script.js

    r18234 r18325  
    99
    1010  jQuery(document).ready(function (jQuery) {
    11 
    12 
    13 
    14 
    1511    var Type_Img;
    1612    var theImg;
     
    7167      } else if (jQuery("#Panorama").length) {
    7268        Type_Img = "panorama";
     69
    7370      } else if (jQuery("#pamoorama").length) {
    7471        Type_Img = "pamoorama";
     72        options.valide = true;
     73
    7574      } else if (jQuery("#map").length) {
    7675        Type_Img = "map";
     
    276275          infos_theMainImage = jQuery("#pamoorama").infos(true);
    277276          theMainImage_id = "#pamoorama";
     277          options.valide = true;
    278278
    279279        } else {
     
    311311
    312312      jQuery("#loading").show(0);
    313       zheight = infos_window.height - (infos_theImage.top);
     313      if (infos_theImage.top > infos_window.height) {
     314        zheight = infos_window.height - infos_content.top;
     315      } else {
     316        zheight = infos_window.height - (infos_theImage.top);
     317      }
    314318      h01 = 0;
    315319      h02 = 0;
     
    332336
    333337        } else {
    334           options.marge_basse += Math.max(h01, h02);
     338          if (test_theme("stripped")) {
     339
     340          } else
     341            options.marge_basse += Math.max(h01, h02);
     342
    335343          if (test_theme("blanc , pure, hr_ ")) {
    336344            options.marge_gauche += 10;
     
    363371        jQuery(theImage_id).width(Zone_image.container.width);
    364372        jQuery(theImage_id).height(Zone_image.container.height);
     373
    365374      }
    366375
     
    369378      ***********************************************************/
    370379      jQuery(window).resize(function (event, ui) {
     380        if (!options.valide) {
     381          jQuery("#loading").hide(fade_in);
     382          return true;
     383        }
     384
    371385        infos_window = jQuery(window).infos();
    372386        infos_imageInfos = jQuery("#imageInfos").infos(true);
    373387        old_w = infos_theImage.width;
    374388        infos_theImage = jQuery(theImage_id).infos(true);
    375         if (options.set_sw) {
    376           if (Type_Img == "pamoorama") {
    377             if (options.set_sw == "menuSwitcher") {
    378 
    379             } else {
    380               p_width = jQuery(theImage_id).width();
    381             }
    382             if (infos_imageInfos.visible)
    383               p_width = infos_window.width - infos_theImage.left - infos_imageInfos.width - 20;
    384             else
    385               p_width = infos_window.width - infos_theImage.left - 20;
    386             jQuery(theImage_id).width(p_width);
    387             infos_theImage = jQuery(theImage_id).infos(true);
    388 
    389 
    390           }
    391         }
    392 
    393389        if (test_theme("simple")) {
    394390          jQuery(theMainImage_id).css({ maxWidth: "none" });
     
    421417
    422418        jQuery(theImage_id).height(Zone_image.container.height + 2);
    423 
    424 
    425 
    426 
    427         if (DEBUG_autosize == "no") return;
    428 
    429         Autosize_resize(true, options);
     419        if (options.valide && DEBUG_autosize != "no") {
     420
     421          Autosize_resize(true, options);
     422        }
    430423        jQuery("#loading").hide(fade_in);
    431424      });
     
    443436      marges_llgbo = 0;
    444437      //==========================================================================================
    445 
    446       init_gen();
    447       jQuery(window).resize();
    448       jQuery(window).resize();
    449 
     438      if (options.valide) {
     439
     440        init_gen();
     441        jQuery(window).resize();
     442        jQuery(window).resize();
     443
     444      }
     445      jQuery("#loading").hide(fade_in);
    450446    });
    451447    //__________________window.onload_________________
     
    509505    }
    510506
    511     jQuery("#form_autosize_picture").addClass("Autosize_margin");
     507    jQuery("#form_autosize_picture").addClass("Autosize");
    512508    //===== marges suplémentaires en fonction theme ===
    513     options.valide = jQuery(".Autosize_margin").css("display");
    514     options.marge_haute = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("top"));
    515     options.marge_basse = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("bottom"));
    516     options.marge_gauche = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("left"));
    517     options.marge_droite = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("right"));
     509    options.valide = jQuery(".Autosize").css("display") != "none";
     510
     511    options.marge_haute = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("top"));
     512    options.marge_basse = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("bottom"));
     513    options.marge_gauche = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("left"));
     514    options.marge_droite = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("right"));
    518515    fade_in = options.fade_in || 0;
    519516    imageComment_id = ".imageComment";
     
    558555        pictureDeriv_maxi = pictureDeriv;
    559556    }
    560 
     557    if (!options.valide) {
     558
     559      pictureDeriv = "medium";
     560      pictureDeriv_maxi = pictureDeriv;
     561      cookies.pictureDeriv = pictureDeriv;
     562      jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
     563      jQuery('#derivativeChecked' + options.pictureDeriv).css('visibility', 'visible');
     564      jQuery('#derivativeCheckedSelMaxi').hide();
     565      jQuery('#derivativeCheckedSelMaxi').next().hide();
     566      jQuery('#derivativeCheckedSelMaxi').next().next().hide();
     567      jQuery('#derivativeCheckedAutosize').hide();
     568      jQuery('#derivativeCheckedAutosize').next().hide();
     569      jQuery('#derivativeCheckedAutosize').next().next().hide();
     570    }
    561571
    562572    if (DEBUG_autosize == "no") return;
     
    882892    ***************************/
    883893    Autosize_resize = function (force, parametres) {
     894      sav_container = Zone_image.container;
    884895      if (Get_dimensions(force, parametres)) {
    885896        jQuery(theImageAndInfos_id).css({ height: "auto" });
     897        jQuery(theMainImage_id).removeAttr("width");
     898        jQuery(theMainImage_id).removeAttr("height");
     899
    886900        if (Type_Img == "pamoorama") {
    887           Set_Pamoorama({ width: Zone_image.container.width, height: Zone_image.image.height });
     901          Set_Pamoorama({ width: Zone_image.container.width, height: Zone_image.container.height });
    888902          if (nopano)
    889903            if (window.myPamoorama.options.autoscrollOnLoad) {
    890904              window.myPamoorama.startAnimRight();
    891905            }
    892         } else {
    893 
    894           jQuery(theMainImage_id).height(Zone_image.image.height);
     906          } else {
     907
     908          if (!options.slideshow) { jQuery(theMainImage_id).height(Zone_image.image.height); };
    895909          jQuery(theMainImage_id).width(Zone_image.image.width);
    896 
    897           if (test_theme("xxxxxxx")) {
    898             jQuery(theImage_id).css({ height: "auto" });
    899             jQuery(theImage_id).height(Zone_image.image.height + Zone_image.marges.height);
    900             jQuery(theImage_id).width(Zone_image.image.width + Zone_image.marges.width);
    901 
    902           }
     910         
     911
    903912        }
    904913
     
    906915        set_cl(true);
    907916      } else {
    908         //   jQuery(theImage_id).height(Zone_image.image.height + Zone_image.marges.height);
     917
    909918        Set_Pamoorama({ width: Zone_image.container.width, height: Zone_image.image.height });
    910919        set_cl(false);
     
    13561365
    13571366        if (options.select_type != "SelMaxi" && options.select_type != "Autosize") {
    1358          
    1359            IMg = Get_Maxi(Zone_image.image_init);
     1367
     1368          IMg = Get_Maxi(Zone_image.image_init);
    13601369        } else {
    13611370          IMg = Get_Maxi(Zone_image.image);
     
    14811490
    14821491        //---------- test largeur image
    1483         new_width = Format.width;
     1492        new_width = Format.width - (options.marge_right + options.marge_left);
    14841493
    14851494        if (new_width > new_image.width) {
     
    17151724
    17161725      if (options.imageAutosize) {
    1717         return; //stripped
     1726        return true; //stripped
    17181727      }
    17191728
     
    19922001    //_______________________ init_gen _______________________
    19932002
    1994   });                                                                                                                                                                                                                                                      // ready
     2003  });                                                                                                                                                                                                                                                                         // ready
    19952004
    19962005
Note: See TracChangeset for help on using the changeset viewer.