Ignore:
Timestamp:
Oct 25, 2012, 3:24:09 PM (12 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix compatibility with 2.4 (option marge bottom)

File:
1 edited

Legend:

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

    r18731 r18735  
    5757    }
    5858    //____________________ Save_cookies _____________________________
     59    /************************************************
     60    *
     61    *************************************************/
    5962    Get_cookies = function () {
    6063      parametres = {
     
    7679        theImageBottom: jQuery.cookie('theImageBottom'),
    7780        theImageRight: jQuery.cookie('theImageRight'),
    78 
    7981        theImageMargeZone: { width: jQuery.cookie('theImageMargeWidth'),
    8082          height: jQuery.cookie('theImageMargeHeight')
     
    334336      }
    335337
     338      infos_theImage = jQuery(theImage_id).infos(true);                 // conteneur
     339
    336340
    337341      if (test_theme("simple")) {
     
    339343        theImageAndInfos_id = "#content";
    340344        infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
    341         infos_theImage = jQuery(theImage_id).infos(true);                 // conteneur
    342345        infos_theImage.height = infos_window.height - infos_theImage.top;
    343346        //  jQuery(theImage_id).height(infos_theImage.height);
     
    365368        zheight = infos_window.height - (infos_theImage.top);
    366369      }
    367       h01 = 0;
    368       h02 = 0;
    369       if (options.check_desc_v) {
    370 
    371         infos_comments = jQuery("#comments").infos(true);
    372         infos_Licence = jQuery(".licencetag").infos(true);
    373         infos_imageComment = jQuery(imageComment_id).infos(true);
    374 
    375         if (infos_imageComment.visible == true && infos_imageComment.general.bottom > infos_theMainImage.bottom) {
    376           h02 = infos_imageComment.general.bottom - infos_theMainImage.bottom;
    377         }
    378         if (infos_Licence.visible == true && infos_Licence.general.bottom > infos_theMainImage.bottom) {
    379           h01 = infos_Licence.general.bottom - infos_theMainImage.bottom;
    380         }
    381         delta_h = infos_imageInfos.bottom - infos_imageInfos.top;
    382         info_comments1 = jQuery(theImage_id + " p").infos(true);
    383         if (test_theme("simple")) {
    384           options.marge_basse += info_comments1.general.height;
    385 
    386         } else {
    387           if (test_theme("stripped")) {
    388 
    389           } else
    390             options.marge_basse += Math.max(h01, h02);
     370
     371
     372      if (options.check_desc_v) { }
     373
     374      infos_comments = jQuery("#comments").infos(true);
     375      infos_Licence = jQuery(".licencetag").infos(true);
     376      infos_imageComment = jQuery(imageComment_id).infos(true);
     377
     378
     379
     380      if (test_theme("simple")) {
     381
     382
     383      } else {
     384        if (test_theme("stripped")) {
     385
     386        } else
    391387
    392388          if (test_theme("blanc , pure, hr_ ")) {
     
    394390            options.marge_droite += 10;
    395391          }
    396         }
    397       }
     392      }
     393
     394
    398395      Zone_image = { image_init: {
    399396        width: infos_theMainImage.width,
     
    597594    **********************/
    598595    jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ")
    599         .load(function (e) {         
     596        .load(function (e) {
    600597          src = this.src;
    601598          theMainImage_st = true;
     
    603600            Zone_image = {};
    604601          }
    605           Zone_image.image_init = { width: this.width, height: this.height, rapport: this.width / this.height }
    606           return;
    607           if (typeof theMainImage_id != "undefined")
    608             if (!init_img(this)) {
    609               nu_img = 0;
     602          Zone_image.image_init = { width: this.width, height: this.height, rapport: this.width / this.height };
     603          if (!init_img(this)) {
     604            nu_img = 0;
     605          }
     606
     607        })
     608         .error(function (e) {
     609           if (!this.complete) {
     610             jQuery(this).hide();
     611
     612           }
     613
     614         })
     615         .bind("Finish", function (e, data) {
     616           if (typeof imageInfos_id == "undefined") return;
     617           Autosize_resize(true, options);
     618         })
     619          .bind("ON", function (e, data) {
     620            if (data.status != "ok") {
     621              popup = jQuery(".errors");
     622              if (popup.length == 0) {
     623                jQuery("#theImage").append("<div class='errors'><span></span></div>");
     624              }
     625              jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText);
     626              jQuery(".errors").show().delay(20000).hide(2000);
     627              return;
    610628            }
    611           })
    612          .error(function (e) {
    613 
    614          })
    615          .bind("Finish", function (e, data) {             
    616               if (typeof imageInfos_id == "undefined") return;
    617                   Autosize_resize(true, options);
    618           })
    619           .bind("ON", function (e, data) {
    620          if (data.status != "ok") {
    621            popup = jQuery(".errors");
    622            if (popup.length == 0) {
    623              jQuery("#theImage").append("<div class='errors'><span></span></div>");
    624            }
    625            jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText);
    626            jQuery(".errors").show().delay(20000).hide(2000);
    627            return;
    628          }
    629          if (data.src) {
    630            theImg = document.getElementById(theMainImage_id.replace("#", ""));
    631             jQuery("#theMainImage").attr("src", data.src);
    632             theImg.src = data.src;
    633            if (data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) {
    634              theImg.src = options.imgSrc;
    635 
    636            }
    637          }
    638        });
     629            if (data.src) {
     630              theImg = document.getElementById(theMainImage_id.replace("#", ""));
     631              jQuery("#theMainImage").attr("src", data.src);
     632              theImg.src = data.src;
     633              if (data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) {
     634                theImg.src = options.imgSrc;
     635
     636              }
     637            }
     638          });
    639639
    640640
     
    900900      Save_cookies(options);
    901901      if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") {
     902        jQuery(theImg).width(Zone_image.image_init.width);
     903        jQuery(theImg).height(Zone_image.image_init.height);
    902904        return;
    903905
     
    968970      if (url) {
    969971        if (options.imgSrc != url) {
    970           url = options.imgSrc;
     972          options.imgSrc = url;
    971973        }
    972974      }
     
    9981000        this.src = this.src;
    9991001        // alert(this.src + ' Image does not exist !!');
     1002      }).error(function (i) {
     1003        this.src = this.src;
    10001004      });
    10011005      ;
     
    12071211      if (typeof Zone_image == "undefined") Zone_image = { image: {} };
    12081212      if (typeof Zone_image.image == "undefined") Zone_image.image = { height: Zone_image.image_init.height, width: Zone_image.image_init.width };
    1209       theImg.height = img_init.height;
    1210       theImg.width = img_init.width;
     1213      // theImg.height = img_init.height;
     1214      //  theImg.width = img_init.width;
    12111215
    12121216      Zone_image.image_init = { height: img_init.height, width: img_init.width, rapport: img_init.rapport };
     
    13121316        options.theImageMargeZone = Zone_image.marges;
    13131317        if (Type_Img != 'charlie') {
    1314           if (options.pictureSelType != "SelMaxi" && options.pictureSelType != "Autosize" && Type_Img != 'pamoorama') {
    1315             IMg = Get_Maxi(Zone_image.image_init);
     1318          if (options.pictureSelType != "SelMaxi" && options.pictureSelType != "Autosize" ) {
     1319          return ;
    13161320          } else {
    13171321            IMg = Get_Maxi(Zone_image.image);
     
    15761580      retrait_img.height += 2;
    15771581
     1582
    15781583      //===============================================================
    15791584      retrait_img.width = Math.ceil(infos_theMainImage.general.marges.width); // borderwidth+padding
     
    15811586      retrait_img.width += Math.ceil(options.marges_llgbo || 0);
    15821587      retrait_img.width += 2;
    1583 
     1588      if (!options.check_desc_v)
     1589        marge_bottom = 0;
    15841590
    15851591      //================== Limite Format Image =====================
     
    17291735        case "img_autre":
    17301736          if (!theMainImage_id) {
    1731             if (DEBUG_autosize == "true") alert("The_MainImage=null");
     1737            if (DEBUG_autosize.match("true", gi)) alert("The_MainImage=null");
    17321738            return;
    17331739
     
    19561962    *********************************************/
    19571963    /*
    1958     if (DEBUG_autosize == "true") {
     1964    if (DEBUG_autosize.match("true",gi))  {
    19591965    for (var i = 0; i < 10; i++) {
    19601966    jQuery('#adddebugs').click();
     
    19992005
    20002006
    2001     if (DEBUG_autosize == "mouse") {
     2007    if (DEBUG_autosize.match("mouse", "gi")) {
    20022008      var mouseLocation = new Point(-500, -500);
    20032009      function Point(x, y) {
     
    21292135    function Debug_pos() {
    21302136      return;
    2131       if (DEBUG_autosize == "true") {
     2137      if (DEBUG_autosize.match("true", gi)) {
    21322138
    21332139        jQuery("[id ^='Debug']").show();
     
    21552161
    21562162
    2157   });                                                                                                                                                                                                                                                                                                                                                                                                                                                                     // ready
     2163  });                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     // ready
    21582164
    21592165
Note: See TracChangeset for help on using the changeset viewer.