Changeset 18735 for extensions/Autosize/js
- Timestamp:
- Oct 25, 2012, 3:24:09 PM (12 years ago)
- Location:
- extensions/Autosize/js
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/js/Affiche_script.js
r18731 r18735 57 57 } 58 58 //____________________ Save_cookies _____________________________ 59 /************************************************ 60 * 61 *************************************************/ 59 62 Get_cookies = function () { 60 63 parametres = { … … 76 79 theImageBottom: jQuery.cookie('theImageBottom'), 77 80 theImageRight: jQuery.cookie('theImageRight'), 78 79 81 theImageMargeZone: { width: jQuery.cookie('theImageMargeWidth'), 80 82 height: jQuery.cookie('theImageMargeHeight') … … 334 336 } 335 337 338 infos_theImage = jQuery(theImage_id).infos(true); // conteneur 339 336 340 337 341 if (test_theme("simple")) { … … 339 343 theImageAndInfos_id = "#content"; 340 344 infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general 341 infos_theImage = jQuery(theImage_id).infos(true); // conteneur342 345 infos_theImage.height = infos_window.height - infos_theImage.top; 343 346 // jQuery(theImage_id).height(infos_theImage.height); … … 365 368 zheight = infos_window.height - (infos_theImage.top); 366 369 } 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 391 387 392 388 if (test_theme("blanc , pure, hr_ ")) { … … 394 390 options.marge_droite += 10; 395 391 } 396 } 397 } 392 } 393 394 398 395 Zone_image = { image_init: { 399 396 width: infos_theMainImage.width, … … 597 594 **********************/ 598 595 jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ") 599 .load(function (e) { 596 .load(function (e) { 600 597 src = this.src; 601 598 theMainImage_st = true; … … 603 600 Zone_image = {}; 604 601 } 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; 610 628 } 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 }); 639 639 640 640 … … 900 900 Save_cookies(options); 901 901 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); 902 904 return; 903 905 … … 968 970 if (url) { 969 971 if (options.imgSrc != url) { 970 url = options.imgSrc;972 options.imgSrc = url; 971 973 } 972 974 } … … 998 1000 this.src = this.src; 999 1001 // alert(this.src + ' Image does not exist !!'); 1002 }).error(function (i) { 1003 this.src = this.src; 1000 1004 }); 1001 1005 ; … … 1207 1211 if (typeof Zone_image == "undefined") Zone_image = { image: {} }; 1208 1212 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; 1211 1215 1212 1216 Zone_image.image_init = { height: img_init.height, width: img_init.width, rapport: img_init.rapport }; … … 1312 1316 options.theImageMargeZone = Zone_image.marges; 1313 1317 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 ; 1316 1320 } else { 1317 1321 IMg = Get_Maxi(Zone_image.image); … … 1576 1580 retrait_img.height += 2; 1577 1581 1582 1578 1583 //=============================================================== 1579 1584 retrait_img.width = Math.ceil(infos_theMainImage.general.marges.width); // borderwidth+padding … … 1581 1586 retrait_img.width += Math.ceil(options.marges_llgbo || 0); 1582 1587 retrait_img.width += 2; 1583 1588 if (!options.check_desc_v) 1589 marge_bottom = 0; 1584 1590 1585 1591 //================== Limite Format Image ===================== … … 1729 1735 case "img_autre": 1730 1736 if (!theMainImage_id) { 1731 if (DEBUG_autosize == "true") alert("The_MainImage=null");1737 if (DEBUG_autosize.match("true", gi)) alert("The_MainImage=null"); 1732 1738 return; 1733 1739 … … 1956 1962 *********************************************/ 1957 1963 /* 1958 if (DEBUG_autosize == "true"){1964 if (DEBUG_autosize.match("true",gi)) { 1959 1965 for (var i = 0; i < 10; i++) { 1960 1966 jQuery('#adddebugs').click(); … … 1999 2005 2000 2006 2001 if (DEBUG_autosize == "mouse") {2007 if (DEBUG_autosize.match("mouse", "gi")) { 2002 2008 var mouseLocation = new Point(-500, -500); 2003 2009 function Point(x, y) { … … 2129 2135 function Debug_pos() { 2130 2136 return; 2131 if (DEBUG_autosize == "true") {2137 if (DEBUG_autosize.match("true", gi)) { 2132 2138 2133 2139 jQuery("[id ^='Debug']").show(); … … 2155 2161 2156 2162 2157 }); // ready2163 }); // ready 2158 2164 2159 2165 -
extensions/Autosize/js/autosizeDetect.js
r18716 r18735 15 15 myHeight = document.body.clientHeight; 16 16 } 17 myWidth =parseInt( myWidth);18 myHeight = parseInt(myHeight);17 windowWidth =parseInt( myWidth); 18 windowHeight = parseInt(myHeight); 19 19 20 jQuery.cookie('windowHeight', myWidth, { path: COOKIE_PATH }); 21 jQuery.cookie('windowWidth', myHeight, { path: COOKIE_PATH }); 20 theImageRight = 2; 21 theImageLeft=261; 22 theImageMargeWidth=0; 22 23 23 jQuery.cookie('theImageHeight', myHeight, { path: COOKIE_PATH }); 24 jQuery.cookie('theImageWidth', myWidth, { path: COOKIE_PATH }); 24 theImageTop =73; 25 theImageBottom = 0; 26 theImageMargeHeight=0; 27 jQuery.cookie('windowHeight', myHeight, { path: COOKIE_PATH }); 28 jQuery.cookie('windowWidth', myWidth, { path: COOKIE_PATH }); 25 29 26 jQuery.cookie('theImageHeight', theMainImageHeight, { path: COOKIE_PATH }); 27 jQuery.cookie('theImageWidth', theMainImageWidth, { path: COOKIE_PATH }); 30 jQuery.cookie('theImageRight', theImageRight, { path: COOKIE_PATH }); 31 jQuery.cookie('theImageLeft',theImageLeft, { path: COOKIE_PATH }); 32 jQuery.cookie('theImageMargeWidth',theImageMargeWidth, { path: COOKIE_PATH }); 28 33 34 jQuery.cookie('theImageTop',theImageTop, { path: COOKIE_PATH }); 35 jQuery.cookie('theImageBottom',theImageBottom, { path: COOKIE_PATH }); 36 jQuery.cookie('theImageMargeHeight', theImageMargeHeight, { path: COOKIE_PATH }); 37 /* 38 theImageWidth = windowWidth - theImageRight - theImageLeft - theImageMargeWidth; 39 theImageHeight = windowHeight - theImageTop - theImageBottom - theImageMargeHeight; 40 jQuery.cookie('theImageHeight', theImageHeight, { path: COOKIE_PATH }); 41 jQuery.cookie('theImageWidth', theImageWidth, { path: COOKIE_PATH }); 42 jQuery.cookie('theMainImageHeight', theMainImageHeight, { path: COOKIE_PATH }); 43 jQuery.cookie('theMainImage', theMainImageWidth, { path: COOKIE_PATH }); 44 */ 29 45 30 46 jQuery.cookie('autosize_reload', "ok", { path: COOKIE_PATH }); -
extensions/Autosize/js/autosize_ajax.js
r18731 r18735 18 18 function progress(success,data) { 19 19 if (success) { 20 20 jQuery("#theMainImage").height(params.height[derivatives.done]); 21 jQuery("#theMainImage").show(); 21 22 jQuery("#theMainImage").trigger("ON", [{ nb: derivatives.total - derivatives.done, total: derivatives.total, done: derivatives.done,status:"ok",src:data.url}]); 22 23 } else { … … 37 38 derivatives.elements = []; 38 39 var ids = derivatives.elements.splice(0, 500); 39 var params = { max_urls: 10, ids: ids, types: [], src: [] };40 var params = { max_urls: 10, ids: ids, types: [], src: [],width:[], height:[] }; 40 41 41 42 function getDerivativeUrls(nofile) { … … 49 50 params.types.push(t.type); 50 51 params.src.push(t.file); 52 params.width.push(t.width); 53 params.height.push(t.height); 54 51 55 } else if (~jQuery.inArray(t.file, params.src)) { 52 56 jQuery.noop(); … … 55 59 params.types.push(t.type); 56 60 params.src.push(t.file); 61 params.width.push(t.width); 62 params.height.push(t.height); 57 63 } 58 64 } … … 62 68 derivatives.elements = params.ids; 63 69 derivatives.total += params.src.length; 64 65 66 Set_images = function (dataUrls) {67 if (typeof jQuery.manageAjax != "undefined") {68 for (var i = 0; i < dataUrls.length; i++) {69 jQuery.manageAjax.add("queued", {70 type: 'GET',71 url: 'i.php?' + dataUrls[i] + "&ajaxload=true",72 dataType: 'json',73 success: (function (data) {74 derivatives.done++;75 progress(true, data);76 }),77 error: (function (data) {78 derivatives.done++;79 progress(data.statusText == "NOK", data);80 }),81 fail: (function (data) {82 a = data.statusText;83 }),84 progress: (function (data) {85 a = data.statusText;86 }),87 88 complete: (function (data) {89 progress(false, data);90 }),91 isRejected: (function (data) {92 a = data.responseText;93 })94 95 });96 }97 98 }99 }100 70 101 71 72 Set_images = function (dataUrls) { 73 if (typeof jQuery.manageAjax != "undefined") { 74 for (var i = 0; i < dataUrls.length; i++) { 75 fichier = dataUrls[i]; 76 if (fichier != "") 77 jQuery.manageAjax.add("queued", { 78 type: 'GET', 79 url: 'i.php?' + fichier + "&ajaxload=true", 80 dataType: 'json', 81 success: (function (data) { 82 j = derivatives.done; 83 derivatives.done++; 84 for (var j = 0; j < params.src.length; j++) { 85 if (data.url.match(params.src[j])) { 86 params.src[j] = ""; break; 87 } 88 } 89 progress(true, data); 90 }), 91 error: (function (data) { 92 // derivatives.done++; 93 progress(data.statusText == "NOK", data); 94 }), 95 fail: (function (data) { 96 a = data.statusText; 97 }), 98 progress: (function (data) { 99 a = data.statusText; 100 }), 101 102 complete: (function (data) { 103 progress(false, data); 104 }), 105 isRejected: (function (data) { 106 a = data.responseText; 107 }) 108 109 }); 110 } 111 112 } 113 } 114 115 jQuery("body").append("<div style='position:abosolute;left:-200;top:-200'>"); 102 116 if (derivatives.elements.length) { 103 117 if (derivatives.total - derivatives.done > 0)
Note: See TracChangeset
for help on using the changeset viewer.