Changeset 22292 for extensions/Autosize


Ignore:
Timestamp:
Apr 18, 2013, 5:16:42 PM (11 years ago)
Author:
cljosse
Message:

[extensions] Autosize update to piwigo 2.5 (fix bug with Social buttons, chg size[elegant] )

Location:
extensions/Autosize
Files:
2 edited

Legend:

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

    r22248 r22292  
    8686    **************************************************************************/
    8787    Get_type_img = function (e) {
    88       // ====== détection du type d'images ======
     88      // ====== détection du type d'images ======   
    8989      if (jQuery("#charlie").length > 0) {
    9090        Type_Img = "charlie";
     
    104104
    105105        if (jQuery("#theImage" + " object").length > 0) {
    106 
    107106          type_src = "object";
    108 
    109107        } else if (jQuery("#theImage" + " embed").length > 0) {
    110 
    111108          type_src = "embed";
    112 
    113109        } else {
    114 
    115110          type_src = "iframe";
    116111        }
    117         nbf = jQuery("#theImage" + " " + type_src).length;
    118         frm1 = jQuery("#theImage" + " " + type_src).get(0);
    119         Type_Img = "iframe";
     112        iframes = jQuery("#theImage" + " " + type_src);
     113        var st_frame = true;
     114        nbf = iframes.length;
     115        jQuery("#theImage" + " " + type_src).each(function (i) {
     116          if (this.src.match(RegExp("http", "gi")) || this.src.match(RegExp("javascript", "gi"))) {
     117
     118          } else {
     119            st_frame = false;
     120            frm1 = this;
     121          }
     122        });
     123        if (!st_frame) {
     124          Type_Img = type_src;
     125        } else {
     126          Type_Img = "img";
     127          type_src = "div";
     128          return;
     129        }
    120130        // 'fb - xfbml - like - button
    121131        objs = jQuery("#theImage" + " div").get(0);
     
    126136          } else {
    127137            if (nbf > 1) {
    128               jQuery(frm1).attr("id", "charlie");
     138              frm1.attr("id", "charlie");
    129139            } else {
    130140              // Type_Img = "img";
     
    332342          theMainImage_id = "charlie";
    333343          options.valide = true;
    334 
    335 
    336344        } else if (Type_Img == "iframe") {
    337 
    338345          infos_theMainImage = jQuery("#iframe").infos(true);
    339 
    340346          options.valide = true;
    341 
    342347          infos_theMainImage.width = infos_theImage.general.width;
    343348          infos_theMainImage.height = infos_window.height - infos_theImage.top - options.marge_basse;
    344349          jQuery("#iframe").width(infos_theMainImage.width);
    345350          jQuery("#iframe").height(infos_theMainImage.height);
    346 
    347 
    348 
    349351        } else {
    350352          jQuery("img").each(function (i) {
     
    465467    **************************************************************************/
    466468    jQuery(window).unload(function () {
     469   
    467470      // return;
    468471    });
     
    509512    OptionsCookie = jQuery.extend({}, { path: options.COOKIE_PATH, expires: 1 });
    510513    var cookies = Get_cookies();
    511 
    512514    fade_in = options.fade_in || 0;
    513515    imageComment_id = ".imageComment";
     
    518520      jQuery("#content").css({ marginLeft: 'auto' }); // monblanc
    519521    }
    520     Get_type_img();
     522
    521523    var theMainImage_id = "#theMainImage";
    522524    var theImage_id = "#theImage";
     
    573575    }
    574576    options.liste_type = new_liste;
    575 
     577    XImg = jQuery(theMainImage_id);
     578    if (XImg.length > 0)
     579      if (jQuery(theMainImage_id)
     580         .html()
     581         .match(RegExp("charlie_", "gi"))
     582         ) {
     583        Xdiv = jQuery(theMainImage_id + " div");
     584        Xid = jQuery(Xdiv).attr("id");
     585        if (typeof Xid == "undefined") {
     586          jQuery(Xdiv).attr("id", "charlie");
     587        }
     588      }
     589    Get_type_img();
    576590    // auto_details
    577591    // ==== limite affichage selection = select_type ====
     
    864878        theImg.useMap = useMap;
    865879      }
    866       fade_in = parseInt(options.fade_in || 0);
     880
    867881
    868882    };
     
    873887    **************************************************************************/
    874888    Autosize_resize = function (force, parametres) {
     889
    875890      if (!force) {
    876891        cookis = Get_cookies();
     
    933948          }
    934949
    935         // jQuery(theMainImage_id).height(Zone_image.image.height);
    936950      } else if (Type_Img == "panorama") {
    937951        // jQuery("#pamoorama").width(img_finale.width);
     
    946960            jQuery(theMainImage_id).height(Zone_image.image.height);
    947961            r1 = infos_theImage.width / infos_theImage.height;
    948             // jQuery(theMainImage_id).width(Zone_image.image.width/r1);
    949962            jQuery(theMainImage_id).css("margin-top", options.marge_haute);
    950 
    951 
    952963          } else {
    953964            jQuery(theMainImage_id).width(Zone_image.image_init.width);
    954965            jQuery(theMainImage_id).height(Zone_image.image_init.height);
    955966          }
    956 
    957 
    958967        if (Type_Img == "charlie" || Type_Img == "iframe") {
    959968          init_w1 = Zone_image.image.width;
    960969          init_h1 = Zone_image.image.height;
    961 
    962970          if (pictureSelType_user != "Autosize" && pictureSelType_user != "SelMaxi") {
    963971            init_w1 = Autosize_options.ideal_size_width;
     
    981989              h01 = Math.ceil(w01 / Zone_image.image.rapport);
    982990            // ==== Zone Affichage =====
     991            if (h01 > png_h) {
     992              h01 = png_h;
     993              w01 = Math.ceil(h01 * Zone_image.image.rapport);
     994            }
    983995            jQuery("#theMainImage").height(png_h);
    984996            jQuery("#theMainImage").width(w01 + wpng);
     
    10081020            jQuery("#" + Type_Img).attr("height", init_h1 - (infos_theMainImage.borderwidth.top + infos_theMainImage.borderwidth.bottom));
    10091021          }
    1010           jQuery("#" + Type_Img).show(options.fade_in);
     1022          jQuery("#" + Type_Img).show(fade_in);
    10111023        }
    10121024
     
    10241036    * pamoorama
    10251037    **************************************************************************/
    1026     jQuery("#pamoorama").bind("on", function () { alert($(this).text()); });
    1027     jQuery("#pamoorama").bind("on", function (e) {
    1028       myPamoorama = window.myPamoorama;
    1029     });
    1030     jQuery("#pamoorama_inner").live("on", function (e) {
    1031       myPamoorama = window.myPamoorama;
    1032     });
    10331038    jQuery('#pamoorama').live('ON', function (e) {
    10341039      jQuery(jQuery('.debug').get(1)).trigger('ON');
    10351040      Autosize_resize(true, options);
     1041      jQuery("#pamoorama").fadeTo(fade_in + 20, 1);
    10361042    });
    10371043
     
    10721078      tempo = 0;
    10731079      Wait_pamoorama_st = false;
    1074 
    1075 
    10761080      while (Wait_pamoorama_st == false) {
    10771081        Wait_pamoorama_st = Wait_pamoorama_time();
     
    10841088          jQuery.delay(100);
    10851089        }
    1086 
    1087 
    1088 
    1089       }
    1090 
     1090      }
    10911091    };
    10921092    // __________________ Wait_pamoorama ______________________
     
    11011101      if (jQuery("#pamoorama").length) {
    11021102        tempo = tempo + 1;
    1103 
    11041103        mypanorama = window.myPamoorama;
    11051104        if (!mypanorama) {
     
    11071106          setTimeout("Wait_pamoorama_time()", 500);
    11081107          return false;
    1109 
    1110         }
    1111 
    1112         if (mypanorama.skipInit == false) {
     1108        }
     1109       /* if (mypanorama.skipInit == false) {
    11131110          if (tempo > 500) return true;
    1114           setTimeout("Wait_pamoorama_time()", 500);
     1111          setTimeout(function () {
     1112            Wait_pamoorama_time();
     1113          }, 500);
    11151114          return false;
    1116         }
     1115        }*/
     1116       
    11171117        // =============================================================
    1118         if (Math.abs(mypanorama.imageHeight) < 100) {
    1119           setTimeout("Wait_pamoorama_time()", 500);
     1118        if(typeof mypanorama.imageHeight=="undefined"){
     1119          setTimeout(function () {
     1120            Wait_pamoorama_time();
     1121          }, 500);
    11201122          return false;
    11211123        }
     
    11531155
    11541156    Wait_Affichage_time = function () {
    1155       if (typeof fade_in == "undefined") fade_in = 1000;
    1156       fade_in = parseInt(fade_in);
    1157       /*
    1158       * if (!Autosize_resize()) { setTimeout("Wait_Affichage()", 500); return }
    1159       * nu_img++;
    1160       */
    1161       if (typeof fade_in == "undefined") fade_in = 0;
    1162 
    11631157      // if (nu_img > 1) return;
    11641158      if (typeof stb != "undefined")
     
    13941388          return true;
    13951389        } else {
    1396           last_id = IMg.pictureDeriv;
    1397           // eval(href_path);
    1398           data_src = jQuery(theImg).attr("data-src");
    1399           if (typeof data_src != "undefined") {
    1400             changeImgSrc(data_src + "&loadajax=true",
    1401            last_id,
    1402            IMg.pictureMap,
    1403            options.COOKIE_PATH);
    1404           } else {
    1405             changeImgSrc(imgSrc.replace("./", ""),
    1406            last_id,
    1407            IMg.pictureMap,
    1408            options.COOKIE_PATH);
    1409           }
     1390          eval(href_path);
     1391
    14101392        }
    14111393        theImg.useMap = "#map" + IMg.pictureMap;
     
    14501432      myPamoorama = window.myPamoorama;
    14511433      if (Type_Img == "pamoorama") {
    1452 
    14531434        if (!nopano) {
    14541435          theMainImage_Id = "#pamoorama";
     
    14561437          Wait_pamoorama();
    14571438          infos_theMainImage = jQuery(theMainImage_Id).infos();
    1458           // theMainImage_Id = "#pamoorama";
    1459         }
    1460 
    1461 
     1439        }
    14621440        if (typeof myPamoorama == "undefined") {
    14631441          return;
     
    14651443        // =========================================================
    14661444        if (!nopano) {
    1467           // theMainImage_Id = "#pamoorama";
    14681445          nopano = false;
    14691446          Wait_pamoorama();
    14701447          infos_theMainImage = jQuery(theMainImage_Id).infos();
    1471           // theMainImage_Id = "#pamoorama";
    14721448        }
    14731449
     
    14991475        });
    15001476        // ---------- test largeur image
    1501         new_width = Format.width - (options.marge_right + options.marge_left);
     1477        new_width = Format.width; // -(options.marge_right + options.marge_left);
    15021478
    15031479        if (new_width > new_image.width) {
     
    15291505        window.myPamoorama.imageHeight = new_image.height;
    15301506        nf = jQuery("#pamoorama_thumb").height();
    1531         jQuery("#pamoorama_thumb img").width(180);
     1507        jQuery("#pamoorama_thumb img").width(200);
    15321508        jQuery("#pamoorama_thumb img").height(nf);
    15331509
     
    15871563      if (Type_Img == "img") {
    15881564        Zone_image.src = jQuery(theMainImage_id).attr("src");
    1589         if (Zone_image.src.match(RegExp(Zone_image.name, "gi"))) {
    1590           Zone_image.path = infos_theMainImage.src;
    1591         } else
    1592           return "Wait";
    1593 
     1565        if (typeof Zone_image.src != "undefined") {
     1566          if (Zone_image.src.match(RegExp(Zone_image.name, "gi"))) {
     1567            Zone_image.path = infos_theMainImage.src;
     1568          } else
     1569            return "Wait";
     1570        } else {
     1571          Zone_image.src = "";
     1572          Zone_image.path = "";
     1573        }
    15941574      } else {
    15951575        Zone_image.src = jQuery(theMainImage_id).attr("src");
     
    16771657      if (!options.check_desc_v)
    16781658        options.marge_bottom_2 = 0;
    1679 
    16801659
    16811660      marge_bottom = options.marge_bottom_2 + options.marge_bottom;
     
    17571736      options.theImageRight = (new_win.width - new_dim.right);
    17581737      options.marge_bottom_2 = Math.ceil(new_dim.out.bottom - new_img.out.bottom);
    1759 
    1760       if (Type_Img == "iframe") { }
     1738      options.marge_top_2 = options.marge_top_2 | 0;
    17611739      new_dim.out.bottom = new_win.height - options.marge_bottom_2;
    1762 
    17631740      options.theImageBottom = new_win.height - new_dim.out.bottom;
    17641741      if (options.slideshow) {
     
    18181795        case "charlie":
    18191796          Zone_image.zoom = 1;
     1797          Zone_image.image.width = options.theImageWidth;
     1798          Zone_image.image.height = options.theImageHeight;
    18201799          break;
    18211800        case "iframe":
     
    19001879      pos_top = pAll.Top; ;
    19011880      pos_bottom = pAll.Bottom; ;
    1902 
    19031881      if (infos_llgbo.top > 0) {
    19041882        pos_top = infos_llgbo.top;
    1905 
    19061883        options.marge_top = infos_theMainImage.top - infos_theImage.top;
    19071884        options.marge_bottom = Math.ceil(options.marge_basse + options.marge_top);
     
    19131890
    19141891      options.pos_top = pos_top;
     1892      new_img = jQuery(theMainImage_id).infos({ absolute: true });
     1893      new_dim = jQuery(theImage_id).infos({ absolute: true });
     1894      options.marge_top += Math.ceil(new_img.top - new_dim.top);
     1895
     1896
    19151897      options.marge_left = infos_theImage.general.marges.left + Math.ceil(options.marge_gauche);
    19161898      options.marge_right = infos_theImage.general.marges.right + Math.ceil(options.marge_droite);
     
    19191901                           Math.ceil(options.marge_haute);
    19201902
     1903
    19211904      if (options.pictureDeriv == null)
    19221905        options.first = true;
     
    19241907        options.first = false;
    19251908      // =================== Gestion liste photos size
    1926       // ============================
    19271909      us = 0;
    19281910      if (!options.theMainImageWidth) options.theMainImageWidth = options.scaledWidth;
     
    19891971      Autosize_resize(true, options);
    19901972      Autosize_resize(true, options);
    1991       jQuery("#" + Type_Img).show(options.fade_in);
     1973      jQuery("#" + Type_Img).show(fade_in);
    19921974    };
    19931975    // _______________________ init_gen _______________________
     
    21832165    } // Debug_pos
    21842166    // ==========================================================
    2185   });                                                                                                                                                                   // ready
     2167  });                                                                                                                                                                                                    // ready
    21862168  jQuery("#derivativeSwitchBox a").click(function (e) {
    21872169    k1 = 0;
  • extensions/Autosize/main.inc.php

    r22248 r22292  
    22/*
    33 Plugin Name: AutoSize
    4 Version: 3.1.2
     4Version: 3.1.3
    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
Note: See TracChangeset for help on using the changeset viewer.