Ignore:
Timestamp:
Sep 25, 2012, 12:36:16 PM (12 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix compatibility with 2.4, store typesize

File:
1 edited

Legend:

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

    r18127 r18234  
    443443      marges_llgbo = 0;
    444444      //==========================================================================================
    445        
     445
    446446      init_gen();
    447447      jQuery(window).resize();
     
    511511    jQuery("#form_autosize_picture").addClass("Autosize_margin");
    512512    //===== marges suplémentaires en fonction theme ===
     513    options.valide = jQuery(".Autosize_margin").css("display");
    513514    options.marge_haute = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("top"));
    514515    options.marge_basse = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("bottom"));
     
    551552    var pictureDeriv_maxi = eval("options." + user_status + "_type"); //limite taille
    552553
     554    if (pictureDeriv_maxi != pictureDeriv) {
     555      if (pictureDeriv == null)
     556        pictureDeriv = pictureDeriv_maxi;
     557      else
     558        pictureDeriv_maxi = pictureDeriv;
     559    }
    553560
    554561
     
    919926        theImg.removeAttribute("width");
    920927        theImg.removeAttribute("height");
     928
    921929        // jQuery(theMainImage_id).eq(0).removeAttr("style");
    922930        jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
     
    933941          jQuery("#loading").hide(0);
    934942        }
    935         Zone_image.src = theImg.src;
    936         theImg.src = url; // charge Image       
     943
     944        theImg.src = url; // charge Image   
     945        if (Zone_image) {
     946          Zone_image.src = theImg.src;
     947          Zone_image.image_init = { width: jQuery(theImg).width(), height: jQuery(theImg).height() };
     948
     949        }
    937950        //===================================================
    938951        options.pictureDeriv = typeSave;
     
    12961309          vn = this;
    12971310          size_derive = { w: parseInt(vn[2]), h: parseInt(vn[3]) };
     1311          if (vn[0] == options.select_type) {
     1312            maxi_size = size_derive;
     1313            maxi_size.idx = n;
     1314            return false
     1315          }
    12981316          if (vn[0] != "square" && vn[0] != "thumb" && vn[0] != "SelMaxi" && vn[0] != "Autosize") {
    12991317            if (size_derive.h > size_encours.h) {
     
    13301348
    13311349    Select_Image = function () {
     1350
    13321351      var pt = options.liste_type;
    13331352      if (pt.length > 0) {
     
    13351354        //===== calcul Image ===
    13361355        Calcul_Image();
    1337         IMg = Get_Maxi(Zone_image.image);
     1356
     1357        if (options.select_type != "SelMaxi" && options.select_type != "Autosize") {
     1358         
     1359           IMg = Get_Maxi(Zone_image.image_init);
     1360        } else {
     1361          IMg = Get_Maxi(Zone_image.image);
     1362        }
     1363
     1364
    13381365        imgSrc = IMg.url;
    13391366
     
    13411368        ing_height = IMg.height;
    13421369        if (Type_Img == "pamoorama") return;
    1343         if (options.select_type != "SelMaxi" && options.select_type != "Autosize") return;
     1370        //  if (options.select_type != "SelMaxi" && options.select_type != "Autosize") return;
     1371
    13441372        if (typeof Zone_image.src == "undefined") Zone_image.src = " ";
    13451373        status = imgSrc.match(RegExp(Zone_image.src, "gi")); // status = '' si ==
     
    16141642      height_theMainImage = Math.ceil(image_max.height);
    16151643      width_theMainImage = Math.ceil(image_max.width);
     1644      if (typeof Zone_image.image_init.rapport == "undefined") {
     1645        Zone_image.image_init.rapport = Math.ceil(width_theMainImage) / height_theMainImage;
     1646      }
    16161647
    16171648      if (Type_Img == "pamoorama") {
     
    18701901        height = IMg.height;
    18711902      }
    1872       user_status = options.user_status;
    1873       pictureDeriv_maxi = eval("options." + user_status + "_type"); //limite taille
    1874       options.pictureDeriv_maxi = pictureDeriv_maxi;
    1875       pictureDeriv_maxi = options.select_type;
    1876 
     1903      if (pictureDeriv_maxi != options.select_type) {
     1904        /*
     1905        user_status = options.user_status;
     1906        pictureDeriv_maxi = eval("options." + user_status + "_type"); //limite taille
     1907        */
     1908        options.select_type = pictureDeriv_maxi;
     1909        options.pictureDeriv_maxi = pictureDeriv_maxi;
     1910        pictureDeriv_maxi = options.select_type;
     1911      }
    18771912      //==========================================================
    18781913      href_path = "javascript:changeImgSrc('" + options.src_img + "', '" + "SelMaxi" + "', '" + "SelMaxi" + "')";
     
    19571992    //_______________________ init_gen _______________________
    19581993
    1959   });                                                                                                                                                                                                                                          // ready
     1994  });                                                                                                                                                                                                                                                      // ready
    19601995
    19611996
Note: See TracChangeset for help on using the changeset viewer.