Changeset 18975 for extensions/Autosize


Ignore:
Timestamp:
Nov 8, 2012, 1:59:34 PM (11 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix compatibility with 2.4 (FireFox LLGBO select)

Location:
extensions/Autosize
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/autosize.inc.php

    r18949 r18975  
    580580$ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    581581if ($ma_page !='thePicturePage') return ; 
    582  
    583 
    584 
    585582    if(isset($set_miniature)){
    586        
     583
    587584          $set_miniature = self::cl_autosize_nofile($set_miniature) ;
    588                      $template->append('footer_elements',$set_miniature); 
     585          $set_miniatures= explode("script",$set_miniature);
     586          if(preg_match("|noGen|", $DEBUG_autosize, $val)) {
     587          if(count($set_miniatures)> 1 )
     588                $infos_message .= "PictureDeriv:" . $pictureDeriv. ' miniature:' . cl_print_var( $set_miniature);
     589                 
     590            }else {
     591               
     592               
     593          } ;
     594          $template->append('footer_elements',$set_miniature); 
    589595      }
    590596         
     
    10241030 //=== verification fichiers absents ===
    10251031 global $infos_message,$error_message;
    1026     global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
    1027 
     1032 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
     1033global  $pictureDeriv;
    10281034  $ok=false ;
    10291035 $nofiles=array();
     
    10321038 $nosrc=false ;
    10331039 $ok=true ;
    1034  $listes="";
     1040 $listes="";     
    10351041  foreach ($img_all as $img_select){
    10361042    $img_url  = $img_select->get_url();
     
    10461052              $id  =  $img_select->src_image->id;                 
    10471053              $file_no->id=$id ;
    1048               $file_no->type=$img_type ;  
     1054              $file_no->type=$img_type ;
    10491055              array_push($nofiles,serialize($file_no)) ;             
    10501056      }
     
    10561062  //=======================================================================================
    10571063    if($nosrc!=true  ){
    1058       $exec_miniatures = "<script type='text/javascript' src='".PHPWG_ROOT_PATH."themes/default/js/plugins/jquery.ajaxmanager.js' ></script>";     
    1059         $exec_miniatures .= "<script type='text/javascript' src='".PHPWG_ROOT_PATH."plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' >  </script >";
    1060         $nosrc=true ;
     1064      $script_miniatures = "<script type='text/javascript' src='".PHPWG_ROOT_PATH."themes/default/js/plugins/jquery.ajaxmanager.js' ></script>";     
     1065      $script_miniatures .= "<script type='text/javascript' src='".PHPWG_ROOT_PATH."plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' >  </script >";
     1066      $nosrc=true ;
    10611067    } 
    1062       $exec_miniatures .= "<script type='text/javascript'>
     1068   
     1069     
     1070   $exec_miniatures ="";
     1071      $script_miniatures .= "<script type='text/javascript'>
    10631072        var nofile=Array(";
    1064         for ($i=0;$i < count($nofiles);$i++){       
    1065              $file=unserialize($nofiles[$i]);
     1073        for ($i=0;$i  <  count($nofiles)-1 ;$i++){       
     1074             $file = unserialize($nofiles[$i]);
    10661075             $exec_miniatures .=  "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'},\n" ;
    10671076          } 
    1068         if($i>0) $exec_miniatures .=  "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ;
    1069           $exec_miniatures .=  "); </script>\n" ;                 
    1070           $exec_miniatures .= "<script type='text/javascript' >
     1077          if($i  <  count($nofiles))
     1078          {   $file = unserialize($nofiles[$i]);
     1079             $exec_miniatures .=  "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ;
     1080             }
     1081             /*** Un seul ***********/
     1082             $file = unserialize($nofiles[count($nofiles)-1]);
     1083             $exec_miniatures =  "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ;
     1084
     1085          $script_miniatures  .= $exec_miniatures . "); </script>\n" ;                 
     1086          $script_miniatures  .= "<script type='text/javascript' >
    10711087          if(typeof nofile!='undefined')
    10721088              getDerivativeUrls(nofile);
    10731089      </script>";
    10741090      //==================================================================================
    1075       return $exec_miniatures ;
     1091      return $script_miniatures ;
    10761092    }
    10771093 }
  • extensions/Autosize/js/Affiche_script.js

    r18949 r18975  
    246246        }
    247247      }
     248      Affiche_limite(pictureSelType_user);
     249      jQuery("#derivativeChecked" + options.pictureDeriv).css({ visibility: 'visible'      });
    248250
    249251    }
     
    438440      jQuery(window).resize(function (event, ui) {
    439441        Autosize_resize(true, options);
    440 
    441         return;
    442 
    443 
    444 
    445442      });
    446443      //_____________ widow.resize _______________
     
    457454      marges_llgbo = 0;
    458455      //==========================================================================================
    459       if (options.valide) {
    460 
    461         init_gen();
    462 
    463 
    464       }
     456      init_gen();
     457
    465458
    466459    });
     
    502495
    503496    options = jQuery.extend(defaults, options);
    504 
    505 
    506     for (i = 0; i < options.liste_type.length; i++) {
    507       options.liste_type[i] = options.liste_type[i].split(",");
    508     }
    509 
    510497    options.theMainImageWidth = options.theMainImageWidth;
    511498    options.theMainImageHeight = options.theMainImageHeight;
    512 
     499    jQuery("#the_page").append("<div id='form_autosize_picture' ></div>");
    513500    jQuery("#form_autosize_picture").addClass("Autosize");
    514501    //===== marges suplémentaires en fonction theme ===
    515502    options.valide = jQuery(".Autosize").css("display") != "none";
    516 
    517503    options.marge_haute = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("top"));
    518504    options.marge_basse = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("bottom"));
    519505    options.marge_gauche = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("left"));
    520506    options.marge_droite = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("right"));
     507    jQuery(".Autosize").hide();
     508
    521509    fade_in = options.fade_in || 0;
    522510    imageComment_id = ".imageComment";
     
    546534    var useMap = options.pictureMap; // #mapxxx
    547535    var user_status = options.user_status;
     536    var chk = eval("options." + user_status + "_enabled");
     537    if (chk == "") { options.valide = false; }
    548538
    549539    var pictureDeriv = options.pictureDeriv; // xxx
    550540    var pictureSelType_user = eval("options." + user_status + "_type"); //limite taille
     541
    551542    if (Type_Img == "pamoorama")
    552543      options.pictureSelType = "Autosize";
     
    566557    }
    567558
    568 
     559    for (i = 0; i < options.liste_type.length; i++) {
     560      options.liste_type[i] = options.liste_type[i].split(",");
     561    }
     562
     563
     564    // auto_details
     565    //==== limite affichage selection = select_type ====
     566    var path_names = new Array();
     567
     568    Affiche_limite = function (pictureSelType_Maxi) {
     569      n = 0;
     570      var pt = new Array();
     571      path_names = new Array();
     572      jQuery("#derivativeSwitchBox a").css('visibility', 'hidden');
     573      jQuery(".switchCheck").css('visibility', 'hidden');
     574      var maxi_display = false;
     575      jQuery("#derivativeSwitchBox a").each(function (i) {
     576        href_path = jQuery(this).attr("href");
     577        patname = href_path.replace("javascript\:", "");
     578        path_names.push(patname);
     579        pt[i] = href_path.split("','");
     580        tsz = pt[i][2].replace("')", "");
     581        if (!maxi_display)
     582          jQuery(this).css('visibility', 'visible');
     583        else {
     584          jQuery(this).next().next().remove();
     585          jQuery(this).next().remove();
     586          jQuery(this).remove();
     587        }
     588        //--- recherche limite ---
     589
     590        if (!options.valide && (tsz == "Autosize" || tsz == "SelMaxi")) {
     591          jQuery(this).next().next().remove();
     592          jQuery(this).next().remove();
     593          jQuery(this).remove();
     594        } else {
     595          if (tsz == "Original" && (pictureSelType_Maxi != "Autosize" && pictureSelType_Maxi != "SelMaxi")) {
     596            maxi_display = true;
     597          }
     598          if (tsz == pictureSelType_Maxi && (pictureSelType_Maxi != "Autosize" && pictureSelType_Maxi != "SelMaxi")) {
     599            maxi_display = true;
     600
     601          }
     602
     603        }
     604        //--- type en cours ---
     605        if (tsz.match(RegExp("^" + options.pictureDeriv, "gi"))) {
     606          us = n;
     607        }
     608
     609        n++;
     610      });
     611    }
    569612    //=============================================================
    570613    // REPONSE ACTION
     
    715758    if (typeof decode_href != 'function') {
    716759      function decode_href(myObj) {
    717         href_path = jQuery(myObj).attr("href");
    718         pt = href_path.split("(");
    719         pt = pt[1].split(")");
    720         pt = pt[0].replace(RegExp("'", "g"), "");
     760        hrefPath = jQuery(myObj).attr("href");
     761        if (hrefPath.indexOf("changeImg") == 0) {
     762          pt = hrefPath;
     763        } else {
     764          pt = hrefPath.split("(");
     765          pt = pt[1].split(")");
     766          pt = pt[0].replace(RegExp("'", "g"), "");
     767        }
    721768        pt = pt.replace(RegExp(" ", "g"), "");
    722769        pt = pt.split(",");
    723770        source = pt[0];
     771
    724772        pictureDeriv = pt[1];
    725773        pictureMap = pt[2];
     
    738786
    739787    jQuery("#derivativeSwitchBox a").click(function (e) {
     788      Affiche_limite(pictureSelType_user);
    740789      retour = decode_href(this);
    741790      theImg = document.getElementById(theMainImage_id.replace("#", ""));
     
    750799          n = Get_dimensions(true, options);
    751800        } else {
     801
    752802        }
    753803
     
    812862    ***************************/
    813863    Autosize_resize = function (force, parametres) {
    814       n = Get_dimensions(true, options);
    815       if (n == false) return;
     864      nAuto = Get_dimensions(true, options);
     865
    816866      Save_cookies(options);
    817       if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") {
    818         /**/
     867      if (!options.valide || nAuto == false || (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi")) {
    819868        jQuery(theImg).width(Zone_image.image_init.width);
    820869        jQuery(theImg).height(Zone_image.image_init.height);
    821 
    822870        set_cl("no");
    823871        Set_llbgo(true);
     
    892940            jQuery("#theMainImage").height(png_h);
    893941            jQuery("#" + Type_Img).height(png_h);
    894          
     942
    895943
    896944          } else {
     
    922970        if (url.match(RegExp("i.php", "gi"))) {
    923971          urls = url.split("?");
     972          urls = urls[1].split("?");
     973          //   Set_images(urls);
     974
    924975        }
    925976      }
     
    947998      options.pictureDeriv = typeSave;
    948999      document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH;
    949 
    950 
    951 
    952       jQuery("#theMainImage").removeAttr("width height").attr("src", url)
     1000      jQuery("#theMainImage").attr("src", url);
     1001
     1002      // jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ")
     1003      jQuery("#theMainImage").removeAttr("width height")
    9531004      .load(function (i) {
    9541005        if (!init_img(this)) {
     
    9581009
    9591010      })
    960       .live("ON", function (e) {
    961         theMainImage_st = this.complete;
     1011      .error(function (e) {
    9621012        imgsrc = this.src;
    963         // alert(this.src + ' Image does not exist !!');
    964       }).error(function (i) {
    965         imgsrc = this.src;
    966       });
    967       /***********************
    968       *
    969       **********************/
    970       jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ")
    971          .error(function (e) {
    972            if (!this.complete) {
    973              // le fichier n'est pas present
    974              src = jQuery(this).attr("src").replace("./_data/i/", "", 1);
    975              src = this.src.split("/_data/i")[1];
    976              url = 'i.php?' + src + "&ajaxload=true";
    977              jQuery(theMainImage_id).attr("src", url);
    978              /*
    979              jQuery.ajax({
    980              type: 'GET',
    981              url: 'i.php?' + src + "&ajaxload=true",
    982              dataType: 'json',
    983              success: (function (data) {
    984              j = data.url;
    985              //  jQuery(theMainImage_id).attr("src", data.url);
     1013        if (!this.complete) {
     1014          // le fichier n'est pas present
     1015          imgsrc = jQuery(this).attr("src");
     1016
     1017          return false;
     1018
     1019          imgsrc = jQuery(this).attr("src").replace("./_data/i/", "", 1);
     1020          imgsrc = this.src.split("/_data/i")[1];
     1021          if (typeof imgsrc == "undefined") return false;
     1022          url = 'i.php?' + imgsrc + "&ajaxload=true";
     1023          jQuery(theMainImage_id).attr("src", url);
     1024          //  getDerivativeUrls(imgsrc);
     1025        }
     1026
     1027      })
     1028           .live("Success", function (e) {
     1029             if (typeof imageInfos_id == "undefined") return false;
     1030           })
     1031
     1032            .live("Error", function (data) {
     1033              if (typeof imageInfos_id == "undefined") return;
     1034
     1035            })
     1036             .live("fail", function (data) {
     1037               if (typeof imageInfos_id == "undefined") return;
    9861038
    9871039             })
    988 
    989              });
    990              */
    991 
    992 
    993 
    994            }
     1040              .live("Progress", function (data) {
     1041                if (typeof imageInfos_id == "undefined") return;
     1042
     1043              })
     1044              .live("IsRejected", function (data) {
     1045                if (typeof imageInfos_id == "undefined") return;
     1046
     1047              })
     1048         .live("Finish", function (e, data) {
     1049           if (typeof imageInfos_id == "undefined") return;
    9951050
    9961051         })
    997          .bind("Finish", function (e, data) {
    998            if (typeof imageInfos_id == "undefined") return;
    999 
     1052         .live("change", function (e) {
     1053           theMainImage_st = this.complete;
     1054           imgsrc = this.src;
    10001055         })
    1001           .bind("ON", function (e, data) {
    1002             if (data.status != "ok") {
    1003               popup = jQuery(".errors");
    1004               if (popup.length == 0) {
    1005                 jQuery("#theImage").append("<div class='errors'><span></span></div>");
     1056            .live("Complete", function (e, data) {
     1057              if (data.statusText != "OK") {
     1058                popup = jQuery(".errors");
     1059                if (popup.length == 0) {
     1060                  jQuery("#theImage").append("<div class='errors'><span></span></div>");
     1061                }
     1062                jQuery(".errors").text("Erreur : [" + data.done + "] " + data.src);
     1063                jQuery(".errors").show().delay(10000).hide(2000);
     1064                return;
    10061065              }
    1007               jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText);
    1008               jQuery(".errors").show().delay(10000).hide(2000);
    1009               return;
    1010             }
    1011             if (data.src) {
    1012               if (typeof imageInfos_id == "undefined") return;
     1066              if (data.src) { }
    10131067              if (options.pictureDeriv == "Original" && data.src.match(RegExp("\-.." + ".jpg", "gi"))) {
    10141068                Autosize_resize(true, options);
     
    10181072
    10191073              }
    1020             }
    1021           });
     1074              type = options.pictureSelType;
     1075              typeSave = options.pictureDeriv;
     1076              jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
     1077              if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) {
     1078                jQuery('#derivativeChecked' + type).css('visibility', 'visible');
     1079              } else {
     1080                jQuery('#derivativeChecked' + typeSave).css('visibility', 'visible');
     1081              }
     1082
     1083            });
    10221084      //_________ theMainImage  ___________
    10231085
     
    11001162    //__________________ Wait_pamoorama ______________________
    11011163    jQuery(".pwg-icon-clock-minus, .pwg-icon-clock-plus").click(function (i) {
    1102 
    1103 
    1104 
    1105 
    11061164
    11071165    }).mouseover(function (i) {
     
    12901348        jQuery(pt).each(function (i) {
    12911349          vn = this;
    1292           size_derive = { w: parseInt(vn[2]), h: parseInt(vn[3]) };
    1293           if (vn[0] == options.pictureSelType || vn[0] == "Original") {
     1350          v_pictureDeriv = vn[0]; v_imgSrc = vn[1]; v_width = parseInt(vn[2]); v_height = parseInt(vn[3]);
     1351          size_derive = { w: v_width, h: v_height };
     1352          if (v_pictureDeriv == options.pictureSelType || v_pictureDeriv == "Original") {
    12941353            maxi_size = size_derive;
    12951354            maxi_size.idx = n;
     
    12971356          }
    12981357
    1299           if (vn[0] != "square" && vn[0] != "thumb" && vn[0] != "SelMaxi" && vn[0] != "Autosize") {
     1358          if (v_pictureDeriv != "square" && v_pictureDeriv != "thumb" && v_pictureDeriv != "SelMaxi" && v_pictureDeriv != "Autosize") {
    13001359            if (size_derive.h > size_encours.h) {
    13011360              if (maxi_size.idx < 0) {
     
    13371396            last_id = this.id.replace("derivativeChecked", "");
    13381397          }
    1339           if (last_id.match(RegExp(pictureDeriv, "gi"))) return false;
     1398          if (last_id == pictureDeriv)
     1399            return false;
    13401400        });
    13411401
     
    13881448        identique = Zone_image.src.match(RegExp(imgSrc, "gi"));
    13891449        if (identique) return;
    1390         href_path = "javascript:changeImgSrc('" + imgSrc + "', '" + IMg.pictureDeriv + "', '" + IMg.pictureMap + "', '" + options.pictureSelType + "')";
     1450        href = get_href(IMg.pictureDeriv);
     1451        href_path = "javascript:" + href;
    13911452        jQuery(".linkAutosize").attr("href", href_path);
    13921453        theImg = document.getElementById(theMainImage_id.replace("#", ""));
     
    13981459        } else {
    13991460          last_id = IMg.pictureDeriv;
    1400           changeImgSrc(imgSrc, last_id, IMg.pictureMap, options.pictureSelType);
     1461          eval(href);
     1462          //changeImgSrc(imgSrc, last_id, IMg.pictureMap, options.pictureSelType);
    14011463        }
    14021464
     
    14211483    };  //_______________ Select_Image ______
    14221484
     1485    get_href = function (NewpictureDeriv) {
     1486      for (i = 0; i < path_names.length; i++) {
     1487        newHref = path_names[i];
     1488        match = ",'" + NewpictureDeriv;
     1489        newHref_ind = newHref.indexOf(match);
     1490        if (newHref_ind > 0) {
     1491          href = newHref;
     1492          if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
     1493            href = href.replace("')", "','" + options.pictureSelType + "')");
     1494          }
     1495          break;
     1496        }
     1497
     1498      }
     1499      return href;
     1500    };
    14231501
    14241502    /*************************************************
     
    15671645      marge_right = options.marge_right | 0;
    15681646      marge_top = options.marge_top | 0;
    1569       marge_bottom = options.marge_bottom | 0;
     1647
    15701648
    15711649      //==========================================================
     
    16151693      //========== Format Image ============== 
    16161694      retrait_img.height = Math.ceil(options.marges_llgbo || 0)
    1617       + Math.ceil(infos_theMainImage.general.marges.height);
     1695      + Math.ceil(infos_theMainImage.general.marges.height) +
     1696      +Math.ceil(options.marges_llgbo || 0);
    16181697      retrait_img.height += 2;
    16191698
     
    16251704      retrait_img.width += 2;
    16261705      if (!options.check_desc_v)
    1627         marge_bottom = 0;
    1628 
     1706        options.marge_bottom_2 = 0;
     1707      marge_bottom = options.marge_bottom_2 + options.marge_bottom;
    16291708      //================== Limite Format Image =====================
    16301709      container.height_interne = container.height - marge_top - marge_bottom;
     
    17021781      options.theImageLeft = new_dim.left;
    17031782      options.theImageRight = (new_win.width - new_dim.right);
    1704       options.marge_bottom = Math.ceil(new_dim.out.bottom - new_img.out.bottom);
     1783      options.marge_bottom_2 = Math.ceil(new_dim.out.bottom - new_img.out.bottom);
    17051784      if (Type_Img == "iframe") { }
    1706       new_dim.out.bottom = new_win.height - options.marge_bottom;
     1785      new_dim.out.bottom = new_win.height - options.marge_bottom_2;
    17071786
    17081787      options.theImageBottom = new_win.height - new_dim.out.bottom;
    17091788      options.marge_top = Math.ceil(new_img.top - new_dim.top);
    17101789
    1711       if (options.theImageBottom < 0) {
    1712         options.theImageBottom = 0;
     1790      if (options.theImageBottom_2 < 0) {
     1791        options.theImageBottom_2 = 0;
    17131792      }
    17141793      options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight;
    17151794      options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop;
    1716       var chk = eval("options." + user_status + "_enabled");
    1717       if (chk == "") { return; }
    17181795
    17191796      if (Type_Img != "map" && Type_Img != "iframe")
     
    17221799      Zone_image.src = infos_theMainImage.src;
    17231800      useMap = options.pictureSelType;
    1724       /*
    1725       if (useMap) {
    1726       if (!useMap.match(RegExp("Autosize", "gi"))) {
    1727       if (typeof img_height != "undefined") {
    1728       jQuery(theImg).height(img_height);
    1729       jQuery(theImg).width(img_width);
    1730       }
    1731       return;
    1732       }
    1733       }
    1734 
    1735       if (options.imageAutosize) {
    1736       return true; //stripped
    1737       }
    1738 
    1739       if (typeof options.cl_visible == "undefined") return;
    1740       if (!options.cl_visible == true) { return; }
    1741       */
    1742 
    17431801      //=================================================================
    17441802      switch (Type_Img) {
     
    17631821        case "img_autre":
    17641822          if (!theMainImage_id) {
    1765             if (DEBUG_autosize.match("true", gi)) alert("The_MainImage=null");
     1823            if (DEBUG_autosize.match("true", "gi")) alert("The_MainImage=null");
    17661824            return;
    17671825
     
    18711929
    18721930        options.marge_top = infos_theMainImage.top - infos_theImage.top;
    1873       } else
     1931        options.marge_bottom = Math.ceil(options.marge_basse + options.marge_top);
     1932
     1933      } else {
    18741934        pos_top = infos_theImageAndInfos.top;
     1935        options.marge_bottom = Math.ceil(options.marge_basse);
     1936      }
    18751937
    18761938      options.pos_top = pos_top;
     
    18781940      options.marge_right = infos_theImage.general.marges.right + Math.ceil(options.marge_droite);
    18791941      options.marge_top += infos_theImage.general.marges.top + infos_content.general.marges.top + Math.ceil(options.marge_haute);
    1880       options.marge_bottom = Math.ceil(options.marge_basse); // +infos_content.general.marges.bottom; ;
     1942
    18811943      if (options.pictureDeriv == null)
    18821944        options.first = true;
     
    19131975        pictureSelType = options.pictureSelType;
    19141976      }
     1977      Affiche_limite(pictureSelType_user);
     1978
    19151979      //=================== 2==================================
    1916       href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "SelMaxi" + "')";
     1980      sav_p = options.pictureSelType;
     1981      options.pictureSelType = "SelMaxi";
     1982      href = get_href(options.pictureDeriv);
     1983      href_path = "javascript:" + href;
     1984
    19171985      spans = jQuery("#derivativeCheckedSelMaxi").next();
    19181986      spans.attr("href", href_path);
     
    19221990      spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")");
    19231991      //==========================================================
    1924       href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "Autosize" + "')";
     1992      options.pictureSelType = "Autosize";
     1993      href = get_href(options.pictureDeriv);
     1994      href_path = "javascript:" + href;
    19251995
    19261996      spans = jQuery("#derivativeCheckedAutosize").next();
     
    19312001      spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")");
    19322002      //==========================================================
     2003      options.pictureSelType = sav_p;
    19332004
    19342005      if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
     
    19402011      Autosize_resize(true, options);
    19412012      Autosize_resize(true, options);
     2013
    19422014    };
    19432015    //_______________________ init_gen _______________________
     
    21472219
    21482220
    2149   });                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     // ready
     2221  });                           // ready
     2222
    21502223
    21512224
  • extensions/Autosize/js/autosize_ajax.js

    r18944 r18975  
    1717   
    1818  function progress(success,data) {
    19     if (success) {
    20       try {
    21         jQuery("#theMainImage").trigger("ON", [{ nb: derivatives.total - derivatives.done, total: derivatives.total, done: derivatives.done, status: "ok", src: data.url, Width: data.Width, Height: data.Height}]);
    22       } catch (e) {
    23 
    24       }
    25     } else {
    26 
    27     if (data.statusText == "OK") {
    28  
    29     } else {
    30       jQuery("#theMainImage").trigger("ON", [{ nb: derivatives.total - derivatives.done, total: derivatives.total, done: derivatives.done, status: "Nok", responseText: data.responseText}]);
    31     }
    32     }
    33 
    3419    if (derivatives.finished()) {
    3520      jQuery("#theMainImage").trigger("Finish", [derivatives]);
     
    4429  function getDerivativeUrls(nofile) {
    4530    params.max_urls = nofile.length;
    46     Width = jQuery("#theMainImage").width();
    47     Height = jQuery("#theMainImage").height();
    48 
    4931    jQuery(nofile).each(function (i, t) {
    5032      if (typeof t.file != "undefined") {
    5133        nbsrc = params.src.length;
    52         t.file=   t.file.replace("/","",1);
     34        var reg = new RegExp("^\/", "g",1);
     35        t.file=   t.file.replace( reg ,"",1);
    5336        if (nbsrc == 0) {
    5437          params.ids.push(t.id);
     
    7356
    7457
    75     Set_images = function (dataUrls) {
    76       if (typeof jQuery.manageAjax != "undefined") {
    77         for (var i = 0; i < dataUrls.length; i++) {
    78           fichier = dataUrls[i];
    79           if (fichier != "")
    80             jQuery.manageAjax.add("queued", {
    81               type: 'GET',
    82               url: 'i.php?' + fichier + "&ajaxload=true",
    83               dataType: 'json',
    84               success: (function (data) {
    85                 j = derivatives.done;
    86                 derivatives.done++;
    87                 try {
    88                   for (var j = 0; j < params.src.length; j++) {
    89                     if (data.url.match(params.src[j])) {
    90                       params.src[j] = ""; break;
    91                     }
    92                   }
    93                   data.Width = Width;
    94                   data.Height = Height;
    95                 } catch (e) {
    9658
    97                 }
    98                 progress(true, data);
    99               }),
    100               error: (function (data) {
    101                 // derivatives.done++;
    102                 progress(data.statusText == "NOK", data);
    103               }),
    104               fail: (function (data) {
    105                 a = data.statusText;
    106               }),
    107               progress: (function (data) {
    108                 a = data.statusText;
    109               }),
    110 
    111               complete: (function (data) {
    112                 progress(false, data);
    113               }),
    114               isRejected: (function (data) {
    115                 a = data.responseText;
    116               })
    117 
    118             });
    119         }
    120 
    121       }
    122     }
    12359
    12460    jQuery("body").append("<div style='position:abosolute;left:-200;top:-200'>");
     
    12662    if (derivatives.total - derivatives.done > 0)
    12763      setTimeout("Set_images(params.src)", 500 * (derivatives.total - derivatives.done));
    128   }
     64     }
     65        } //ready
     66        //===============================================================
     67        Set_images = function (dataUrls) {
     68          if (typeof jQuery.manageAjax != "undefined") {
     69            for (var i = 0; i < dataUrls.length; i++) {
     70              fichier = dataUrls[i];
     71              if (fichier != "")
     72                jQuery.manageAjax.add("queued", {
     73                  type: 'GET',
     74                  url: 'i.php?' + fichier + "&ajaxload=true",
     75                  dataType: 'json',
     76                  success: (function (data) {
     77                    derivatives.done++;
     78                    try {
     79                      for (var j = 0; j < params.src.length; j++) {
     80                        if (data.url.match(params.src[j])) {
     81                          params.src[j] = ""; break;
     82                        }
     83                      }
     84                    } catch (e) {
    12985
    130    
     86                    }
     87                    jQuery("#theMainImage").trigger("Success", data);
     88                  }),
     89                  error: (function (data) {
     90                    jQuery("#theMainImage").trigger("Error", data);
     91                  }),
     92                  fail: (function (data) {
     93                    jQuery("#theMainImage").trigger("fail", data);
     94                  }),
     95                  progress: (function (data) {
     96                    jQuery("#theMainImage").trigger("Progress", data);
     97                  }),
    13198
    132         } //ready
    133   //===============================================================
     99                  complete: (function (data) {
     100                    data.src = jQuery("#theMainImage").attr("src");
     101                    jQuery("#theMainImage").trigger("Complete", data);
     102                  }),
     103                  isRejected: (function (data) {
     104                    jQuery("#theMainImage").trigger("IsRejected", data);
     105                  })
     106
     107                });
     108            }
     109
     110          }
     111        }
Note: See TracChangeset for help on using the changeset viewer.