Ignore:
Timestamp:
Jan 24, 2011, 11:15:38 AM (13 years ago)
Author:
cljosse
Message:

[Autosize][beta] add event on end of resize


Location:
extensions/Autosize/js
Files:
2 edited

Legend:

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

    r8807 r8864  
    5050//==========================================================================
    5151function Wait_Affichage() {
    52 
    5352    fade_in = parseInt(fade_in);
     53   
    5454    if (!jQuery().newResize()) {
    5555        setTimeout("Wait_Affichage()", 500);
    5656        return
    5757    }
    58 
     58 nu_img++;
    5959    if (fade_in == 0) {
    6060        jQuery(Parent).css({ opacity: "1" });
     
    7373                       }
    7474              );
    75     }
     75                   }
     76                   if (nu_img > 1) return;
     77
     78                 
     79
     80    img_h = jQuery(TheImg).height();
     81    img_w = jQuery(TheImg).width();
     82
     83    jQuery("#src_img_h").val(img_h);
     84    jQuery("#src_img_w").val(img_w);
     85    jQuery("#ret_autosize").val(src_img);
     86
     87    jQuery("#ret_autosize").trigger('ON');
     88
    7689
    7790}
     
    8295function Autosize_resize(Obj) {
    8396    if (typeof cl_visible != "undefined") return;
    84     var winwidth = jQuery(window).width();
    85     var winheight = jQuery(window).height();
     97
     98
     99
     100    conf = jQuery(Obj).get(0).conf;
     101    Obj = jQuery(Obj).get(0).obj;
     102    myWindow = jQuery("#" + conf.parent).infos();
     103
     104    if (myWindow == 0) myWindow = jQuery(window).infos();
     105    marge_basse = 0;
     106    if (conf.MargeBasse)
     107        marge_basse = jQuery().Get_Val_int(
     108            conf.MargeBasse
     109    );
    86110    info_Obj = jQuery(Obj).infos();
    87111    h1_left = jQuery(Obj).absoluteLeft();
    88         h1_top = jQuery(Obj).absoluteTop();
    89         h1 = (winheight - h1_top);
    90      img = jQuery(Obj).find("img") ;
    91      rap = jQuery(img).height() / jQuery(img).width();
    92      w2 = (h1 / rap);
    93      
    94      if (w2 < info_Obj.width)
    95          marginLeft = info_Obj.left + parseInt((info_Obj.width - w2) / 2)+"px";
    96      else
    97          marginLeft = "auto";
    98      Obj.css({ width: "auto",
    99          marginLeft: "auto",
    100               verticalAlign: "middle", textAlign: "center"
    101                });
    102         Obj.height(h1);
    103          
    104 
    105            img.height(h1);       
    106            img.width(w2);             
    107 
    108 
    109    
     112    h1_top = jQuery(Obj).absoluteTop();
     113    if (typeof old_h1 == "undefined") old_h1 = 0;
     114
     115
     116
     117    if (h1_top < info_Obj.height)
     118        h1 = (myWindow.height - h1_top - marge_basse);
     119    else
     120        h1 = (myWindow.height - marge_basse);
     121
     122    if (h1 == old_h1) return;
     123    old_h1 = h1;
     124
     125    imgs = jQuery(Obj).find("img");
     126    rap = jQuery(imgs).height() / jQuery(imgs).width();
     127    w2 = (h1 / rap);
     128
     129    // ("source:" + message);
     130
     131    if (w2 < info_Obj.width)
     132        marginLeft = info_Obj.left + parseInt((info_Obj.width - w2) / 2) + "px";
     133    else
     134        marginLeft = "auto";
     135
     136    jQuery(Obj).css({ width: "auto",
     137        marginLeft: "auto", marginBottom: 0 + "px",
     138        verticalAlign: "middle", textAlign: "center"
     139    });
     140    jQuery(Obj).height(h1);
     141    //=============================================================
     142    if (conf.ResizePicture != "true") {
     143
     144    } else
     145        jQuery(imgs).each(function (i) {
     146            img = jQuery(this);
     147            rap = jQuery(this).height() / jQuery(this).width();
     148            w2 = parseInt(h1 / rap);
     149            if (w2 > 0 && h1 > 0 && img.length > 0) {
     150                img.height(h1);
     151                img.width(w2);
     152            }
     153
     154        });
     155
     156
     157
     158
    110159}
    111160jQuery.extend(jQuery.expr[':'], {
     
    114163        n1 = a.className;
    115164        // personal_block
    116         if (n1 == "autosize") {
    117             List_autosize.push(a);
    118             Autosize_resize(jQuery(a));
    119             jQuery(a).css({ opacity: 1 });
    120 
     165        if (n1.match(RegExp("autosize", "gi"))) {
     166            //   autoresize = "MargeBasse:30px; ResizePicture:false"
     167            infconf = jQuery(a).attr("autosize");
     168            n1 = typeof infconf;
     169            conf = { MargeBasse: 0, NoPicture: false }
     170            if (n1 == "undefined") {
     171
     172            } else {
     173                tableau = infconf.split(";");
     174                for (var i = 0; i < tableau.length; i++) {
     175                    tableau2 = tableau[i].split(":");
     176                    conf[jQuery.trim(tableau2[0])] = jQuery.trim(tableau2[1]);
     177                }
     178
     179                List_autosize.push({ obj: a, conf: conf });
     180                jQuery(a).css({ opacity: 1 });
     181            }
    121182        }
    122183        //  Css = jQuery(a).getStyles(a);
     
    126187    }
    127188});
    128  
    129 
    130  
     189
     190
     191function List_autosize_resize(event, ui) {
     192    if (List_autosize.length == 0) return;
     193    for (i = 0; i < List_autosize.length; i++) {
     194        Autosize_resize(jQuery(List_autosize[i]));
     195    }
     196
     197}
    131198//==============================================================
    132199jQuery(document).ready(
     
    139206         jQuery(window).resize(
    140207               function (event, ui) {
    141                    if (List_autosize.length == 0) return;
    142                    for (i = 0; i < List_autosize.length; i++) {
    143                        Autosize_resize(jQuery(List_autosize[i]));
    144                    }
     208                   List_autosize_resize(event, ui);
    145209
    146210               });
     
    151215                 if (List_autosize.length == 0) return;
    152216                 for (i = 0; i < List_autosize.length; i++) {
    153                      Autosize_resize(jQuery(List_autosize[i])); 
     217                     Autosize_resize(jQuery(List_autosize[i]));
    154218                 }
    155219
     
    251315                     jQuery(bp1).trigger('ON');
    252316                 }
     317                 if (typeof cl_visible == "undefined") return;
     318                 if (!cl_visible == true) { return true; }
    253319                 var chk = eval(user_status + "_enabled");
    254                  if (!cl_visible == true) { return true; }
    255320                 if (chk == "") { return true; }
    256321
     
    12361301        info_description.bottom -= info_img.top;
    12371302    }
    1238  //   if (msie == true) info_description.bottom -= 4;
     1303    //   if (msie == true) info_description.bottom -= 4;
    12391304
    12401305    info_description.height = info_description.bottom - info_description.top;
     
    13661431    // Add 10 testing debugs to start with
    13671432    jQuery(window).load(function () {
     1433        DEBUG = (typeof DEBUG != "undefined") ? DEBUG : "false";
    13681434        if (DEBUG == "true") {
    13691435            for (var i = 0; i < 10; i++) {
  • extensions/Autosize/js/conflit.js

    r8792 r8864  
    11//==== cl_conflit  remplace $(... avec jQuery( ====
    2 
    32//===================================================
    43var detect = navigator.userAgent.toLowerCase();
     
    76//==============================================================================
    87browser = detect_browser();
    9 
    108function detect_browser() {
    11    
     9
    1210    mybrowser = {
    1311        browser: "",
     
    1917        firefox: false,
    2018        msie: false,
    21         netscape: false
     19        netscape: false,
     20        seamonkey: false
    2221    }
    2322    if (checkIt('konqueror')) { mybrowser.Konqueror = true; lbrowser = "konqueror"; OS = "Linux"; }
     23    else if (checkIt('seamonkey')) { mybrowser.seamonkey = true; lbrowser = "seamonkey"; }
    2424    else if (checkIt('chrome')) { mybrowser.chrome = true; lbrowser = "chrome"; }
    2525    else if (checkIt('safari')) { mybrowser.safari = true; lbrowser = "safari"; }
     
    3939        else OS = "an unknown operating system";
    4040    }
    41     mybrowser.version =version;
     41    mybrowser.version = version;
    4242    mybrowser.OS = OS;
    4343    mybrowser.browser = lbrowser;
    4444    return mybrowser
    45 
    46 
    4745};
    48 
    49 
    50 
    5146function checkIt(string) {
    5247    place = detect.indexOf(string) + 1;
     
    5449    return place;
    5550}
     51
    5652/*
    5753 
    5854*/
    59 
    60 
    6155konqueror = mybrowser.konqueror || false;
    6256chrome = mybrowser.chrome || false;
     
    6761msie = mybrowser.msie || false;
    6862netscape = mybrowser.netscape || false;
    69 
    70 
    71 
    7263var time_out = 0;
    7364//===================================================
    74 
    7565nbpa = 0;
    7666var Fn;
     
    188178            })
    189179            //============================================================= 
    190 
    191180            //   jQuery(window).resize();
    192181        });
    193         //=============================================================       
    194182        //  $ = _$2; ;
    195183    });
    196 
    197 
    198 
    199184//=========================================================
    200 
    201185jQuery.fn.extend({
     186    $: function (el, nc) {
     187        a = conflit(el, nc);
     188        return a;
     189    },
    202190
    203191    //---------------- luciano -------------------------------
     
    481469}
    482470//====================================
    483 test_conflit = false;
     471
    484472librairies = new Array;
    485473$_ = $;
     
    535523})(jQuery);
    536524
    537 if (test_conflit != true) {
     525if (typeof MooTools == "undefined" && typeof Prototype == "undefined") {
     526
     527} else {}
    538528    //--------------------------------------------------------------
    539529    $_0 = $;
    540 
    541530    function $(element, nc0) {
    542531        if (typeof jQuery.fn.infos != "function")
     
    546535        return a;
    547536    }
    548 
    549 
    550         $.isFunction = function (value) { return jQuery.isFunction(value); }
    551         $.inArray = function (a, b) { return jQuery.inArray(a, b); }
    552         $.error  = function (a , b , c)  {jQuery.error(a , b , c);}
    553 
    554     if (typeof ($.extend) != "function") {
    555      $.extend = function (a,b) {
    556          return jQuery.extend(a, b);
    557         } ;
    558 
    559  
    560      }
    561 
    562     if (typeof ($.ajax) != "function") {
    563         $.ajax = function (origSettings) {
    564             jQuery.ajax(origSettings);
    565         }
    566 
    567 
    568         $.parseJSON = function (msg) {
    569             return jQuery.parseJSON(msg);
    570         }
    571 
    572     }
    573     //============================================
    574     /* url (String): URl de la page à charger
    575     * params (Map): (optionnel) paires de clé/valeur qui seront envoyées au serveur.
    576     * callback (Fonction): (optionnel) fonction qui sera éxécutée quand les données sera chargées.
    577     * type (String): (optionnel) format des données renvoyées à la fonction de callback
    578     */
    579     if (typeof ($.get) != "function") {
    580         $.get = function (a, b, c, d) {
    581             return jQuery.get(a, b, c, d);
    582         }
    583     }
    584     if (typeof ($.post) != "function") {
    585 
    586         $.post = function (a, b, c, d) {
    587             return jQuery.post(a, b, c, d);
    588         }
    589         ;
    590 
    591     }
    592 
    593 }
    594 //--------------------------------------------------------------
     537    //=== ajout des fonctions jQuery ===
     538    jQuery.extend($, jQuery);
     539
     540
     541    //--------------------------------------------------------------
     542
Note: See TracChangeset for help on using the changeset viewer.