Changeset 8864


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
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/admin/admin_autosize.php

    r7916 r8864  
    4545                $my_base_url.'&tab=autosize_admin'
    4646                           );
    47 /*               
    48 $tabsheet->add( 'autosize_content',
    49                 l10n('content'),
    50                 $my_base_url.'&tab=autosize_content'
     47
     48$tabsheet->add( 'autosize_help',
     49                l10n('help'),
     50                $my_base_url.'&tab=autosize_help'
    5151                           );
    52 */                         
     52                           
    5353                           
    5454                           
     
    8282// |                          Sélection de l'onglet                        |
    8383// *************************************************************************
    84 $autosizes_message =""
    85 $erreur_message="";
     84global $infos_message
     85global $erreur_message;
    8686global $conf;
    8787global $autosize_parametres;
     
    8989    global $picture;
    9090 
    91   $visible=true;       
    92 
    93         $path = AUTOSIZE_PATH;
    94  
    95  
    96          $autosize_parametres = cl_autosize_Get_Options();
     91 $visible=true;
     92 $path = AUTOSIZE_PATH;
     93 $autosize_parametres = cl_autosize_Get_Options();
    9794         
    9895   if (isset($_POST['submit']))  { 
     
    112109 {
    113110  case 'autosize_admin':
    114 
    115111    $template->set_filenames(array('plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/admin.tpl')));
    116 
    117  
    118112    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    119113    break;
    120114 
    121 case 'autosize_content':
     115case 'autosize_help':
    122116
    123  
    124  $template->set_filenames(array( 'plugin_admin_content' => realpath(AUTOSIZE_PATH . 'template/picture.tpl' )));
     117 $message="<fieldset id='fieldset'>
     118    <script id='dimensions' src='./plugins/Autosize/js/jquery.dimensions.js'></script>
     119    <script id='Affiche_script' src='./plugins/Autosize/js/Affiche_script.js'></script>
     120    <div class='autosize'
     121         autosize='MargeBasse:30px;MargeHaute:30px;parent:fieldset;ResizePicture:true'
     122         >
     123
     124        <img src='./galleries/Voyages/Europe/Italie/Chianti/IMG_0520.JPG' width='100%' />
     125        </a>
     126    </div>
     127</fieldset>";
     128    if (isset($_POST['valid']))  {      $message = empty($_POST['texte']) ? $message : stripslashes($_POST['texte']);
     129        }       
     130    //=========================================================================         
     131                $toolbar = 'Basic';
     132                $width = '100%';
     133                $height = '200px';
     134                $areas = array();
     135                $areas[]='texte';
     136                if (!empty($areas)){
     137                                if (function_exists('set_fckeditor_instance'))
     138                                set_fckeditor_instance($areas, $toolbar, $width, $height);
     139                        }
     140                 
     141
     142
     143
     144
     145   
     146
     147
     148 $template->set_filenames(array( 'plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/help.tpl' )));
     149 $template->assign(
     150                                        array(
     151   'message' =>  $message  ,
     152   ));
     153
     154
    125155 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    126156 break;
    127157  }
    128 if (!isset($autosizes_message)){
    129                   $autosizes_message = "";
    130                 }
    131  
    132  
    133                  
    134                 if  ($autosizes_message != "")  {
    135                    array_push($page['autosizes'],  $autosizes_message);
    136                  $autosizes_message="";
     158       if (!isset($infos_message)){
     159                  $infos_message = "";
     160                }                 
     161                if  ($infos_message != "")  {
     162                   array_push($page['infos'],  $infos_message);
     163                   $infos_message="";
    137164                 }
    138165                if (!isset($erreur_message)){
  • extensions/Autosize/admin/template/admin.tpl

    r7962 r8864  
    197197</form>
    198198 
    199  </table >
    200 
    201  
     199 </table >               
     200 
     201 
  • extensions/Autosize/include/affiche.php

    r8057 r8864  
    2626                                        'cl_plugin' => $cl_plugin,
    2727
    28                                         'fade_in' =>$autosize_parametres->fade_in,
     28                                        'fade_in' => $autosize_parametres->fade_in,
    2929                                        'thumbnail' => $conf['prefix_thumbnail'],
    3030                    'visible' => $visible,
  • 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
  • extensions/Autosize/main.inc.php

    r8807 r8864  
    22/*
    33Plugin Name: AutoSize
    4 Version: 1.4.34
     4Version: 1.4.35
    55Description: Ajuste l'affichage des photos en fonction de la hauteur de la fenetre de navigation
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=448
  • extensions/Autosize/template/autosize.tpl

    r8792 r8864  
    66
    77 <script type="text/javascript">
    8 
     8    var src_img = '{$SRC_IMG}';
    99    var fade_in = '{$fade_in}';
    1010    var cl_visible = "{$cl_visible}" =="true";
     
    4646    var check_auto_w = '{$check_auto_w}';
    4747    var check_desc_v = '{$check_desc_v}';
    48      </script>
     48 </script>
    4949{known_script id="Affiche_script" src=$AUTOSIZE_PATH|@cat:"js/Affiche_script.js"}
    5050<link href="{$AUTOSIZE_PATH}css/autosize.css" rel="stylesheet" type="text/css" />
  • extensions/Autosize/template/picture.tpl

    r7805 r8864  
    2020
    2121 </script>
    22  
     22 <form method="post">
     23<input id="ret_autosize"  type="hidden" value="" />
     24<input id="src_img_h"  type="hidden" value="" />
     25<input id="src_img_w"   type="hidden" value="" />
     26</form>
Note: See TracChangeset for help on using the changeset viewer.