Ignore:
Timestamp:
Sep 20, 2010, 5:31:13 PM (14 years ago)
Author:
cljosse
Message:

[Autosize]Improvement theme compatibility.


File:
1 edited

Legend:

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

    r6954 r6978  
    11jQuery.noConflict();
    22jQuery(document).ready(
     3
     4
    35function (jQuery) {
     6    function Marge_haute(myObj, ajoute_h) {
     7        if (ajoute_h) h_p = parseInt(jQuery(myObj).height());
     8        else h_p = 0;
     9
     10        if (jQuery(myObj).css("marginTop"))
     11            if (jQuery(myObj).css("marginTop") != "auto") h_p += parseInt(jQuery(myObj).css("marginTop"));
     12        if (jQuery(myObj).css("marginBottom"))
     13            if (jQuery(myObj).css("marginBottom") != "auto") h_p += parseInt(jQuery(myObj).css("marginBottom"));
     14        if (jQuery(myObj).css("paddingTop"))
     15            if (jQuery(myObj).css("paddingTop") != "auto") h_p += parseInt(jQuery(myObj).css("paddingTop"));
     16        if (parseInt(jQuery(myObj).css("paddingBottom")))
     17            if (jQuery(myObj).css("paddingBottom") != "auto") h_p += parseInt(jQuery(myObj).css("paddingBottom"));
     18        return h_p;
     19    }
    420    //===================================================================       
     21
    522
    623
    724    jQuery(window).resize(function (event, ui) {
    825        if (typeof (event) == 'undefined') return;
     26
    927        var Type_Img = "";
    1028        //====== détection du type d'images ======
     
    2240            return;
    2341        }
     42
     43
    2444        //=================================================================
    2545        switch (Type_Img) {
    2646            case "img":
    2747                var Image = jQuery("#theImage").find("img");
    28                 var TheImg = jQuery(Image).get(0);
     48                var TheImg = jQuery("#theImg").find("img").get(0);
     49                if (!TheImg)
     50                    TheImg = jQuery(Image).get(0);
    2951                break
    3052            case "img_autre":
     
    3961                break
    4062            case "pamoorama":
     63                //=========================================================
    4164                var Images = jQuery("#pamoorama");
    4265                var Image = jQuery(Images).get(0);
     
    4467                var TheImg = jQuery("#pamoorama").get(0);
    4568                if (!TheImg) return;
     69                TheImg = jQuery("#pamoorama_inner");
     70                if (TheImg.length < 1) return;
     71
    4672                break
    4773        }
     
    4975        //==================================================================================
    5076        var sel0 = jQuery(TheImg).position();
     77
    5178        if (!sel0) return;
     79        type_pos = jQuery(TheImg).css("position"); //static
     80        if (jQuery(TheImg).css("position") == "relative") {
     81            sel0.top += Marge_haute("#theHeader", true);
     82            sel0.top += Marge_haute("#imageHeaderBar", true);
     83            sel0.top += Marge_haute(TheImg, false);
     84            if (jQuery("#theImage").css("marginTop"))
     85                if (jQuery("#theImage").css("marginTop") != "auto") sel0.top += parseInt(jQuery("#theImage").css("marginTop"));
     86            if (jQuery("#theImage").css("paddingTop"))
     87                if (jQuery("#theImage").css("paddingTop") != "auto") sel0.top += parseInt(jQuery("#theImage").css("paddingTop"));
     88
     89        }
    5290
    5391        mini_width = parseInt(mini_width);
     
    81119            for (var i = 0; i < Pars.length; i++) {
    82120                P0 = Pars.get(i);
    83                 h_p += parseInt(jQuery(P0).height());
    84              if (jQuery(P0).css("marginTop"))
    85                     if (jQuery(P0).css("marginTop") != "auto") h_p += parseInt(jQuery(P0).css("marginTop"));
    86              if (jQuery(P0).css("marginBottom"))
    87                     if (jQuery(P0).css("marginBottom") != "auto") h_p += parseInt(jQuery(P0).css("marginBottom"));
    88              if (jQuery(P0).css("paddingTop")) h_p += parseInt(jQuery(P0).css("paddingTop"));
    89              if (parseInt(jQuery(P0).css("paddingBottom"))) h_p += parseInt(jQuery(P0).css("paddingBottom"));
    90 
     121                h_p += Marge_haute(P0, true);
    91122            }
    92123
     
    101132        var Image_height = (winheight - sel0.top) - parseInt(marge_basse) - lmt;
    102133        var height_user = eval(user_status + "_height");
    103         var width_user = eval(user_status + "_width");
     134
    104135        //=============================================================
    105136        var reg1 = new RegExp("%", "g");
     
    108139        else
    109140            Image_height = parseInt(height_user);
    110         //=============================================================
     141
     142        //============================================================
    111143        echelle_max = parseFloat(echelle_max, '3');
    112144        var echelle = parseFloat(Image_height / H0, 3);
     
    117149        }
    118150
    119         var Imgage_Width = parseInt(Image_height * rapport);
    120         jQuery("#theImage").width("100%");
    121         jQuery("#theImage").height("auto");
    122 
    123 
     151        var Image_Width = parseInt(Image_height * rapport);
     152
     153        //===============================================================
     154        twidth = jQuery("#imageHeaderBar").width();
     155        img_la = jQuery(TheImg).width(); //initiale
     156        offset = jQuery(TheImg).position();
     157
     158        var winwidth = jQuery(window).width();
     159        var width_user = eval(user_status + "_width");
     160         
     161        if (check_auto_w == 'checked="checked"') {
     162            if (Type_Img != "pamoorama") {
     163                widthmin = (winwidth - offset.left);
     164
     165                if (Image_Width > widthmin) {
     166                    //=============================================================
     167                    if (width_user.match(reg1))
     168                        Image_Width = Image_Width * parseInt(width_user) / 100;
     169                    else
     170                        Image_Width = parseInt(width_user);
     171
     172                    var echelle_w = parseFloat(winwidth / W0, 3);
     173                    if (echelle_w > echelle_max) {
     174                        echelle_w = echelle_max;
     175                        Image_Width = parseInt(W0 * echelle_w);
     176                    }
     177                    Image_Width = parseInt(W0 * echelle_w);
     178                     
     179                    align_auto = "left";
     180                } else {
     181                   
     182                    align_auto = "center";
     183                }
     184                Image_height = parseInt(Image_Width / rapport);
     185
     186            }
     187
     188
     189        }
     190        //=============================================================
    124191
    125192        if (Type_Img == "pamoorama") {
    126             h1 = jQuery("#pamoorama").height();
    127             jQuery("#pamoorama").css("overflow", "hidden");
    128             jQuery("#pamoorama").css(jQuery(window).width() + "px");
    129  
     193
     194
     195            jQuery("#pamoorama").css("height", Image_height + "px");
     196            jQuery("#pamoorama").css("width", twidth + "px");
     197
     198            jQuery("#pamoorama").height(Image_height + "px");
     199            jQuery("#pamoorama").width(twidth + "px");
     200
     201
     202
     203            jQuery("#pamoorama_outter").height(Image_height + "px");
     204            jQuery("#pamoorama_outter").width(twidth + "px");
     205
    130206            jQuery("#pamoorama_outter").css("height", Image_height + "px");
    131             jQuery("#pamoorama_outter").css("width", jQuery(window).width() + "px");
    132 /*
    133             jQuery(TheImg).css(Image_height + "px");
    134             jQuery(TheImg).css(jQuery(window).width() + "px");
    135             */
     207            jQuery("#pamoorama_outter").css("width", twidth + "px");
     208
    136209            zoom = Image_height / img_height;
    137210
    138             jQuery("#pamoorama_inner").css("zoom", zoom);
     211            h_frame = jQuery("#pamoorama_frame").height();
     212            h_width = jQuery("#pamoorama_frame").width();
     213            jQuery(TheImg).css("zoom", zoom);
    139214
    140215
    141216
    142217        } else {
    143         jQuery(TheImg).height(Image_height + "px");
    144         jQuery(TheImg).width(Imgage_Width + "px");
     218            if (jQuery("#theImg").css("textAlign"))
     219                jQuery("#theImg").css("textAlign", align_auto);
     220 
     221            jQuery(TheImg).height(Image_height + "px");
     222            jQuery(TheImg).width(Image_Width + "px");
     223            jQuery(TheImg).css("height", Image_height + "px");
     224            jQuery(TheImg).css("width", Image_Width + "px");
    145225
    146226        }
     
    155235
    156236    //===================================================================         
     237
    157238    jQuery(window).resize();
     239
    158240    jQuery(window).resize();
    159241
Note: See TracChangeset for help on using the changeset viewer.