Changeset 16638 for extensions/Autosize


Ignore:
Timestamp:
Jul 12, 2012, 12:33:43 PM (12 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix compatibility with 2.4, fix offset right

Location:
extensions/Autosize/js
Files:
2 edited

Legend:

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

    r16624 r16638  
    377377      var winwidth = infos_body.width;
    378378      var winheight = infos_body.height;
    379       nds = jQuery("#imageInfos").css("display"); //inline-block //block simple
    380       nds1 = jQuery("#menubar").css("display"); //inline
    381379      if (Type_Img == "pamoorama") {
    382380        theMainImage_obj = "#pamoorama";
    383       }
    384       Zone_image = Calcul_Image(nds == "none");
     381        Zone_image = Calcul_Image(infos_imageInfos.visible == false);
     382      } else {
     383        Zone_image = Calcul_Image(infos_imageInfos.visible == false);
     384      }
    385385      //=================================================================
    386386      old_window = jQuery(window).infos();
     
    577577      jQuery(theMainImage_obj).height(Zone_image.image.height);
    578578      jQuery(theMainImage_obj).width(Zone_image.image.width);
     579     
    579580      return true;
    580581
     
    11941195        //=============================================================
    11951196        infos_pamoorama = jQuery("#pamoorama").infos();
    1196         new_width = infos_pamoorama.width - (infos_pamoorama.borderwidth.left + infos_pamoorama.borderwidth.right);
    1197         Zone_image = Calcul_Image(false);
    1198         Set_Pamoorama();
    11991197        if (Math.abs(infos_pamoorama.height) < 50) {
    12001198          setTimeout("Wait_pamoorama()", 500);
     
    12031201        nopano = true;
    12041202        theMainImage_obj = "#pamoorama";
     1203
    12051204      }
    12061205    } // Wait_pamoorama
     
    15661565        if (!nopano) {
    15671566          Wait_pamoorama();
     1567         
    15681568        }
    15691569        infos_img = jQuery(theMainImage_obj).infos();
    15701570        infos_footer = jQuery("#pamoorama_footer").infos();
    1571 
    15721571        infos_img.height += parseInt(infos_img.height) + parseInt(infos_footer.height);
    15731572
     
    18091808        th = infos_body.height;
    18101809        tw = infos_body.width;
    1811 
    1812         nds = jQuery("#imageInfos").css("display"); //inline-block
    1813         Zone_image = Calcul_Image(nds == "none");
     1810        infos_imageInfos
     1811
     1812        Zone_image = Calcul_Image(infos_imageInfos.visible == false);
    18141813        n0 = 0;
    18151814        n1 = 0;
     
    18821881        }
    18831882
    1884 
     1883        Zone_image = Calcul_Image(infos_imageInfos.visible == false);
    18851884        infos_pamoorama = jQuery("#pamoorama").infos();
    18861885        infos_pamoorama_outter = jQuery("#pamoorama_outter").infos();
     
    20782077      }
    20792078
    2080       retrait_w = Math.ceil(infos_theImage.margin.left
    2081                                 + infos_theImage.margin.right
    2082                                 + infos_theImage.borderwidth.left
    2083                                 + infos_theImage.borderwidth.right
    2084                                 + infos_theImage.padding.left
    2085                                 + infos_theImage.padding.right);
    2086 
    2087 
    2088       retrait_w += Math.ceil(infos_the_page.margin.left
    2089                                 + infos_the_page.margin.right
    2090                                 + infos_the_page.borderwidth.left
    2091                                 + infos_the_page.borderwidth.right
    2092                                 + infos_the_page.padding.left
    2093                                 + infos_the_page.padding.right);
    2094 
    2095       retrait_w += Math.ceil(infos_body.margin.left +
    2096                                 infos_body.margin.right);
    2097 
    2098       retrait_w += Math.ceil(infos_content.margin.left +
    2099                                 infos_content.margin.right);
     2079      retrait_w = Math.ceil(infos_theImage.general.marges.width
     2080
     2081                                );
     2082
     2083
     2084      retrait_w += Math.ceil(infos_the_page.general.marges.width
     2085
     2086                                );
     2087
     2088      retrait_w += Math.ceil(infos_body.general.marges.width);
     2089
     2090      retrait_w += Math.ceil(infos_content.general.marges.width);
    21002091
    21012092
    21022093      pos_top = Math.ceil(infos_theImageAndInfos.top
    2103                      + infos_theImageAndInfos.margin.top
    2104                      + infos_content.borderwidth.top
    2105                      + infos_content.borderwidth.bottom
    2106                      + infos_content.margin.top
    2107                      + infos_content.margin.bottom);
     2094                     + infos_theImageAndInfos.general.marges.height
     2095);
    21082096
    21092097      retrait_h = Math.ceil(pos_top
    21102098                         + infos_theImage.margin.top
    2111                                 + infos_theImage.margin.bottom
    2112                                 + infos_theImage.borderwidth.top
    2113                                 + infos_theImage.borderwidth.bottom
    2114                                 + infos_theImage.padding.top
    2115                                 + infos_theImage.padding.bottom);
     2099                                + infos_theImage.general.marges.height
     2100                                );
    21162101
    21172102
     
    21202105      });
    21212106
    2122       retrait_img = Math.ceil(infos_theMainImage.borderwidth.left
    2123                     + infos_theMainImage.borderwidth.right
    2124                     + infos_theMainImage.padding.left
    2125                     + infos_theMainImage.padding.right);
    2126       retrait_img += Math.ceil(infos_llgbo.borderwidth.right + infos_llgbo.borderwidth.right);
    2127 
     2107      retrait_img = Math.ceil(
     2108                      infos_theMainImage.general.marges.width
     2109                    );
     2110      retrait_img += Math.ceil(
     2111                       infos_llgbo.borderwidth.left
     2112                     + infos_llgbo.borderwidth.right
     2113                     );
     2114
     2115      retrait_img += Math.ceil(
     2116                                  infos_the_page.general.marges.width
     2117                                );
    21282118
    21292119
    21302120
    21312121      //  menuSwitcherwidth+padding
     2122
    21322123
    21332124      if (theme.match(RegExp("elegant", "gi"))) {
    21342125        if (all_width != true) {
    2135           new_width = Math.ceil(
    2136                                 infos_imageInfos.width +
    2137                                 infos_imageInfos.borderwidth.left +
    2138                                 infos_imageInfos.borderwidth.right +
    2139                                 infos_imageInfos.margin.left +
    2140                                 infos_imageInfos.borderwidth.right +
    2141                                 infos_imageInfos.padding.left +
    2142                                 infos_imageInfos.padding.right);
    2143      
     2126          marge_right = infos_imageInfos.general.width;
    21442127        } else {
    2145           new_width = 0;
    2146         }
    2147         width_theImage = (infos_body.width - new_width)
    2148         retrait_w += 20; //???
     2128          marge_right = 0;
     2129        }
     2130
     2131        wx1 = infos_theImage.general.width;
     2132        width_theImage = (infos_body.width - marge_right - 1)
     2133
    21492134
    21502135      } else if (theme.match(RegExp("stripped", "gi"))) {
     
    21592144        marginLeft = infos_content.margin.left;
    21602145        infos_menubar_dl = jQuery("#menubar dl").infos();
    2161         marginLeft = infos_menubar_dl.margin.left + infos_menubar_dl.left + infos_menubar_dl.width;
     2146        marginLeft = infos_menubar_dl.margin.left
     2147                    + infos_menubar_dl.left
     2148                    + infos_menubar_dl.width;
    21622149        if (infos_menubar_dl.visible == "false")
    21632150         if (!theme.match(RegExp("sylvia", "gi")))
     
    22672254    marge_basse = 0;
    22682255    if (conf.MargeBasse)
    2269       marge_basse = jQuery().Get_Val_int(conf.MargeBasse);
     2256      marge_basse = jQuery(Obj).Get_Val_int(conf.MargeBasse);
    22702257    marge_top = 0;
    22712258    if (conf.MargeHaute)
    2272       marge_top = jQuery().Get_Val_int(conf.MargeHaute);
     2259      marge_top = jQuery(Obj).Get_Val_int(conf.MargeHaute);
    22732260    infos_Obj = jQuery(Obj).infos();
    22742261    h1_left = jQuery(Obj).absoluteLeft();
  • extensions/Autosize/js/autosize.dimensions.js

    r16624 r16638  
    88* $LastChangedDate: 2010-10-23 08:43:48 -0600 (Thu, 20 Dec 2007) $
    99* By cljosse
    10 * Version: 1.2
     10* Version: 1.3
    1111*
    1212* Requires: jQuery 1.2+
     
    135135        if (elem.nodeName) nodeName = elem.nodeName;
    136136
    137 
     137        width = jQuery(elem).width();
     138        height = jQuery(elem).height();
    138139        if (elem == window) {
    139140
     
    141142          width = jQuery(elem).width();
    142143          height = jQuery(elem).height();
     144          out_width = width;
     145          out_height = height;
    143146        } else {
    144147
    145148          Css = jQuery(elem).getStyles(elem);
    146149          myposition = Css.position.toString() || "";
    147           width = jQuery(elem).outerWidth();
    148           height = jQuery(elem).outerHeight();
     150          out_width = jQuery(elem).outerWidth();
     151          out_height = jQuery(elem).outerHeight();
    149152          elem_parent =elem.parentElement;
    150153          if (typeof elem_parent == "undefined") {
    151154            elem_parent = window;
    152155          }
     156          out_width = jQuery(elem).outerWidth();
     157          out_height = jQuery(elem).outerHeight();
     158          in_width = jQuery(elem).innerWidth();
     159          in_height = jQuery(elem).innerHeight();
    153160          if (typeof Css.width != "undefined")
    154             width = jQuery(elem).Get_Val_int(Css.width, jQuery(elem_parent).width(), 0);
     161            width = Get_Val_int(Css.width, jQuery(elem_parent).width(), 0);
    155162
    156163          if (typeof Css.height != "undefined")
    157             height = jQuery(elem).Get_Val_int(Css.height, jQuery(elem_parent).height(), 0);
    158 
    159 
    160 
    161 
    162 
    163 
    164           borderwidth.left = jQuery(elem).Get_Val_int(Css.borderLeftWidth, "", "", 'borderLeftWidth');
    165           borderwidth.right = jQuery(elem).Get_Val_int(Css.borderRightWidth, "", "", 'borderRightWidth');
    166           borderwidth.top = jQuery(elem).Get_Val_int(Css.borderTopWidth, "", "", 'borderTopWidth');
    167           borderwidth.bottom = jQuery(elem).Get_Val_int(Css.borderBottomWidth, "", "", 'borderBottomWidth');
     164            height = Get_Val_int(Css.height, jQuery(elem_parent).height(), 0);
     165
     166
     167          borderwidth.left = Get_Val_int(Css.borderLeftWidth, "", "", { elem: elem, prop: 'borderLeftWidth' });
     168          borderwidth.right = Get_Val_int(Css.borderRightWidth, "", "", { elem: elem, prop: 'borderRightWidth' });
     169          borderwidth.top = Get_Val_int(Css.borderTopWidth, "", "", { elem: elem, prop: 'borderTopWidth' });
     170          borderwidth.bottom = Get_Val_int(Css.borderBottomWidth, "", "", { elem: elem, prop: 'borderBottomWidth' });
    168171          try {
    169172            borderwidth.width = Css.borderWidth;
     
    172175          }
    173176
    174 
    175 
    176           margin.left = jQuery(elem).Get_Val_int(Css.marginLeft, "", "", 'marginLeft');
    177           margin.right = jQuery(elem).Get_Val_int(Css.marginRight, "", "", 'marginRight');
    178           margin.top = jQuery(elem).Get_Val_int(Css.marginTop, "", "", 'marginTop');
    179           margin.bottom = jQuery(elem).Get_Val_int(Css.marginBottom, "", "", 'marginBottom');
     177          margin.left = Get_Val_int(Css.marginLeft, "", "", { elem: elem, prop: 'marginLeft' });
     178          margin.right = Get_Val_int(Css.marginRight, "", "", { elem: elem, prop: 'marginRight' });
     179          margin.top = Get_Val_int(Css.marginTop, "", "", { elem: elem, prop: 'marginTop' });
     180          margin.bottom = Get_Val_int(Css.marginBottom, "", "", { elem: elem, prop: 'marginBottom' });
    180181
    181182
     
    187188
    188189
    189           padding.left = jQuery(elem).Get_Val_int(Css.paddingLeft, "", "", 'paddingLeft');
    190           padding.right = jQuery(elem).Get_Val_int(Css.paddingRight, "", "", 'paddingRight');
    191           padding.top = jQuery(elem).Get_Val_int(Css.paddingTop, "", "", 'paddingTop');
    192           padding.bottom = jQuery(elem).Get_Val_int(Css.paddingBottom, "", "", 'paddingBottom');
     190          padding.left = Get_Val_int(Css.paddingLeft, "", "", { elem: elem, prop: 'paddingLeft' });
     191          padding.right = Get_Val_int(Css.paddingRight, "", "", { elem: elem, prop: 'paddingRight' });
     192          padding.top = Get_Val_int(Css.paddingTop, "", "", { elem: elem, prop: 'paddingTop' });
     193          padding.bottom = Get_Val_int(Css.paddingBottom, "", "", { elem: elem, prop: 'paddingBottom' });
    193194
    194195          try {
     
    208209       visible= jQuery(elem).is(':visible');
    209210        results = {src: elem.src || "none",
    210           visible: visible || "false",
     211          visible: visible || false,
    211212          position: myposition,
    212213          top: Top,
    213214          left: Left,
    214           width: width,
     215          width: width,  // valeur interieur
    215216          height: height,
    216217          right: Left + width,
    217218          bottom: Top + height,
     219
     220          padding: padding,
     221
     222          out: {
     223            width: in_width,
     224            height: in_height,
     225            right: Left + in_width,
     226            bottom: Top + in_height
     227          },
    218228          borderwidth: borderwidth,
     229          exterieur: {
     230            width: out_width,
     231            height: out_height,
     232            right: Left + out_width,
     233            bottom: Top + out_height
     234          },
    219235          margin: margin,
    220           padding: padding,
     236          general: {
     237            width: out_width + margin.left + margin.right,
     238            height: out_height + margin.top + margin.bottom,
     239            right: Left + out_width + margin.left + margin.right,
     240            bottom: Top + out_height + margin.top + margin.bottom,
     241            marges: { height: margin.top + borderwidth.top + padding.top +
     242                              margin.bottom + borderwidth.bottom + padding.bottom,
     243              top: margin.top + borderwidth.top + padding.top,
     244              bottom: margin.bottom + borderwidth.bottom + padding.bottom,
     245              width: margin.left + borderwidth.left + padding.left +
     246                              margin.right + borderwidth.right + padding.right,
     247              left: margin.left + borderwidth.left + padding.left,
     248              right: margin.right + borderwidth.right + padding.right
     249            }
     250
     251
     252          },
    221253          id: id,
    222254          nodeName: nodeName
     
    295327      return propriete;
    296328    },
    297     /*
     329    Get_Val_int: function (myObj, Maxi_val, Mini_val, prop) {
     330
     331      return Get_Val_int(myObj, Maxi_val, Mini_val, prop);
     332    }
     333  });
     334
     335  /**************************
    298336    * Get_val_int
    299337    * params: element,valeur maxi
    300338    * return: valeur entiere
    301     */
    302 
    303     Get_Val_int: function (myObj, Maxi_val, Mini_val, prop) {
     339  ******************************/
     340  Get_Val_int = function (myObj, Maxi_val, Mini_val, prop) {
     341
    304342      var val = 0;
    305343      Maxi_val = parseInt(Maxi_val || "0");
     
    336374            break;
    337375        }
    338         el = this.get(0);
     376
    339377        var reg1 = new RegExp("auto", "g");
    340378        if (myObj.match(reg1)) {
    341379          return Maxi_val;
    342380        }
    343         if (prop)
    344           myObj = num(el, prop);
    345         else {
     381
     382      if (prop) {
     383
     384        myObj = num(prop.elem, prop.prop);
     385      } else {
    346386          reg1 = new RegExp("px", "g");
    347387          if (myObj.match(reg1)) {
    348388
    349             myObj = parseInt(myObj);
     389          myObj = Parse_Int(myObj);
    350390
    351391          } else {
     
    356396              return val;
    357397            }
    358 
    359           }
    360 
    361         }
    362 
     398          }
     399        }
    363400        if (Mini_val)
    364401          if (myObj < Mini_val) return Maxi_val;
    365 
    366 
    367         val = parseInt(myObj);
     402      val = Parse_Int(myObj);
    368403
    369404      } else {
    370         val = parseInt(myObj);
     405      val = Parse_Int(myObj);
    371406      }
    372       if (typeof (val) == "NaN") return Maxi_val;
     407    if (typeof (val) == "NaN")
     408      return Maxi_val;
    373409      return val;
     410
    374411    }
    375   });
     412
    376413  /*
    377414  *
    378415  */
     416  function Parse_Int(valeur_num) {
     417  if (!jQuery.isNumeric(valeur_num)){
     418    valeur_num = valeur_num.toString();
     419    reg1 = new RegExp("px", "gi");
     420    if (valeur_num.match(reg1)) {
     421        valeur_num = valeur_num.replace(reg1, "");
     422    } else {
     423        valeur_num = valeur_num.replace(reg1, "");
     424    }
     425   }
     426    valeur_num = Math.ceil(valeur_num);
     427    return valeur_num || 0;
     428  }
     429
    379430  function num(el, prop) {
    380     return parseInt(jQuery.curCSS(el.jquery ? el[0] : el, prop, true)) || 0;
     431    valeur_num = jQuery.curCSS(el.jquery ? el[0] : el, prop, true);
     432
     433    return Parse_Int(valeur_num);
    381434  };
    382435
Note: See TracChangeset for help on using the changeset viewer.