Changeset 19003 for extensions/Autosize/js/Affiche_script.js
- Timestamp:
- Nov 13, 2012, 3:06:06 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/js/Affiche_script.js
r18975 r19003 6 6 * document ready 7 7 ********************************************/ 8 9 10 8 jQuery(document).ready(function (jQuery) { 11 9 var Type_Img; … … 32 30 parametres.windowWidth = jQuery(window).width(); 33 31 try { 32 if (parametres.pictureDeriv) jQuery.cookie('picture_deriv', parametres.pictureDeriv, { path: COOKIE_PATH }); 34 33 if (parametres.pictureSelType) jQuery.cookie('picture_sel_type', parametres.pictureSelType, { path: COOKIE_PATH }); 35 if (parametres.pictureDeriv) jQuery.cookie('picture_deriv', parametres.pictureDeriv, { path: COOKIE_PATH });36 34 if (parametres.pictureMap) jQuery.cookie('picture_map', parametres.pictureMap, { path: COOKIE_PATH }); 37 35 if (parametres.imgSrc) jQuery.cookie('img_src', parametres.imgSrc, { path: COOKIE_PATH }); … … 51 49 } 52 50 } catch (e) { 53 51 n = 1; 54 52 } 55 53 … … 64 62 pictureDeriv: jQuery.cookie('picture_deriv'), 65 63 pictureMap: jQuery.cookie('picture_map'), 64 pictureSelType: jQuery.cookie('picture_sel_type'), 65 66 66 imgSrc: jQuery.cookie('img_src'), 67 pictureSelType: jQuery.cookie('picture_sel_type'),68 67 theMainImageHeight: jQuery.cookie('theMainImageHeight'), 69 68 theMainImageWidth: jQuery.cookie('theMainImageWidth'), 70 71 69 72 70 windowHeight: jQuery.cookie('windowHeight'), … … 228 226 229 227 } 228 jQuery("#derivativeSwitchBox span").removeClass("auto_details linkAutosize"); 229 jQuery("#derivativeSwitchBox a").removeClass("auto_details linkAutosize"); 230 if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") { 231 spans = jQuery("#derivativeChecked" + options.pictureSelType).next(); 232 spans.addClass("linkAutosize"); 233 spans.find("span").addClass("auto_details"); 234 jQuery(".auto_details").text(""); 235 } 230 236 if (options.pictureDeriv) { 237 if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") 238 jQuery("#derivativeChecked" + options.pictureSelType).css("visibility", "visible"); 239 else 240 jQuery("#derivativeChecked" + options.pictureDeriv).css("visibility", "visible"); 231 241 jQuery('.auto_details').text(" (" + Zone_image.image.width + " x " + Zone_image.image.height + ") " + options.pictureDeriv); 232 242 } … … 247 257 } 248 258 Affiche_limite(pictureSelType_user); 249 jQuery("#derivativeChecked" + options.pictureDeriv).css({ visibility: 'visible' });250 251 259 } 252 260 //____________________ set_cl _____________________________ … … 306 314 ********************************************/ 307 315 jQuery(window).load(function () { 308 href = location.href;316 location_href = location.href; 309 317 var aff_ok = false; 310 318 //======================================================================= … … 312 320 infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true }); 313 321 infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general 314 the MainImage_obj = "theMainImage_obj";315 infos_theMainImage_obj = jQuery("#" + the MainImage_obj).infos({ absolute: true });322 the_mainImage_obj = "theMainImage_obj"; 323 infos_theMainImage_obj = jQuery("#" + the_mainImage_obj).infos({ absolute: true }); 316 324 317 325 infos_theMainImage_obj.rapport = infos_theMainImage_obj.width / infos_theMainImage_obj.height; … … 484 492 } 485 493 options = jQuery.extend(Autosize_options, options); 486 var COOKIE_PATH = options.COOKIE_PATH; 487 var cookies = Get_cookies(); 494 488 495 489 496 var defaults = { … … 505 512 options.marge_gauche = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("left")); 506 513 options.marge_droite = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("right")); 514 507 515 jQuery(".Autosize").hide(); 516 DEBUG_autosize = options.DEBUG_autosize; 517 var COOKIE_PATH = options.COOKIE_PATH; 518 var cookies = Get_cookies(); 508 519 509 520 fade_in = options.fade_in || 0; … … 516 527 } 517 528 518 DEBUG_autosize = options.DEBUG_autosize; 529 519 530 Get_type_img(); 520 531 … … 571 582 path_names = new Array(); 572 583 jQuery("#derivativeSwitchBox a").css('visibility', 'hidden'); 573 jQuery(".switchCheck").css('visibility', 'hidden');584 // jQuery(".switchCheck").css('visibility', 'hidden'); 574 585 var maxi_display = false; 575 586 jQuery("#derivativeSwitchBox a").each(function (i) { 576 587 href_path = jQuery(this).attr("href"); 588 if (!href_path) { 589 href_path = jQuery(this).html(); 590 return; 591 } 592 pt = href_path.replace(/(javascript|changeImgSrc)|[('):]/gi, ""); 593 577 594 patname = href_path.replace("javascript\:", ""); 578 path_names.push(patname); 579 pt[i] = href_path.split("','"); 580 tsz = pt[i][2].replace("')", ""); 595 pt = pt.split(","); 596 tsz = pt[pt.length - 1]; 581 597 if (!maxi_display) 582 598 jQuery(this).css('visibility', 'visible'); … … 595 611 if (tsz == "Original" && (pictureSelType_Maxi != "Autosize" && pictureSelType_Maxi != "SelMaxi")) { 596 612 maxi_display = true; 597 } 598 if (tsz == pictureSelType_Maxi && (pictureSelType_Maxi != "Autosize" && pictureSelType_Maxi != "SelMaxi")) { 613 } else if (tsz == pictureSelType_Maxi && (pictureSelType_Maxi != "Autosize" && pictureSelType_Maxi != "SelMaxi")) { 599 614 maxi_display = true; 600 615 601 } 616 } else if (tsz == "Autosize" || tsz == "SelMaxi") { 617 patname = old_path.replace("')", "','" + tsz + "')"); 618 } else 619 old_path = patname; 620 path_names.push(patname); 602 621 603 622 } … … 759 778 function decode_href(myObj) { 760 779 hrefPath = jQuery(myObj).attr("href"); 761 if (hrefPath.indexOf("changeImg ") ==0) {780 if (hrefPath.indexOf("changeImgSrc") < 0) { 762 781 pt = hrefPath; 763 782 } else { 764 pt = hrefPath.split("("); 765 pt = pt[1].split(")"); 766 pt = pt[0].replace(RegExp("'", "g"), ""); 767 } 768 pt = pt.replace(RegExp(" ", "g"), ""); 783 pt = hrefPath.replace(/(javascript|phpWGOpenWindow|javascript|changeImgSrc)|[('):]/gi, ""); 784 785 } 769 786 pt = pt.split(","); 770 787 source = pt[0]; 771 772 pictureDeriv = pt[1]; 773 pictureMap = pt[2]; 774 if (pt.length > 3) 775 pictureSelType = pt[3]; 776 else 777 pictureSelType = pt[1]; 778 788 if (hrefPath.indexOf("phpWGOpenWindow") < 0) { 789 pictureDeriv = pt[1]; 790 pictureMap = pt[2]; 791 pictureSelType = pt[pt.length - 1]; 792 } else { 793 pictureDeriv = options.pictureDeriv; 794 pictureMap = options.pictureMap; 795 pictureSelType = options.pictureSelType; 796 } 779 797 return { source: source, 780 798 pictureDeriv: pictureDeriv, … … 801 819 802 820 } 803 804 jQuery("#derivativeSwitchBox span").removeClass("auto_details linkAutosize");805 jQuery("#derivativeSwitchBox a").removeClass("auto_details linkAutosize");806 if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {807 spans = jQuery("#derivativeChecked" + options.pictureSelType).next();808 spans.addClass("linkAutosize");809 spans.find("span").addClass("auto_details");810 jQuery(".auto_details").text("");811 }812 821 Autosize_resize(true, options); 813 822 } … … 918 927 919 928 if (Type_Img == "charlie" || Type_Img == "iframe") { 920 921 922 929 if (Type_Img == "charlie") { 923 930 dp1 = jQuery("#charlie").offset(); 924 dp = jQuery("#" + the MainImage_obj).offset();931 dp = jQuery("#" + the_mainImage_obj).offset(); 925 932 if (dp) { 926 933 if (wpng == 0) 927 wpng = (dp.left - dp1.left) * 2;934 wpng = Math.abs(dp.left - dp1.left) * 2; 928 935 } 929 mrgl = (jQuery("#" + "theImage").width() - Zone_image.image.width) / 2;930 936 png_h = jQuery("#" + Type_Img + " div").height(); 931 jQuery("#" + Type_Img).css({ marginLeft: mrgl + "px" }); 932 jQuery("#" + Type_Img).width(Zone_image.image.width); 933 jQuery("#" + Type_Img).height(Zone_image.image.height); 934 935 w01 = jQuery("#" + theMainImage_obj).width(); 936 jQuery("#" + theMainImage_obj).attr("width", Zone_image.image.width - wpng); 937 jQuery("#" + theMainImage_obj).attr("height", Zone_image.image.height); 938 jQuery("#theMainImage_emb").attr("width", Zone_image.image.width - wpng); 939 jQuery("#theMainImage_emb").attr("height", Zone_image.image.height); 937 w01 = Math.ceil(jQuery("#" + "theImage").width() - wpng); 938 jQuery("#" + "theImage").css({ padding: 0 }); 939 if (!png_h) { 940 png_h = jQuery("#theMainImage").height(); 941 h01 = png_h; 942 } else 943 h01 = Math.ceil(w01 / Zone_image.image.rapport); 944 //==== Zone Affichage ===== 940 945 jQuery("#theMainImage").height(png_h); 946 jQuery("#theMainImage").width(w01 + wpng); 947 jQuery("#theMainImage").css({ verticalAlign: "middle", align: "center", textAlign: "center", margin: "auto" }); 948 949 jQuery("#" + the_mainImage_obj).attr("width", w01); 950 jQuery("#" + the_mainImage_obj).attr("height", h01); 951 952 jQuery("#theMainImage_emb").attr("width", w01); //firefox opera 953 jQuery("#theMainImage_emb").attr("height", h01); 954 955 if (jQuery("#theMainImage_vid").length > 0) { 956 jQuery("#theMainImage_vid").attr("width", w01); 957 jQuery("#theMainImage_vid").attr("height", h01); 958 } 959 if (jQuery("video").length > 0) { 960 jQuery("video").attr("width", w01); 961 jQuery("video").attr("height", h01); 962 } 941 963 jQuery("#" + Type_Img).height(png_h); 942 964 943 965 966 jQuery("#" + Type_Img + " div").width(w01); 967 968 969 944 970 } else { 945 jQuery("# " + theMainImage_obj).attr("width", Zone_image.image.width);946 jQuery("# " + theMainImage_obj).attr("height", Zone_image.image.height);947 jQuery("#" + Type_Img).attr("width", Zone_image.image.width );948 jQuery("#" + Type_Img).attr("height", Zone_image.image.height );971 jQuery("#theImage").css({ height: "auto" }); 972 jQuery("#theMainImage").css({ width: "auto", height: "auto" }); 973 jQuery("#" + Type_Img).attr("width", Zone_image.image.width - (infos_theMainImage.borderwidth.left + infos_theMainImage.borderwidth.right)); 974 jQuery("#" + Type_Img).attr("height", Zone_image.image.height - (infos_theMainImage.borderwidth.top + infos_theMainImage.borderwidth.bottom)); 949 975 } 950 951 952 953 976 jQuery("#" + Type_Img).show(options.fade_in); 954 977 } … … 967 990 ******************/ 968 991 changeImgSrc = function (url, typeSave, typeMap, type) { 969 if (url) { 970 if (url.match(RegExp("i.php", "gi"))) { 971 urls = url.split("?"); 972 urls = urls[1].split("?"); 973 // Set_images(urls); 974 975 } 976 } 977 url2 = jQuery("#theMainImage").attr("src"); 978 if (typeof type != "undefined") 992 993 if (COOKIE_PATH == type) { 994 type = options.pictureSelType; 995 } 996 if (typeof type != "undefined") { 979 997 options.pictureSelType = type; 980 else { 981 options.pictureSelType = typeSave; 982 type = typeSave; 983 998 } else { 999 type = options.pictureSelType; 984 1000 } 985 1001 options.pictureDeriv = typeSave; 986 1002 typeMap = typeSave; 987 1003 options.pictureMap = typeMap; 1004 options.pictureDeriv = typeSave; 1005 jQuery.cookie('picture_deriv', typeSave, { path: COOKIE_PATH }); 1006 1007 url_old = jQuery("#theMainImage").attr("src"); 1008 if (url != url_old) { 1009 jQuery("#theMainImage").attr("src", url); 1010 } 988 1011 jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden'); 989 1012 if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) { 990 1013 jQuery('#derivativeChecked' + type).css('visibility', 'visible'); 991 document.cookie = 'picture_sel_type=' + type + ';path=' + COOKIE_PATH;1014 jQuery.cookie('picture_sel_type', type, { path: COOKIE_PATH }); 992 1015 } else { 993 1016 994 1017 jQuery('#derivativeChecked' + typeSave).css('visibility', 'visible'); 995 document.cookie = 'picture_sel_type=' + typeSave + ';path=' + COOKIE_PATH; 996 } 997 options.pictureMap = typeMap; 998 options.pictureDeriv = typeSave; 999 document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH; 1000 jQuery("#theMainImage").attr("src", url); 1018 jQuery.cookie('picture_sel_type', typeSave, { path: COOKIE_PATH }); 1019 } 1001 1020 1002 1021 // jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ") … … 1014 1033 // le fichier n'est pas present 1015 1034 imgsrc = jQuery(this).attr("src"); 1016 1017 1035 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 1036 } 1026 1037 … … 1066 1077 if (data.src) { } 1067 1078 if (options.pictureDeriv == "Original" && data.src.match(RegExp("\-.." + ".jpg", "gi"))) { 1068 Autosize_resize(true, options);1079 // Autosize_resize(true, options); 1069 1080 } else if (data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) { 1070 Autosize_resize(true, options);1081 // Autosize_resize(true, options); 1071 1082 } else { 1072 1083 1073 }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 1084 } 1082 1085 … … 1084 1087 //_________ theMainImage ___________ 1085 1088 1086 1087 document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH;1088 1089 } 1089 1090 … … 1165 1166 }).mouseover(function (i) { 1166 1167 1167 }) 1168 1168 }); 1169 1169 1170 1170 Wait_pamoorama_time = function () { 1171 1171 if (nopano == true) return true; 1172 1173 1174 1175 1172 if (jQuery("#pamoorama").length) { 1176 1173 tempo = tempo + 1; … … 1448 1445 identique = Zone_image.src.match(RegExp(imgSrc, "gi")); 1449 1446 if (identique) return; 1450 href = get_href(IMg.pictureDeriv); 1451 href_path = "javascript:" + href; 1452 jQuery(".linkAutosize").attr("href", href_path); 1447 href_path = get_href(IMg.pictureDeriv); 1448 jQuery(".linkAutosize").attr("href", "javascript:" + href_path); 1453 1449 theImg = document.getElementById(theMainImage_id.replace("#", "")); 1454 1450 … … 1459 1455 } else { 1460 1456 last_id = IMg.pictureDeriv; 1461 eval(href );1462 // changeImgSrc(imgSrc, last_id, IMg.pictureMap, options.pictureSelType);1457 eval(href_path); 1458 // changeImgSrc(imgSrc.replace("./",""), last_id, IMg.pictureMap, options.pictureSelType); 1463 1459 } 1464 1460 … … 1484 1480 1485 1481 get_href = function (NewpictureDeriv) { 1482 ref = path_names[0]; 1486 1483 for (i = 0; i < path_names.length; i++) { 1487 1484 newHref = path_names[i]; … … 1491 1488 href = newHref; 1492 1489 if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") { 1493 href = href.replace("')", "','" + options.pictureSelType + "')"); 1490 ref = href.replace("')", "','" + options.pictureSelType + "')"); 1491 } else { 1492 ref = href; 1494 1493 } 1495 1494 break; … … 1497 1496 1498 1497 } 1499 return href; 1498 1499 1500 return ref; 1500 1501 }; 1501 1502 … … 1628 1629 // copyright 1629 1630 1631 if (options.slideshow) { 1632 1633 1634 } else { 1635 1636 } 1630 1637 1631 1638 … … 1651 1658 infos_the_page.margin.left = 20; //taille fleche 1652 1659 infos_the_page.margin.right = 20; 1653 } 1654 1655 1656 if (test_theme("elegant")) {1660 1661 } else if (test_theme("kardon")) { 1662 1663 } else if (test_theme("elegant")) { 1657 1664 1658 1665 if (infos_imageInfos.visible == true) { … … 1669 1676 1670 1677 } else if (test_theme("simple")) { 1671 1672 1678 infos_menubar = jQuery("#menubar").infos({ absolute: true }); 1679 infos_imageInfoBar = jQuery("#imageInfoBar").infos({ absolute: true }); 1680 1681 jQuery("#theImage").width(infos_imageInfoBar.left - infos_theImage.left - 2); 1682 marge_left += 0; 1683 marge_right += 0; 1673 1684 1674 1685 } else if (test_theme("OS")) { … … 1705 1716 if (!options.check_desc_v) 1706 1717 options.marge_bottom_2 = 0; 1718 else 1719 options.marge_bottom = 0; 1720 1707 1721 marge_bottom = options.marge_bottom_2 + options.marge_bottom; 1708 1722 //================== Limite Format Image ===================== … … 1786 1800 1787 1801 options.theImageBottom = new_win.height - new_dim.out.bottom; 1788 options.marge_top = Math.ceil(new_img.top - new_dim.top); 1802 if (options.slideshow) { 1803 1804 options.marge_top = 0; 1805 } else { 1806 options.marge_top = Math.ceil(new_img.top - new_dim.top); 1807 } 1789 1808 1790 1809 if (options.theImageBottom_2 < 0) { … … 1980 1999 sav_p = options.pictureSelType; 1981 2000 options.pictureSelType = "SelMaxi"; 1982 href = get_href(options.pictureDeriv); 1983 href_path = "javascript:" + href; 1984 2001 href_path = get_href(options.pictureDeriv); 1985 2002 spans = jQuery("#derivativeCheckedSelMaxi").next(); 1986 spans.attr("href", href_path);2003 spans.attr("href", "javascript:" + href_path); 1987 2004 spans.attr("name", "SelMaxi"); 1988 2005 spans = spans.find("span"); … … 1991 2008 //========================================================== 1992 2009 options.pictureSelType = "Autosize"; 1993 href = get_href(options.pictureDeriv); 1994 href_path = "javascript:" + href; 1995 2010 href_path = get_href(options.pictureDeriv); 1996 2011 spans = jQuery("#derivativeCheckedAutosize").next(); 1997 spans.attr("href", href_path);2012 spans.attr("href", "javascript:" + href_path); 1998 2013 spans.attr("name", "Autosize"); 1999 2014 spans = spans.find("span"); … … 2002 2017 //========================================================== 2003 2018 options.pictureSelType = sav_p; 2004 2019 jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden'); 2005 2020 if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") { 2021 jQuery('#derivativeChecked' + options.pictureSelType).css('visibility', 'visible'); 2006 2022 spans = jQuery("#derivativeChecked" + options.pictureSelType).next(); 2007 2023 spans.addClass("linkAutosize"); 2008 2024 spans.find("span").addClass("auto_details"); 2025 } else { 2026 jQuery('#derivativeChecked' + options.pictureDeriv).css('visibility', 'visible'); 2009 2027 } 2010 2028 pictureDeriv = options.pictureDeriv; 2011 2029 Autosize_resize(true, options); 2012 2030 Autosize_resize(true, options); 2013 2031 jQuery("#" + Type_Img).show(options.fade_in); 2014 2032 }; 2015 2033 //_______________________ init_gen _______________________ … … 2219 2237 2220 2238 2221 }); // ready2239 }); // ready 2222 2240 2223 2241
Note: See TracChangeset
for help on using the changeset viewer.