Changeset 870110
- Timestamp:
- 03/05/2014 04:42:43 PM (11 years ago)
- Location:
- really-simple-popup/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified really-simple-popup/trunk/js/hs_rsp_popup.js ¶
r791672 r870110 20 20 var hsRspMaxModalWidth = 90; //percentage 21 21 var hsRspMaxModalHeight = 90; //percentage 22 23 var hsRspSetWidth = null; 24 var hsRspSetHeight = null; 22 25 23 26 //Other settings … … 26 29 var hsRspImgGallery = []; //To hold all the popup images in the page 27 30 var hsRspIsPopupOpen = false; //Is the popup currently open? 31 var hsRspDisableResizeOnWindowChange = false; //When the window is resized, should popup scale? 32 33 28 34 29 35 … … 63 69 //Function will load an image into the popup div 64 70 function hsRspLoadImage(imgurl, title){ 71 hsRspDisableResizeOnWindowChange = false; 72 65 73 //If image exists, remove before loading in the new one 66 74 if(jQuery('#hs-rs-big-img').length == 1){ … … 127 135 //Function will load an image into the popup div 128 136 function hsRspLoadFixedImage(imgurl, title, height, width){ 137 hsRspDisableResizeOnWindowChange = true; 138 139 hsRspSetWidth = width; 140 hsRspSetHeight = height; 141 129 142 //If image exists, remove before loading in the new one 130 143 if(jQuery('#hs-rs-big-img').length == 1){ … … 193 206 194 207 function hsRspLoadIframe(iframurl, title){ 208 hsRspDisableResizeOnWindowChange = false; 195 209 jQuery('#hs-rsp-image-wrap').append('<iframe frameborder="0" id="hs-rsp-iframe" src="' + iframurl + '" name="hs-rsp-iframe" vspace="0" hspace="0" allowtransparency="true"></iframe>'); 196 210 if(title !== undefined && title !== '' && jQuery('#hs-rsp-image-wrap .popup-title').length == 0) jQuery('#hs-rsp-image-wrap').append('<p class="popup-title">' + title + '</p>'); … … 212 226 213 227 function hsRspLoadIframeFixedWidth(iframurl, title, height, width){ 228 hsRspDisableResizeOnWindowChange = true; 229 230 hsRspSetWidth = width; 231 hsRspSetHeight = height; 232 214 233 jQuery('#hs-rsp-image-wrap').append('<iframe frameborder="0" id="hs-rsp-iframe" src="' + iframurl + '" name="hs-rsp-iframe" vspace="0" hspace="0" allowtransparency="true"></iframe>'); 215 234 if(title !== undefined && title !== '' && jQuery('#hs-rsp-image-wrap .popup-title').length == 0) jQuery('#hs-rsp-image-wrap').append('<p class="popup-title">' + title + '</p>'); … … 228 247 229 248 function hsRspLoadDiv(linktarget, title){ 249 hsRspDisableResizeOnWindowChange = false; 250 230 251 //If link target starts with a #hash assume its an id to another element 231 252 if(/\#.*/.test(linktarget)){ … … 253 274 //hsRspLoadFixedWidthDiv(jQuery(this).attr('href'), divTitle, jQuery(this).attr('popupheight'), jQuery(this).attr('popupheight')); 254 275 function hsRspLoadFixedWidthDiv(linktarget, title, height, width){ 276 hsRspDisableResizeOnWindowChange = true; 277 278 hsRspSetWidth = width; 279 hsRspSetHeight = height; 280 255 281 //If link target starts with a #hash assume its an id to another element 256 282 if(/\#.*/.test(linktarget)){ … … 349 375 //Scan the page for images and add the .hs-rsp-popup to all supported ones 350 376 function _hsRspSetupThumbnails(){ 351 var thumbnails = jQuery("a:has(img)").not(".nolightbox").filter( function() { 352 return /\.(jpe?g|png|gif|bmp)$/i.test(jQuery(this).attr('href')); 377 var thumbnails = jQuery("a:has(img)").not(".no-hsrsp-popup").filter( function() { 378 if(jQuery(this).find('img.no-hsrsp-popup').length == 1){ 379 return false; 380 }else{ 381 return /\.(jpe?g|png|gif|bmp)$/i.test(jQuery(this).attr('href')); 382 } 353 383 }); 354 384 … … 541 571 switch(hsRspCurrentType){ 542 572 case 'image': 543 var img = _hsRspScalePopup(jQuery('#hs-rs-big-img'), hsRspMinImgWidth, hsRspMinImgHeight, hsRspOrigImgWidth, hsRspOrigImgHeight); 573 574 575 576 if(hsRspDisableResizeOnWindowChange){ 577 var img = {"iwidth": hsRspSetWidth, "iheight": hsRspSetHeight}; 578 }else{ 579 var img = _hsRspScalePopup(jQuery('#hs-rs-big-img'), hsRspMinImgWidth, hsRspMinImgHeight, hsRspOrigImgWidth, hsRspOrigImgHeight); 580 } 544 581 545 582 //Resize and reposition image … … 565 602 break; 566 603 case 'iframe': 567 var img = _hsRspScalePopup(jQuery('#hs-rsp-iframe'), hsRspMinImgWidth, hsRspMinImgHeight, hsRspIframeWidth, hsRspIframeHeight); 604 if(hsRspDisableResizeOnWindowChange){ 605 var img = {"iwidth": hsRspSetWidth, "iheight": hsRspSetHeight}; 606 }else{ 607 var img = _hsRspScalePopup(jQuery('#hs-rsp-iframe'), hsRspMinImgWidth, hsRspMinImgHeight, hsRspIframeWidth, hsRspIframeHeight); 608 } 568 609 569 610 //Resize and reposition iframe … … 576 617 break; 577 618 case 'div': 578 var div = _hsRspScalePopup(jQuery('#hs-rsp-div'), hsRspMinImgWidth, hsRspMinImgHeight, hsRspDivWidth, hsRspDivHeight); 619 if(hsRspDisableResizeOnWindowChange){ 620 var div = {"iwidth": hsRspSetWidth, "iheight": hsRspSetHeight}; 621 }else{ 622 var div = _hsRspScalePopup(jQuery('#hs-rsp-div'), hsRspMinImgWidth, hsRspMinImgHeight, hsRspDivWidth, hsRspDivHeight); 623 } 579 624 580 625 //Resize and reposition div -
TabularUnified really-simple-popup/trunk/js/hs_rsp_popup.min.js ¶
r791672 r870110 1 var hsRspOrigImgWidth=null;var hsRspOrigImgHeight=null;var hsRspDefaultAnimation="fade";var hsRspMinImgWidth=150;var hsRspMinImgHeight=150;var hsRspIframeWidth=-1;var hsRspIframeHeight=-1;var hsRspDivWidth=-1;var hsRspDivHeight=-1;var hsRspModalMarginTop=90;var hsRspMaxModalWidth=90;var hsRspMaxModalHeight=90;var hsRsp ResizeTimer;var hsRspCurrentType=null;var hsRspImgGallery=[];var hsRspIsPopupOpen=false;jQuery(document).ready(function(){if(jQuery("#hs-rsp-popup-bg").length==0){_hsRspSetupThumbnails();_hsRspSetupGallery();_hsRspSetupEventHandlers();}});function hsRspShowLoader(){_hsRspSetupPopup();jQuery("#hs-rsp-image-wrap").css("visibility","hidden");if(jQuery("#hs-rsp-image-wrap p").length==1){jQuery("#hs-rsp-image-wrap p").remove();}if(jQuery("#hs-rsp-image-loader").length==0){jQuery("#hs-rsp-popup-bg").append('<div id="hs-rsp-image-loader"></div>');}jQuery("#hs-rsp-image-loader").css({left:_hsRspCalcLeftMargin(32),top:_hsRspCalcTopMargin(32)});}function hsRspCloseLoader(){if(jQuery("#hs-rsp-image-loader").length==1){jQuery("#hs-rsp-image-loader").remove();}}function hsRspLoadImage(a,b){if(jQuery("#hs-rs-big-img").length==1){jQuery("#hs-rs-big-img").remove();}if(b!==undefined&&b!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="'+a+'" alt="'+a+'"/>');jQuery("#hs-rsp-image-wrap img").load(function(){jQuery(this).after('<p class="popup-title pimage">'+b+"</p>");});}else{jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="'+a+'" alt="'+a+'"/>');}jQuery("#hs-rs-big-img").load(function(){hsRspOrigImgWidth=jQuery("#hs-rs-big-img").width();hsRspOrigImgHeight=jQuery("#hs-rs-big-img").height();var c={};c=_hsRspScalePopup(jQuery("#hs-rs-big-img"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspOrigImgWidth,hsRspOrigImgHeight);if(hsRspImgGallery.length>1){if(jQuery("#hsrsp-leftarrow").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-leftarrow" href="#hsrsp-left">Previous</a>');jQuery("#hsrsp-leftarrow").click(function(d){d.preventDefault();_hsRspPreviousImg();});}if(jQuery("#hsrsp-rightarrow").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-rightarrow" href="#hsrsp-right">Next</a>');jQuery("#hsrsp-rightarrow").click(function(d){d.preventDefault();_hsRspNextImg();});}jQuery("#hsrsp-leftarrow").css({top:parseInt((c.iheight/2)-((64-10)/2)),left:10});jQuery("#hsrsp-rightarrow").css({top:parseInt((c.iheight/2)-((64-10)/2)),left:parseInt((c.iwidth)-54)});}_hsRspShowPopup(c.iwidth,c.iheight);});}function hsRspLoadFixedImage(b,d,a,c){if(jQuery("#hs-rs-big-img").length==1){jQuery("#hs-rs-big-img").remove();}if(d!==undefined&&d!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="'+b+'" alt="'+b+'"/>');jQuery("#hs-rsp-image-wrap img").load(function(){jQuery(this).after('<p class="popup-title pimagef">'+d+"</p>");});}else{jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="'+b+'" alt="'+b+'"/>');}jQuery("#hs-rs-big-img").load(function(){hsRspOrigImgWidth=jQuery("#hs-rs-big-img").width();hsRspOrigImgHeight=jQuery("#hs-rs-big-img").height();var e={};if(hsRspImgGallery.length>1){if(jQuery("#hsrsp-leftarrow").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-leftarrow" href="#hsrsp-left">Previous</a>');jQuery("#hsrsp-leftarrow").click(function(f){f.preventDefault();_hsRspPreviousImg();});}if(jQuery("#hsrsp-rightarrow").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-rightarrow" href="#hsrsp-right">Next</a>');jQuery("#hsrsp-rightarrow").click(function(f){f.preventDefault();_hsRspNextImg();});}jQuery("#hsrsp-leftarrow").css({top:parseInt((a/2)-((64-10)/2)),left:10});jQuery("#hsrsp-rightarrow").css({top:parseInt((a/2)-((64-10)/2)),left:parseInt((c)-54)});}_hsRspShowPopup(c,a);});}function hsRspLoadIframe(b,a){jQuery("#hs-rsp-image-wrap").append('<iframe frameborder="0" id="hs-rsp-iframe" src="'+b+'" name="hs-rsp-iframe" vspace="0" hspace="0" allowtransparency="true"></iframe>');if(a!==undefined&&a!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">'+a+"</p>");}var c={};c=_hsRspScalePopup(jQuery("#hs-rsp-iframe"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspIframeWidth,hsRspIframeHeight);jQuery("#hs-rsp-iframe").attr({width:c.iwidth,height:c.iheight});jQuery("#hs-rsp-iframe").load(b,function(){_hsRspShowPopup(c.iwidth,c.iheight);});}function hsRspLoadIframeFixedWidth(d,c,a,b){jQuery("#hs-rsp-image-wrap").append('<iframe frameborder="0" id="hs-rsp-iframe" src="'+d+'" name="hs-rsp-iframe" vspace="0" hspace="0" allowtransparency="true"></iframe>');if(c!==undefined&&c!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">'+c+"</p>");}jQuery("#hs-rsp-iframe").attr({width:b,height:a});jQuery("#hs-rsp-iframe").load(d,function(){_hsRspShowPopup(b,a);});}function hsRspLoadDiv(c,a){if(/\#.*/.test(c)){jQuery("#hs-rsp-image-wrap").append('<div id="hs-rsp-div">'+jQuery(c).html()+"</div>");if(a!==undefined&&a!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">'+a+"</p>");}var b={};b=_hsRspScalePopup(jQuery("#hs-rsp-div"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspDivWidth,hsRspDivHeight);jQuery("#hs-rsp-div").css({width:b.iwidth,height:b.iheight});_hsRspShowPopup(b.iwidth,b.iheight);}else{this.hsRspCurrentType="iframe";hsRspLoadIframe(c,a);}}function hsRspLoadFixedWidthDiv(d,c,a,b){if(/\#.*/.test(d)){jQuery("#hs-rsp-image-wrap").append('<div id="hs-rsp-div">'+jQuery(d).html()+"</div>");if(c!==undefined&&c!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">'+c+"</p>");}_hsRspShowPopup(b,a);}else{this.hsRspCurrentType="iframe";hsRspLoadIframeFixedWidth(d,c,a,b);}}function hsRspClosePopup(){if(jQuery("#hs-rsp-popup-bg").length==1){jQuery("#hs-rsp-popup-bg").fadeOut("fast",function(){jQuery(this).remove();});hsRspCurrentType=null;hsRspOrigImgWidth=null;hsRspOrigImgHeight=null;hsRspIsPopupOpen=false;}}function _hsRspSetupPopup(){if(jQuery("#hs-rsp-popup-bg").length==0){jQuery("body").append('<div id="hs-rsp-popup-bg"></div>');}if(jQuery("#hs-rsp-image-wrap").length==0){jQuery("#hs-rsp-popup-bg").append('<div id="hs-rsp-image-wrap"></div>');}if(jQuery("#hs-rsp-close").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hs-rsp-close" href="#hs-rsp-close" title="click to close">Close</a>');}}function _hsRspShowPopup(b,a){if(jQuery("#hs-rsp-image-wrap").length==1){jQuery("#hs-rsp-image-wrap").css({left:_hsRspCalcLeftMargin(b)+"px"});jQuery("#hs-rsp-image-wrap img").prop({width:b,height:a});if(hsRspIsPopupOpen){jQuery("#hs-rsp-image-wrap").css({marginTop:hsRspModalMarginTop});}else{jQuery("#hs-rsp-image-wrap").css({marginTop:((a+60)*-1)});}hsRspCloseLoader();if(hsRspDefaultAnimation=="slide-down"){jQuery("#hs-rsp-image-wrap").fadeIn(100,function(){jQuery("#hs-rsp-image-wrap").css("visibility","visible");if(!hsRspIsPopupOpen){jQuery("#hs-rsp-image-wrap").animate({marginTop:hsRspModalMarginTop},200);}hsRspIsPopupOpen=true;});}else{jQuery("#hs-rsp-image-wrap").css({display:"none",visibility:"visible",marginTop:hsRspModalMarginTop}).fadeIn(200,function(){hsRspIsPopupOpen=true;});}}}function _hsRspSetupThumbnails(){var a=jQuery("a:has(img)").not(".nolightbox").filter(function(){return/\.(jpe?g|png|gif|bmp)$/i.test(jQuery(this).attr("href"));});a.addClass("hs-rsp-popup");}function _hsRspSetupGallery(){hsRspImgGallery=jQuery(".hs-rsp-popup").not(".iframe, .hiddendiv");}function _hsRspSetupEventHandlers(){jQuery(window).resize(function(){if(jQuery("#hs-rsp-image-wrap").length==1){clearTimeout(hsRspResizeTimer);hsRspResizeTimer=setTimeout(_hsRspAnimateResize,100);}});jQuery(".hs-rsp-popup").click(function(d){d.preventDefault();if(jQuery(this).hasClass("iframe")){hsRspCurrentType="iframe";hsRspShowLoader();var a=jQuery(this).attr("title");if(jQuery(this).attr("data-popupheight")!==undefined&&jQuery(this).attr("data-popupheight")!==undefined){hsRspLoadIframeFixedWidth(jQuery(this).attr("href"),a,jQuery(this).attr("data-popupheight"),jQuery(this).attr("data-popupwidth"));}else{hsRspLoadIframe(jQuery(this).attr("href"),a);}}else{if(jQuery(this).hasClass("hiddendiv")){hsRspCurrentType="div";hsRspShowLoader();var b=jQuery(this).attr("title");if(jQuery(this).attr("data-popupheight")!==undefined&&jQuery(this).attr("data-popupheight")!==undefined){hsRspLoadFixedWidthDiv(jQuery(this).attr("href"),b,jQuery(this).attr("data-popupheight"),jQuery(this).attr("data-popupwidth"));}else{hsRspLoadDiv(jQuery(this).attr("href"),b);}}else{hsRspCurrentType="image";hsRspShowLoader();var c=jQuery(this).find("img").attr("alt");hsRspLoadImage(jQuery(this).attr("href"),c);if(jQuery(this).attr("data-popupheight")!==undefined&&jQuery(this).attr("data-popupheight")!==undefined){hsRspLoadFixedImage(jQuery(this).attr("href"),c,jQuery(this).attr("data-popupheight"),jQuery(this).attr("data-popupwidth"));}else{hsRspLoadImage(jQuery(this).attr("href"),c);}}}});jQuery("body").on("click","#hs-rsp-popup-bg, #hs-rsp-image-wrap",function(a){if(a.srcElement==a.currentTarget){a.preventDefault();hsRspClosePopup();}});jQuery("body").on("click","#hs-rsp-close",function(a){a.preventDefault();hsRspClosePopup();});jQuery(document).keyup(function(b){if(b.which==37||b.which==39){var a=jQuery("#hs-rs-big-img");if(hsRspImgGallery.length>1&&b.which==37&&a.length==1){_hsRspPreviousImg();}if(hsRspImgGallery.length>1&&b.which==39&&a.length==1){_hsRspNextImg();}}if(b.which==27){hsRspClosePopup();}});}function _hsRspPreviousImg(){var a=jQuery("#hs-rs-big-img");var d=-1;var e=-1;var f=null;var b=null;for(var c=0;c<hsRspImgGallery.length;c++){if(jQuery(hsRspImgGallery[c]).attr("href")==a.attr("src")){d=c;}}if(d==0){e=hsRspImgGallery.length-1;}else{if(d>0){e=--d;}}f=jQuery(hsRspImgGallery[e]).attr("href");jQuery("#hs-rsp-image-wrap").fadeOut("fast",function(){jQuery(this).css({visibility:"hidden",display:"block"});hsRspShowLoader();b=jQuery('a[href="'+f+'"]');if(jQuery(b).attr("data-popupheight")!==undefined&&jQuery(b).attr("data-popupheight")!==undefined){hsRspLoadFixedImage(f,jQuery(b).find("img").attr("alt"),jQuery(b).attr("data-popupheight"),jQuery(b).attr("data-popupwidth"));}else{hsRspLoadImage(f,jQuery(b).find("img").attr("alt"));}});}function _hsRspNextImg(){var a=jQuery("#hs-rs-big-img");var c=-1;var d=-1;var e=null;var f=null;for(var b=0;b<hsRspImgGallery.length;b++){if(jQuery(hsRspImgGallery[b]).attr("href")==a.attr("src")){c=b;}}if(c==hsRspImgGallery.length-1){d=0;}else{if(c<hsRspImgGallery.length-1){d=++c;}}e=jQuery(hsRspImgGallery[d]).attr("href");jQuery("#hs-rsp-image-wrap").fadeOut("fast",function(){jQuery(this).css({visibility:"hidden",display:"block"});hsRspShowLoader();f=jQuery('a[href="'+e+'"]');if(jQuery(f).attr("data-popupheight")!==undefined&&jQuery(f).attr("data-popupheight")!==undefined){hsRspLoadFixedImage(e,jQuery(f).find("img").attr("alt"),jQuery(f).attr("data-popupheight"),jQuery(f).attr("data-popupwidth"));}else{hsRspLoadImage(e,jQuery(f).find("img").attr("alt"));}});}function _hsRspAnimateResize(){switch(hsRspCurrentType){case"image":var a=_hsRspScalePopup(jQuery("#hs-rs-big-img"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspOrigImgWidth,hsRspOrigImgHeight);jQuery("#hs-rs-big-img").animate({width:a.iwidth,height:a.iheight},100,function(){jQuery("#hs-rsp-image-wrap").animate({left:_hsRspCalcLeftMargin(jQuery(this).width())},50,function(){if(jQuery("#hsrsp-leftarrow").length==1){jQuery("#hsrsp-leftarrow").css({top:parseInt((a.iheight/2)-((64-10)/2)),left:10});}if(jQuery("#hsrsp-rightarrow").length==1){jQuery("#hsrsp-rightarrow").css({top:parseInt((a.iheight/2)-((64-10)/2)),left:parseInt((a.iwidth)-54)});}});});break;case"iframe":var a=_hsRspScalePopup(jQuery("#hs-rsp-iframe"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspIframeWidth,hsRspIframeHeight);jQuery("#hs-rsp-iframe").animate({width:a.iwidth,height:a.iheight},100,function(){jQuery("#hs-rsp-image-wrap").animate({left:_hsRspCalcLeftMargin(jQuery(this).width())},50,function(){});});break;case"div":var b=_hsRspScalePopup(jQuery("#hs-rsp-div"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspDivWidth,hsRspDivHeight);jQuery("#hs-rsp-div").animate({width:b.iwidth,height:b.iheight},100,function(){jQuery("#hs-rsp-image-wrap").animate({left:_hsRspCalcLeftMargin(jQuery(this).width())},50,function(){});});break;}}function _hsRspCalcLeftMargin(a){var c=parseInt(parseInt(jQuery(window).width())/2);var b=parseInt(c-(a/2));return b;}function _hsRspCalcTopMargin(a){var c=parseInt(parseInt(jQuery(window).height())/2);var b=parseInt(c-(a/2));return b;}function _hsRspScalePopup(f,d,l,n,c){var i,i=0;var e,j=0;var k,g=0;var h,a=0;var m=0;k=jQuery(window).width();g=jQuery(window).height();i=f.width();popupHeight=f.height();e=parseInt(k*(hsRspMaxModalWidth/100));j=parseInt((g-hsRspModalMarginTop)*(hsRspMaxModalHeight/100));if(n==-1&&c==-1){a=j;h=e;}else{if(i>e||popupHeight>j){if(popupHeight>i||popupHeight>j){a=j;if(a<hsRspMinImgHeight){a=hsRspMinImgHeight;}m=parseFloat(a/popupHeight);h=parseFloat(m*i);h=parseInt(Math.ceil(h));}else{h=e;if(a<hsRspMinImgWidth){a=hsRspMinImgWidth;}m=parseFloat(h/i);a=parseFloat(m*popupHeight);a=parseInt(Math.ceil(a));}}else{if(c!=null||n!=null){if(popupHeight>i&&popupHeight<j){a=j;if(a>c){a=c;}m=parseFloat(a/popupHeight);h=parseFloat(m*i);h=parseInt(Math.ceil(h));}else{h=e;if(h>n){h=n;}m=parseFloat(h/i);a=parseFloat(m*popupHeight);a=parseInt(Math.ceil(a));}}else{h=i;a=popupHeight;}}}if(jQuery(f).attr("id")=="hs-rsp-div"){console.log("hdiv");h=f.width();a=f.height();if(i>e||popupHeight>j){if(popupHeight>i||popupHeight>j){a=j;if(a<j){a=j;}m=parseFloat(a/popupHeight);h=parseFloat(m*i);h=parseInt(Math.ceil(h));}else{h=e;if(f.height()<j){a=j;}else{m=parseFloat(h/i);a=parseFloat(m*popupHeight);a=parseInt(Math.ceil(a));}f.css("overflow","scroll");}}}var b={};b.iwidth=h;b.iheight=a;return b;}1 var hsRspOrigImgWidth=null;var hsRspOrigImgHeight=null;var hsRspDefaultAnimation="fade";var hsRspMinImgWidth=150;var hsRspMinImgHeight=150;var hsRspIframeWidth=-1;var hsRspIframeHeight=-1;var hsRspDivWidth=-1;var hsRspDivHeight=-1;var hsRspModalMarginTop=90;var hsRspMaxModalWidth=90;var hsRspMaxModalHeight=90;var hsRspSetWidth=null;var hsRspSetHeight=null;var hsRspResizeTimer;var hsRspCurrentType=null;var hsRspImgGallery=[];var hsRspIsPopupOpen=false;var hsRspDisableResizeOnWindowChange=false;jQuery(document).ready(function(){if(jQuery("#hs-rsp-popup-bg").length==0){_hsRspSetupThumbnails();_hsRspSetupGallery();_hsRspSetupEventHandlers()}});function hsRspShowLoader(){_hsRspSetupPopup();jQuery("#hs-rsp-image-wrap").css("visibility","hidden");if(jQuery("#hs-rsp-image-wrap p").length==1){jQuery("#hs-rsp-image-wrap p").remove()}if(jQuery("#hs-rsp-image-loader").length==0){jQuery("#hs-rsp-popup-bg").append('<div id="hs-rsp-image-loader"></div>')}jQuery("#hs-rsp-image-loader").css({left:_hsRspCalcLeftMargin(32),top:_hsRspCalcTopMargin(32)})}function hsRspCloseLoader(){if(jQuery("#hs-rsp-image-loader").length==1){jQuery("#hs-rsp-image-loader").remove()}}function hsRspLoadImage(a,b){hsRspDisableResizeOnWindowChange=false;if(jQuery("#hs-rs-big-img").length==1){jQuery("#hs-rs-big-img").remove()}if(b!==undefined&&b!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="'+a+'" alt="'+a+'"/>');jQuery("#hs-rsp-image-wrap img").load(function(){jQuery(this).after('<p class="popup-title pimage">'+b+"</p>")})}else{jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="'+a+'" alt="'+a+'"/>')}jQuery("#hs-rs-big-img").load(function(){hsRspOrigImgWidth=jQuery("#hs-rs-big-img").width();hsRspOrigImgHeight=jQuery("#hs-rs-big-img").height();var c={};c=_hsRspScalePopup(jQuery("#hs-rs-big-img"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspOrigImgWidth,hsRspOrigImgHeight);if(hsRspImgGallery.length>1){if(jQuery("#hsrsp-leftarrow").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-leftarrow" href="#hsrsp-left">Previous</a>');jQuery("#hsrsp-leftarrow").click(function(d){d.preventDefault();_hsRspPreviousImg()})}if(jQuery("#hsrsp-rightarrow").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-rightarrow" href="#hsrsp-right">Next</a>');jQuery("#hsrsp-rightarrow").click(function(d){d.preventDefault();_hsRspNextImg()})}jQuery("#hsrsp-leftarrow").css({top:parseInt((c.iheight/2)-((64-10)/2)),left:10});jQuery("#hsrsp-rightarrow").css({top:parseInt((c.iheight/2)-((64-10)/2)),left:parseInt((c.iwidth)-54)})}_hsRspShowPopup(c.iwidth,c.iheight)})}function hsRspLoadFixedImage(b,d,a,c){hsRspDisableResizeOnWindowChange=true;hsRspSetWidth=c;hsRspSetHeight=a;if(jQuery("#hs-rs-big-img").length==1){jQuery("#hs-rs-big-img").remove()}if(d!==undefined&&d!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="'+b+'" alt="'+b+'"/>');jQuery("#hs-rsp-image-wrap img").load(function(){jQuery(this).after('<p class="popup-title pimagef">'+d+"</p>")})}else{jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="'+b+'" alt="'+b+'"/>')}jQuery("#hs-rs-big-img").load(function(){hsRspOrigImgWidth=jQuery("#hs-rs-big-img").width();hsRspOrigImgHeight=jQuery("#hs-rs-big-img").height();var e={};if(hsRspImgGallery.length>1){if(jQuery("#hsrsp-leftarrow").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-leftarrow" href="#hsrsp-left">Previous</a>');jQuery("#hsrsp-leftarrow").click(function(f){f.preventDefault();_hsRspPreviousImg()})}if(jQuery("#hsrsp-rightarrow").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-rightarrow" href="#hsrsp-right">Next</a>');jQuery("#hsrsp-rightarrow").click(function(f){f.preventDefault();_hsRspNextImg()})}jQuery("#hsrsp-leftarrow").css({top:parseInt((a/2)-((64-10)/2)),left:10});jQuery("#hsrsp-rightarrow").css({top:parseInt((a/2)-((64-10)/2)),left:parseInt((c)-54)})}_hsRspShowPopup(c,a)})}function hsRspLoadIframe(b,a){hsRspDisableResizeOnWindowChange=false;jQuery("#hs-rsp-image-wrap").append('<iframe frameborder="0" id="hs-rsp-iframe" src="'+b+'" name="hs-rsp-iframe" vspace="0" hspace="0" allowtransparency="true"></iframe>');if(a!==undefined&&a!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">'+a+"</p>")}var c={};c=_hsRspScalePopup(jQuery("#hs-rsp-iframe"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspIframeWidth,hsRspIframeHeight);jQuery("#hs-rsp-iframe").attr({width:c.iwidth,height:c.iheight});jQuery("#hs-rsp-iframe").load(b,function(){_hsRspShowPopup(c.iwidth,c.iheight)})}function hsRspLoadIframeFixedWidth(d,c,a,b){hsRspDisableResizeOnWindowChange=true;hsRspSetWidth=b;hsRspSetHeight=a;jQuery("#hs-rsp-image-wrap").append('<iframe frameborder="0" id="hs-rsp-iframe" src="'+d+'" name="hs-rsp-iframe" vspace="0" hspace="0" allowtransparency="true"></iframe>');if(c!==undefined&&c!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">'+c+"</p>")}jQuery("#hs-rsp-iframe").attr({width:b,height:a});jQuery("#hs-rsp-iframe").load(d,function(){_hsRspShowPopup(b,a)})}function hsRspLoadDiv(c,a){hsRspDisableResizeOnWindowChange=false;if(/\#.*/.test(c)){jQuery("#hs-rsp-image-wrap").append('<div id="hs-rsp-div">'+jQuery(c).html()+"</div>");if(a!==undefined&&a!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">'+a+"</p>")}var b={};b=_hsRspScalePopup(jQuery("#hs-rsp-div"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspDivWidth,hsRspDivHeight);jQuery("#hs-rsp-div").css({width:b.iwidth,height:b.iheight});_hsRspShowPopup(b.iwidth,b.iheight)}else{this.hsRspCurrentType="iframe";hsRspLoadIframe(c,a)}}function hsRspLoadFixedWidthDiv(d,c,a,b){hsRspDisableResizeOnWindowChange=true;hsRspSetWidth=b;hsRspSetHeight=a;if(/\#.*/.test(d)){jQuery("#hs-rsp-image-wrap").append('<div id="hs-rsp-div">'+jQuery(d).html()+"</div>");if(c!==undefined&&c!==""&&jQuery("#hs-rsp-image-wrap .popup-title").length==0){jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">'+c+"</p>")}_hsRspShowPopup(b,a)}else{this.hsRspCurrentType="iframe";hsRspLoadIframeFixedWidth(d,c,a,b)}}function hsRspClosePopup(){if(jQuery("#hs-rsp-popup-bg").length==1){jQuery("#hs-rsp-popup-bg").fadeOut("fast",function(){jQuery(this).remove()});hsRspCurrentType=null;hsRspOrigImgWidth=null;hsRspOrigImgHeight=null;hsRspIsPopupOpen=false}}function _hsRspSetupPopup(){if(jQuery("#hs-rsp-popup-bg").length==0){jQuery("body").append('<div id="hs-rsp-popup-bg"></div>')}if(jQuery("#hs-rsp-image-wrap").length==0){jQuery("#hs-rsp-popup-bg").append('<div id="hs-rsp-image-wrap"></div>')}if(jQuery("#hs-rsp-close").length==0){jQuery("#hs-rsp-image-wrap").append('<a id="hs-rsp-close" href="#hs-rsp-close" title="click to close">Close</a>')}}function _hsRspShowPopup(b,a){if(jQuery("#hs-rsp-image-wrap").length==1){jQuery("#hs-rsp-image-wrap").css({left:_hsRspCalcLeftMargin(b)+"px"});jQuery("#hs-rsp-image-wrap img").prop({width:b,height:a});if(hsRspIsPopupOpen){jQuery("#hs-rsp-image-wrap").css({marginTop:hsRspModalMarginTop})}else{jQuery("#hs-rsp-image-wrap").css({marginTop:((a+60)*-1)})}hsRspCloseLoader();if(hsRspDefaultAnimation=="slide-down"){jQuery("#hs-rsp-image-wrap").fadeIn(100,function(){jQuery("#hs-rsp-image-wrap").css("visibility","visible");if(!hsRspIsPopupOpen){jQuery("#hs-rsp-image-wrap").animate({marginTop:hsRspModalMarginTop},200)}hsRspIsPopupOpen=true})}else{jQuery("#hs-rsp-image-wrap").css({"display":"none","visibility":"visible","marginTop":hsRspModalMarginTop}).fadeIn(200,function(){hsRspIsPopupOpen=true})}}}function _hsRspSetupThumbnails(){var a=jQuery("a:has(img)").not(".no-hsrsp-popup").filter(function(){if(jQuery(this).find("img.no-hsrsp-popup").length==1){return false}else{return/\.(jpe?g|png|gif|bmp)$/i.test(jQuery(this).attr("href"))}});a.addClass("hs-rsp-popup")}function _hsRspSetupGallery(){hsRspImgGallery=jQuery(".hs-rsp-popup").not(".iframe, .hiddendiv")}function _hsRspSetupEventHandlers(){jQuery(window).resize(function(){if(jQuery("#hs-rsp-image-wrap").length==1){clearTimeout(hsRspResizeTimer);hsRspResizeTimer=setTimeout(_hsRspAnimateResize,100)}});jQuery(".hs-rsp-popup").click(function(d){d.preventDefault();if(jQuery(this).hasClass("iframe")){hsRspCurrentType="iframe";hsRspShowLoader();var a=jQuery(this).attr("title");if(jQuery(this).attr("data-popupheight")!==undefined&&jQuery(this).attr("data-popupheight")!==undefined){hsRspLoadIframeFixedWidth(jQuery(this).attr("href"),a,jQuery(this).attr("data-popupheight"),jQuery(this).attr("data-popupwidth"))}else{hsRspLoadIframe(jQuery(this).attr("href"),a)}}else{if(jQuery(this).hasClass("hiddendiv")){hsRspCurrentType="div";hsRspShowLoader();var b=jQuery(this).attr("title");if(jQuery(this).attr("data-popupheight")!==undefined&&jQuery(this).attr("data-popupheight")!==undefined){hsRspLoadFixedWidthDiv(jQuery(this).attr("href"),b,jQuery(this).attr("data-popupheight"),jQuery(this).attr("data-popupwidth"))}else{hsRspLoadDiv(jQuery(this).attr("href"),b)}}else{hsRspCurrentType="image";hsRspShowLoader();var c=jQuery(this).find("img").attr("alt");hsRspLoadImage(jQuery(this).attr("href"),c);if(jQuery(this).attr("data-popupheight")!==undefined&&jQuery(this).attr("data-popupheight")!==undefined){hsRspLoadFixedImage(jQuery(this).attr("href"),c,jQuery(this).attr("data-popupheight"),jQuery(this).attr("data-popupwidth"))}else{hsRspLoadImage(jQuery(this).attr("href"),c)}}}});jQuery("body").on("click","#hs-rsp-popup-bg, #hs-rsp-image-wrap",function(a){if(a.srcElement==a.currentTarget){a.preventDefault();hsRspClosePopup()}});jQuery("body").on("click","#hs-rsp-close",function(a){a.preventDefault();hsRspClosePopup()});jQuery(document).keyup(function(b){if(b.which==37||b.which==39){var a=jQuery("#hs-rs-big-img");if(hsRspImgGallery.length>1&&b.which==37&&a.length==1){_hsRspPreviousImg()}if(hsRspImgGallery.length>1&&b.which==39&&a.length==1){_hsRspNextImg()}}if(b.which==27){hsRspClosePopup()}})}function _hsRspPreviousImg(){var a=jQuery("#hs-rs-big-img");var d=-1;var e=-1;var f=null;var b=null;for(var c=0;c<hsRspImgGallery.length;c++){if(jQuery(hsRspImgGallery[c]).attr("href")==a.attr("src")){d=c}}if(d==0){e=hsRspImgGallery.length-1}else{if(d>0){e=--d}}f=jQuery(hsRspImgGallery[e]).attr("href");jQuery("#hs-rsp-image-wrap").fadeOut("fast",function(){jQuery(this).css({visibility:"hidden",display:"block"});hsRspShowLoader();b=jQuery('a[href="'+f+'"]');if(jQuery(b).attr("data-popupheight")!==undefined&&jQuery(b).attr("data-popupheight")!==undefined){hsRspLoadFixedImage(f,jQuery(b).find("img").attr("alt"),jQuery(b).attr("data-popupheight"),jQuery(b).attr("data-popupwidth"))}else{hsRspLoadImage(f,jQuery(b).find("img").attr("alt"))}})}function _hsRspNextImg(){var a=jQuery("#hs-rs-big-img");var c=-1;var d=-1;var e=null;var f=null;for(var b=0;b<hsRspImgGallery.length;b++){if(jQuery(hsRspImgGallery[b]).attr("href")==a.attr("src")){c=b}}if(c==hsRspImgGallery.length-1){d=0}else{if(c<hsRspImgGallery.length-1){d=++c}}e=jQuery(hsRspImgGallery[d]).attr("href");jQuery("#hs-rsp-image-wrap").fadeOut("fast",function(){jQuery(this).css({visibility:"hidden",display:"block"});hsRspShowLoader();f=jQuery('a[href="'+e+'"]');if(jQuery(f).attr("data-popupheight")!==undefined&&jQuery(f).attr("data-popupheight")!==undefined){hsRspLoadFixedImage(e,jQuery(f).find("img").attr("alt"),jQuery(f).attr("data-popupheight"),jQuery(f).attr("data-popupwidth"))}else{hsRspLoadImage(e,jQuery(f).find("img").attr("alt"))}})}function _hsRspAnimateResize(){switch(hsRspCurrentType){case"image":if(hsRspDisableResizeOnWindowChange){var a={"iwidth":hsRspSetWidth,"iheight":hsRspSetHeight}}else{var a=_hsRspScalePopup(jQuery("#hs-rs-big-img"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspOrigImgWidth,hsRspOrigImgHeight)}jQuery("#hs-rs-big-img").animate({width:a.iwidth,height:a.iheight},100,function(){jQuery("#hs-rsp-image-wrap").animate({left:_hsRspCalcLeftMargin(jQuery(this).width())},50,function(){if(jQuery("#hsrsp-leftarrow").length==1){jQuery("#hsrsp-leftarrow").css({top:parseInt((a.iheight/2)-((64-10)/2)),left:10})}if(jQuery("#hsrsp-rightarrow").length==1){jQuery("#hsrsp-rightarrow").css({top:parseInt((a.iheight/2)-((64-10)/2)),left:parseInt((a.iwidth)-54)})}})});break;case"iframe":if(hsRspDisableResizeOnWindowChange){var a={"iwidth":hsRspSetWidth,"iheight":hsRspSetHeight}}else{var a=_hsRspScalePopup(jQuery("#hs-rsp-iframe"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspIframeWidth,hsRspIframeHeight)}jQuery("#hs-rsp-iframe").animate({width:a.iwidth,height:a.iheight},100,function(){jQuery("#hs-rsp-image-wrap").animate({left:_hsRspCalcLeftMargin(jQuery(this).width())},50,function(){})});break;case"div":if(hsRspDisableResizeOnWindowChange){var b={"iwidth":hsRspSetWidth,"iheight":hsRspSetHeight}}else{var b=_hsRspScalePopup(jQuery("#hs-rsp-div"),hsRspMinImgWidth,hsRspMinImgHeight,hsRspDivWidth,hsRspDivHeight)}jQuery("#hs-rsp-div").animate({width:b.iwidth,height:b.iheight},100,function(){jQuery("#hs-rsp-image-wrap").animate({left:_hsRspCalcLeftMargin(jQuery(this).width())},50,function(){})});break}}function _hsRspCalcLeftMargin(a){var c=parseInt(parseInt(jQuery(window).width())/2);var b=parseInt(c-(a/2));return b}function _hsRspCalcTopMargin(a){var c=parseInt(parseInt(jQuery(window).height())/2);var b=parseInt(c-(a/2));return b}function _hsRspScalePopup(f,d,l,n,c){var i,i=0;var e,j=0;var k,g=0;var h,a=0;var m=0;k=jQuery(window).width();g=jQuery(window).height();i=f.width();popupHeight=f.height();e=parseInt(k*(hsRspMaxModalWidth/100));j=parseInt((g-hsRspModalMarginTop)*(hsRspMaxModalHeight/100));if(n==-1&&c==-1){a=j;h=e}else{if(i>e||popupHeight>j){if(popupHeight>i||popupHeight>j){a=j;if(a<hsRspMinImgHeight){a=hsRspMinImgHeight}m=parseFloat(a/popupHeight);h=parseFloat(m*i);h=parseInt(Math.ceil(h))}else{h=e;if(a<hsRspMinImgWidth){a=hsRspMinImgWidth}m=parseFloat(h/i);a=parseFloat(m*popupHeight);a=parseInt(Math.ceil(a))}}else{if(c!=null||n!=null){if(popupHeight>i&&popupHeight<j){a=j;if(a>c){a=c}m=parseFloat(a/popupHeight);h=parseFloat(m*i);h=parseInt(Math.ceil(h))}else{h=e;if(h>n){h=n}m=parseFloat(h/i);a=parseFloat(m*popupHeight);a=parseInt(Math.ceil(a))}}else{h=i;a=popupHeight}}}if(jQuery(f).attr("id")=="hs-rsp-div"){console.log("hdiv");h=f.width();a=f.height();if(i>e||popupHeight>j){if(popupHeight>i||popupHeight>j){a=j;if(a<j){a=j}m=parseFloat(a/popupHeight);h=parseFloat(m*i);h=parseInt(Math.ceil(h))}else{h=e;if(f.height()<j){a=j}else{m=parseFloat(h/i);a=parseFloat(m*popupHeight);a=parseInt(Math.ceil(a))}f.css("overflow","scroll")}}}var b={};b.iwidth=h;b.iheight=a;return b}; -
TabularUnified really-simple-popup/trunk/readme.txt ¶
r791672 r870110 5 5 Tags: popup, fancybox 6 6 Requires at least: 3.5.1 7 Tested up to: 3. 6.18 Stable tag: 1.0. 77 Tested up to: 3.8.1 8 Stable tag: 1.0.8 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 25 25 26 26 = Advanced use = 27 - disable gallery feature and popup for image by adding this class: **no-hsrsp-popup** 27 28 - anchor classes for **iframe** popup *"hs-rsp-popup iframe"* 28 29 - anchor classes for **html** popup *"hs-rsp-popup hiddendiv"* … … 66 67 67 68 == Changelog == 69 = 1.0.8 = 70 Add 'no-hsrsp-popup' class to image to not have it part of gallery/popup. Fixed but on set width/height window resize 71 68 72 = 1.0.7 = 69 73 Reverted body scroll fix as it was having undesirable effects … … 89 93 == Upgrade Notice == 90 94 95 = 1.0.8 = 96 Add 'no-hsrsp-popup' class to image to not have it part of gallery/popup. Fixed but on set width/height window resize 97 91 98 = 1.0.5 = 92 99 * Fixed: Firefox close issue -
TabularUnified really-simple-popup/trunk/really-simple-popup.php ¶
r791672 r870110 4 4 Plugin URI: http://www.hotscot.net/ 5 5 Description: Simple, easy to use, fancybox style popup 6 Version: 1.0. 76 Version: 1.0.8 7 7 Author: Hotscot 8 8 Author URI: http://www.hotscot.net
Note: See TracChangeset
for help on using the changeset viewer.