Changeset 18936 for extensions/Autosize/js/Affiche_script.js
- Timestamp:
- Nov 5, 2012, 1:05:53 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/js/Affiche_script.js
r18925 r18936 58 58 //____________________ Save_cookies _____________________________ 59 59 /************************************************ 60 * 60 * Get COOKIE 61 61 *************************************************/ 62 62 Get_cookies = function () { … … 170 170 if (typeof options.cl_visible == "undefined") return; 171 171 if (typeof src1 == "undefined") return; 172 173 172 if (options.cl_visible) src = src1; 174 173 else src = src2; 175 174 175 if (typeof options.pictureSelType != "undefined" && (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi")) { 176 if (options.pictureSelType == "SelMaxi") src = src6; 177 } else { 178 Valid = false; 179 src = src2; 180 jQuery("#bp_cla span").text(""); 181 } 176 182 if (options.cl_visible) { 177 183 src_info = src3; … … 181 187 src_infos_1 = src5; 182 188 } 183 189 src_info = options.pictureDeriv; 184 190 if (!Valid) { 185 191 Zone_image.image.height = Zone_image.image_init.height; 186 192 Zone_image.image.width = Zone_image.image_init.width; 187 src = src6; 193 188 194 } 189 195 if ((typeof Zone_image != "undefined") && typeof Zone_image.image != "undefined") { 190 191 196 Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height); 192 197 zoom_cl = parseInt(100 * Zone_image.zoom) + "%"; ; 193 194 198 if (!Valid) { 195 199 if (options.pictureSelType == "SelMaxi") 196 200 zoom_cl = options.pictureSelType + " [" + options.pictureDeriv + "]"; 197 else 198 zoom_cl = " [" + options.pictureDeriv + "]"; 199 200 } else 201 202 203 jQuery('#bp_cla').attr('alt', src_info); 201 else { 202 zoom_cl = ""; 203 src_info = options.pictureDeriv; 204 } 205 } 206 jQuery('#bp_cla').attr('alt', src_info); 204 207 jQuery('#bp_cla').attr('title', src_info); 205 208 jQuery('#bp_cla').attr('Stitle', src_info); … … 209 212 rap_init: Zone_image.image_init.rapport 210 213 } 211 212 213 214 jQuery('#bp_cla span').text(zoom_cl); 214 215 color_back = jQuery('#imageToolBar').css("backgroundColor"); … … 251 252 252 253 /******************************** 253 * Set__ bgo254 * Set__llbgo 254 255 *********************************/ 255 256 Set_llbgo = function (Force) { 256 257 257 if ( marges_llgbo == 0) return;258 if (options.marges_llgbo == 0) return; 258 259 if (Type_Img == "pamoorama") { 259 260 … … 470 471 ********************************************/ 471 472 jQuery(window).unload(function () { 472 return;473 // return; 473 474 }); 474 475 //_________ unload ___________ … … 596 597 spans.next().text(options.pictureDeriv); 597 598 //========================================================== 598 599 599 /* 600 601 602 600 jQuery('#derivativeCheckedAutosize').hide(); 603 601 jQuery('#derivativeCheckedAutosize').next().hide(); 604 602 jQuery('#derivativeCheckedAutosize').next().next().hide(); 605 603 */ 606 607 608 604 //============================================================= 609 605 // REPONSE ACTION 610 606 //============================================================= 611 607 theMainImage_st = false; 612 613 614 /***********************615 *616 **********************/617 jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ")618 .load(function (e) {619 src = this.src;620 theMainImage_st = true;621 if (typeof Zone_image == "undefined") {622 Zone_image = {};623 }624 Zone_image.image_init = { width: this.width, height: this.height, rapport: this.width / this.height };625 if (!init_img(this)) {626 nu_img = 0;627 }628 629 })630 .error(function (e) {631 if (!this.complete) {632 src = jQuery(this).attr("src").replace("./_data/i/", "", 1);633 jQuery.ajax({634 type: 'GET',635 url: 'i.php?' + src + "&ajaxload=true",636 dataType: 'json',637 success: (function (data) {638 j = data;639 })640 641 });642 643 644 645 }646 647 })648 .bind("Finish", function (e, data) {649 if (typeof imageInfos_id == "undefined") return;650 651 })652 .bind("ON", function (e, data) {653 if (data.status != "ok") {654 popup = jQuery(".errors");655 if (popup.length == 0) {656 jQuery("#theImage").append("<div class='errors'><span></span></div>");657 }658 jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText);659 jQuery(".errors").show().delay(10000).hide(2000);660 return;661 }662 if (data.src) {663 if (typeof imageInfos_id == "undefined") return;664 if (data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) {665 // Autosize_resize(true, options);666 }667 }668 });669 670 671 ;672 673 674 675 676 ;677 //_________ theMainImage ___________678 679 680 608 jQuery("#reset").click(function () { 681 609 location.reload(); … … 850 778 // options.pictureDeriv = retour.pictureDeriv; 851 779 options.pictureSelType = retour.pictureSelType; 852 options.picture Map = options.pictureDeriv;853 780 options.pictureDeriv = retour.pictureDeriv; 781 options.pictureMap = retour.pictureDeriv; 854 782 855 783 if (this.name) { 856 784 options.pictureSelType = this.name; 857 785 n = Get_dimensions(true, options); 858 859 860 861 786 } else { 862 863 864 787 } 865 788 … … 872 795 jQuery(".auto_details").text(""); 873 796 } 797 Autosize_resize(true, options); 874 798 } 875 799 }); … … 889 813 return; 890 814 }); 891 //____________________ set_llgbo _____________________________ 815 892 816 893 817 //==================================== … … 927 851 Save_cookies(options); 928 852 if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") { 853 /**/ 929 854 jQuery(theImg).width(Zone_image.image_init.width); 930 855 jQuery(theImg).height(Zone_image.image_init.height); 856 857 set_cl("no"); 858 Set_llbgo(true); 931 859 return; 932 860 … … 971 899 972 900 } else { 973 jQuery(theMainImage_id). height(Zone_image.image.height);974 jQuery(theMainImage_id). width(Zone_image.image.width);901 jQuery(theMainImage_id).width(Zone_image.image_init.width); 902 jQuery(theMainImage_id).height(Zone_image.image_init.height); 975 903 } 976 904 … … 999 927 changeImgSrc = function (url, typeSave, typeMap, type) { 1000 928 if (url) { 1001 if (options.imgSrc != url) { 1002 options.imgSrc = url; 1003 } 1004 } 1005 jQuery("#theMainImage") 1006 .removeAttr("width height") 1007 .attr("src", url) 929 if (url.match(RegExp("i.php", "gi"))) { 930 urls = url.split("?"); 931 } 932 } 933 url2 = jQuery("#theMainImage").attr("src"); 934 return; 935 936 jQuery("#theMainImage").removeAttr("width height").attr("src", url) 1008 937 .load(function (i) { 1009 url2 = this.src; 938 if (!init_img(this)) 939 return; 940 //======================================================================= 1010 941 jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden'); 1011 942 newtype = options.pictureSelType; 1012 943 if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) { 1013 1014 944 jQuery('#derivativeChecked' + type).css('visibility', 'visible'); 1015 945 document.cookie = 'picture_sel_type=' + type + ';path=' + COOKIE_PATH; … … 1018 948 document.cookie = 'picture_sel_type=' + typeSave + ';path=' + COOKIE_PATH; 1019 949 } 1020 1021 950 options.pictureMap = typeMap; 1022 951 options.pictureDeriv = typeSave; 1023 952 document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH; 1024 Autosize_resize(true, options); 1025 if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) { 1026 1027 } else { 1028 jQuery("#bp_img_cla").attr("src", "./plugins/Autosize/icons/button-maximize.png"); 1029 jQuery("#bp_cla span").text(""); 1030 } 953 1031 954 }) 1032 955 .live("ON", function (e) { 1033 956 theMainImage_st = this.complete; 1034 this.src = this.src;957 imgsrc = this.src; 1035 958 // alert(this.src + ' Image does not exist !!'); 1036 959 }).error(function (i) { 1037 this.src = this.src;960 imgsrc = this.src; 1038 961 }); 1039 ; 1040 962 /*********************** 963 * 964 **********************/ 965 jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ") 966 .error(function (e) { 967 if (!this.complete) { 968 // le fichier n'est pas present 969 src = jQuery(this).attr("src").replace("./_data/i/", "", 1); 970 src = this.src.split("/_data/i")[1]; 971 url = 'i.php?' + src + "&ajaxload=true"; 972 jQuery(theMainImage_id).attr("src", url); 973 /* 974 jQuery.ajax({ 975 type: 'GET', 976 url: 'i.php?' + src + "&ajaxload=true", 977 dataType: 'json', 978 success: (function (data) { 979 j = data.url; 980 // jQuery(theMainImage_id).attr("src", data.url); 981 982 }) 983 984 }); 985 */ 986 987 988 989 } 990 991 }) 992 .bind("Finish", function (e, data) { 993 if (typeof imageInfos_id == "undefined") return; 994 995 }) 996 .bind("ON", function (e, data) { 997 if (data.status != "ok") { 998 popup = jQuery(".errors"); 999 if (popup.length == 0) { 1000 jQuery("#theImage").append("<div class='errors'><span></span></div>"); 1001 } 1002 jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText); 1003 jQuery(".errors").show().delay(10000).hide(2000); 1004 return; 1005 } 1006 if (data.src) { 1007 if (typeof imageInfos_id == "undefined") return; 1008 if (!data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) { 1009 Autosize_resize(true, options); 1010 } 1011 } 1012 }); 1013 //_________ theMainImage ___________ 1041 1014 1042 1015 … … 1118 1091 //__________________ Wait_pamoorama ______________________ 1119 1092 jQuery(".pwg-icon-clock-minus, .pwg-icon-clock-plus").click(function (i) { 1120 n = window.myPamoorama; 1121 n = this; 1093 1094 1095 1096 1097 1098 }).mouseover(function (i) { 1099 1122 1100 }) 1101 1123 1102 1124 1103 Wait_pamoorama_time = function () { 1125 1104 if (nopano == true) return true; 1105 1106 1107 1126 1108 if (jQuery("#pamoorama").length) { 1127 1109 tempo = tempo + 1; … … 1152 1134 1153 1135 nopano = true; 1136 1154 1137 Zone_image = { image_init: { width: mypanorama.imageWidth, 1155 1138 height: mypanorama.imageHeight … … 1309 1292 maxi_size = size_derive; 1310 1293 maxi_size.idx = n; 1311 return false 1294 if (options.pictureSelType == "SelMaxi" || options.pictureSelType == "Autosize") 1295 return false 1312 1296 } 1313 1297 } … … 1330 1314 1331 1315 } 1316 1332 1317 options.pictureDeriv = pt[n][0]; 1333 1318 return { url: pt[n][1], pictureDeriv: pt[n][0], pictureMap: pt[n][0], width: pt[n][2], height: pt[n][3] }; … … 1350 1335 options.theImageMargeZone = Zone_image.marges; 1351 1336 if (Type_Img != 'charlie') { 1337 /* 1352 1338 if (options.pictureSelType != "SelMaxi" && options.pictureSelType != "Autosize") { 1353 return; 1339 options.pictureMap = options.pictureDeriv; 1340 1341 imgSrc = options.liste_type[6]; 1342 changeImgSrc(imgSrc, options.pictureDeriv, options.pictureMap, options.pictureSelType); 1343 src = theImg.src; 1344 return; 1354 1345 } else { 1355 1346 IMg = Get_Maxi(Zone_image.image); 1356 1347 } 1348 */ 1349 IMg = Get_Maxi(Zone_image.image); 1357 1350 imgSrc = IMg.url; 1358 options.imgSrc = imgSrc; 1351 if (options.imgSrc.match(RegExp(imgSrc, "gi"))) 1352 options.imgSrc = imgSrc; 1353 1359 1354 img_width = IMg.width; 1360 1355 img_height = IMg.height; … … 1376 1371 Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height; 1377 1372 if (typeof Zone_image.src == "undefined") Zone_image.src = " "; 1378 status = imgSrc.match(RegExp(Zone_image.src, "gi")); // status = '' si != 1379 status1 = (imgSrc.toString() == Zone_image.src.toString()); 1380 1381 if (status1 == true) { 1382 // changeImgSrc(imgSrc, IMg.pictureMap, IMg.pictureDeriv, options.pictureSelType); 1383 return; 1384 1385 } 1373 1374 identique = Zone_image.src.match(RegExp(imgSrc, "gi")); 1375 if (identique) return; 1386 1376 href_path = "javascript:changeImgSrc('" + imgSrc + "', '" + IMg.pictureMap + "', '" + IMg.pictureDeriv + "', '" + options.pictureSelType + "')"; 1387 1377 jQuery(".linkAutosize").attr("href", href_path); … … 1392 1382 imgSrc_j = jQuery(theImg).css("background-image"); 1393 1383 return; 1394 1395 1384 } else { 1396 theImg.src = imgSrc;1385 changeImgSrc(imgSrc, IMg.pictureDeriv, IMg.pictureMap, options.pictureSelType); 1397 1386 } 1398 1387 … … 1673 1662 1674 1663 } 1675 1676 1677 1678 1679 } 1680 1681 1682 1664 } 1665 //================================================================= 1683 1666 Zone_image.image = { 1684 1667 width: width_theMainImage, 1685 1668 height: height_theMainImage, 1686 1669 rapport: width_theMainImage / height_theMainImage 1687 1688 1670 }; 1689 1690 1691 //=================================================================1692 1671 Zone_image.marges = { width: marge_left + marge_right + retrait_img.width, 1693 1672 height: marge_top + marge_bottom + retrait_img.height 1694 1695 1673 } 1696 1674 Zone_image.src = jQuery(theMainImage_id).attr("src"); 1697 1698 1675 } 1699 1676 … … 1716 1693 options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight; 1717 1694 options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop; 1718 1719 1720 1721 1722 1695 var chk = eval("options." + user_status + "_enabled"); 1723 1696 if (chk == "") { return; } … … 1837 1810 * init_gen 1838 1811 *****************************/ 1839 1840 1812 init_gen = function (e) { 1841 1842 1843 1813 theImg = document.getElementById(theMainImage_id.replace("#", "")); 1844 1814 //================================================== … … 1944 1914 pictureDeriv = options.pictureDeriv; 1945 1915 Autosize_resize(true, options); 1916 Autosize_resize(true, options); 1946 1917 return; 1918 1947 1919 IMg = Get_Maxi(Zone_image.image); 1948 1920 imgSrc = IMg.url; … … 2200 2172 2201 2173 2202 }); // ready2174 }); // ready 2203 2175 2204 2176
Note: See TracChangeset
for help on using the changeset viewer.