1 | function rvas_get_scaled_size(b,a){var c=b.w/a.w,d=b.h/a.h;return 1<c||1<d?c>d?{w:a.w/a.dpr,h:Math.floor(b.h/c/a.dpr)}:{w:Math.floor(b.w/d/a.dpr),h:a.h/a.dpr}:{w:Math.round(b.w/a.dpr),h:Math.round(b.h/a.dpr)}} |
---|
2 | function rvas_get_available_size(){var b=$("#theImage").width(),a=1,c;"innerHeight"in window?(c=window.innerHeight,document.documentElement.clientWidth>window.innerWidth&&window.innerWidth&&(a=document.documentElement.clientWidth/window.innerWidth),c=Math.floor(c*a)):c=document.documentElement.offsetHeight;c-=Math.ceil($("#theImage").offset().top);var d=window.devicePixelRatio&&1<window.devicePixelRatio?window.devicePixelRatio:1,b=Math.floor(b*d);c=Math.floor(c*d);document.cookie="phavsz="+b+"x"+ |
---|
3 | c+"x"+d+";path="+RVAS.cp;return{w:b,h:c,dpr:d,zoom:a}} |
---|
4 | function rvas_choose(b){for(var a,c=rvas_get_available_size(),d=$("#theMainImage"),g=!0,f=0;f<RVAS.derivatives.length;f++){var e=RVAS.derivatives[f];if(e.w>c.w*c.zoom||e.h>c.h*c.zoom){if(1<c.dpr||!a)a=e;break}else a=e}if(a){if(1<c.dpr){f=rvas_get_scaled_size(a,c);if(d.attr("width")&&1==c.zoom&&(e=f.h/d.height(),b=b?1.25:1.15,1<=e&&e<b||1>e&&e>1/b&&d.width()<c.w/c.dpr))return;!d.data("natural-w")||d.data("natural-w")<a.w?d.attr("width",f.w).attr("height",f.h).attr("src",a.url).removeAttr("usemap").data("natural-w", |
---|
5 | a.w):(d.attr("width",f.w).attr("height",f.h),g=!1)}else{if(d.attr("width")&&(e=a.h/d.height(),b=b?2:1.15,1<=e&&e<b||1>e&&e>1/b&&d.width()<c.w))return;d.attr("width",a.w).attr("height",a.h).attr("src",a.url).attr("usemap","#map"+a.type)}g&&($("#derivativeSwitchBox .switchCheck").css("visibility","hidden"),$("#derivativeChecked"+a.type).css("visibility","visible"))}} |
---|
6 | $(document).ready(function(){window.changeImgSrc&&(RVAS.changeImgSrcOrig=changeImgSrc,changeImgSrc=function(){RVAS.disable=1;RVAS.changeImgSrcOrig.apply(void 0,arguments)});$(window).resize(function(){var b=$("body").width(),a=$(document.documentElement);-1==document.location.search.indexOf("slideshow")&&(1262>b?a.removeClass("wide"):a.addClass("wide"));RVAS.disable?rvas_get_available_size():rvas_choose()});$("#theMainImage").click(function(b){if(!$(this).attr("usemap")&&b.clientY){var a=(b.pageX- |
---|
7 | $(this).offset().left)/$(this).width();b=b.pageY-$(this).offset().top;0.3>a?$("#linkPrev").length&&15<b&&(window.location=$("#linkPrev").attr("href")):0.7<a?$("#linkNext").length&&15<b&&(window.location=$("#linkNext").attr("href")):0.5>b/$(this).height()&&15<b&&(a=$(".pwg-icon-arrow-n").parent("a").attr("href"))&&(window.location=a)}})}); |
---|