Commits

Germano Guerrini committed 43ed12e

2 rows shorter...

  • Participants
  • Parent commits 278a428

Comments (0)

Files changed (2)

File jquery.pinme.compressed.js

-(function(e){"use strict";e.fn.pinMe=function(t){var n={imageSelector:".pin_me",imageMediaAttribute:"src",imageDescriptionAttribute:"data-pin-description",buttonUrl:"pinit.png",buttonWidth:49,buttonHeight:25,buttonAlignment:"top-left",buttonPadding:5,buttonWillShowFunction:function(e){e.css({opacity:.75})},buttonOnMouseOverFunction:function(e,t){e.css({opacity:1,"-webkit-transition":"opacity .25s ease-out","-moz-transition":"opacity .25s ease-out",transition:"opacity .25s ease-out"});t.css({opacity:.75,"-webkit-transition":"opacity .25s ease-out","-moz-transition":"opacity .25s ease-out",transition:"opacity .25s ease-out"})},buttonOnMouseOutFunction:function(e,t){e.css({opacity:.75,"-webkit-transition":"opacity .25s ease-out","-moz-transition":"opacity .25s ease-out",transition:"opacity .25s ease-out"});t.css({opacity:1,"-webkit-transition":"opacity .25s ease-out","-moz-transition":"opacity .25s ease-out",transition:"opacity .25s ease-out"})},popupX:100,popupY:100,popupHeight:580,popupWidth:730,popupName:"pinterest"},r=e.extend(n,t);var i=function(e){var t=e.position(),n=e.width(),i=e.height();switch(r.buttonAlignment){case"top-right":return{top:t.top+r.buttonPadding,left:t.left+n-r.buttonWidth-r.buttonPadding};case"bottom-right":return{top:t.top+i-r.buttonHeight-r.buttonPadding,left:t.left+n-r.buttonWidth-r.buttonPadding};case"bottom-left":return{top:t.top+i-r.buttonHeight-r.buttonPadding,left:t.left+r.buttonPadding};default:return{top:t.top+r.buttonPadding,left:t.left+r.buttonPadding}}};var s=function(e){var t=e.attr(r.imageMediaAttribute);if(!t.match("^http://")){var n=t.substr(0,1)==="/"?"":"/";t=window.location.origin+n+t}return t};return this.each(function(){var t=e(this),n="pin_me_wrapper",o="http://pinterest.com/pin/create/button/",u="img"+r.imageSelector,a=e('<img src="'+r.buttonUrl+'" />'),f=e('<span class="'+n+'" />');t.find(u).wrap(f);e("."+n).on("mouseenter mouseleave",function(t){var n=e(this);if(t.type==="mouseenter"){var f=n.children(u).first(),l=s(f),c=f.attr(r.imageDescriptionAttribute);var h={url:document.URL,media:l,description:c};var p=i(f);a.css({position:"absolute",top:p.top,left:p.left,cursor:"pointer"});r.buttonWillShowFunction(a);a.on("click",function(t){var n=o+"?"+e.param(h),i="screenX="+r.popupX+",screenY="+r.popupY+",width="+r.popupWidth+",height="+r.popupHeight;window.open(n,r.popupName,i)});a.on("mouseover mouseout",function(t){var n=e(this);if(t.type=="mouseover"){r.buttonOnMouseOverFunction(n,f)}else{r.buttonOnMouseOutFunction(n,f)}});a.appendTo(n)}else{a.off();a.remove()}return false})})};e.pinMe=function(t){return e("body").pinMe(t)}})(jQuery)
+(function(e){"use strict";e.fn.pinMe=function(t){var n={imageSelector:".pin_me",imageMediaAttribute:"src",imageDescriptionAttribute:"data-pin-description",buttonUrl:"pinit.png",buttonWidth:49,buttonHeight:25,buttonAlignment:"top-left",buttonPadding:5,buttonWillShowFunction:function(e){e.css({opacity:.75})},buttonOnMouseOverFunction:function(e,t){e.css({opacity:1,"-webkit-transition":"opacity .25s ease-out","-moz-transition":"opacity .25s ease-out",transition:"opacity .25s ease-out"});t.css({opacity:.75,"-webkit-transition":"opacity .25s ease-out","-moz-transition":"opacity .25s ease-out",transition:"opacity .25s ease-out"})},buttonOnMouseOutFunction:function(e,t){e.css({opacity:.75,"-webkit-transition":"opacity .25s ease-out","-moz-transition":"opacity .25s ease-out",transition:"opacity .25s ease-out"});t.css({opacity:1,"-webkit-transition":"opacity .25s ease-out","-moz-transition":"opacity .25s ease-out",transition:"opacity .25s ease-out"})},popupX:100,popupY:100,popupHeight:580,popupWidth:730,popupName:"pinterest"},r=e.extend(n,t);var i=function(e){var t=e.position(),n=e.width(),i=e.height();switch(r.buttonAlignment){case"top-right":return{top:t.top+r.buttonPadding,left:t.left+n-r.buttonWidth-r.buttonPadding};case"bottom-right":return{top:t.top+i-r.buttonHeight-r.buttonPadding,left:t.left+n-r.buttonWidth-r.buttonPadding};case"bottom-left":return{top:t.top+i-r.buttonHeight-r.buttonPadding,left:t.left+r.buttonPadding};default:return{top:t.top+r.buttonPadding,left:t.left+r.buttonPadding}}};var s=function(e){var t=e.attr(r.imageMediaAttribute);if(!t.match("^http://")){var n=t.substr(0,1)==="/"?"":"/";t=window.location.origin+n+t}return t};return this.each(function(){var t=e(this),n="pin_me_wrapper",o="http://pinterest.com/pin/create/button/",u="img"+r.imageSelector,a=e('<img src="'+r.buttonUrl+'" />'),f=e('<span class="'+n+'" />');t.find(u).wrap(f);e("."+n).on("mouseenter mouseleave",function(t){var n=e(this);if(t.type==="mouseenter"){var f=n.children(u).first(),l=s(f),c=f.attr(r.imageDescriptionAttribute);var h={url:document.URL,media:l,description:c};var p=i(f);a.css({position:"absolute",top:p.top,left:p.left,cursor:"pointer"});r.buttonWillShowFunction(a);a.on("click mouseover mouseout",function(t){var n=e(this);if(t.type==="click"){var i=o+"?"+e.param(h),s="screenX="+r.popupX+",screenY="+r.popupY+",width="+r.popupWidth+",height="+r.popupHeight;window.open(i,r.popupName,s)}else if(t.type==="mouseover"){r.buttonOnMouseOverFunction(n,f)}else if(t.type==="mouseout"){r.buttonOnMouseOutFunction(n,f)}});a.appendTo(n)}else{a.off();a.remove()}return false})})};e.pinMe=function(t){return e("body").pinMe(t)}})(jQuery)

File jquery.pinme.js

                     
                     settings.buttonWillShowFunction(button);
                     
-                    button.on('click', function(event) {
-                        var url = baseUrl + '?' + $.param(params),
-                            specs = 'screenX=' + settings.popupX + ',screenY=' + settings.popupY + ',width=' + settings.popupWidth + ',height=' + settings.popupHeight;
-                        window.open(url, settings.popupName, specs);
-                    });
-                    
-                    button.on('mouseover mouseout', function(event) {
+                    button.on('click mouseover mouseout', function(event) {
                         var currentButton = $(this);
-                        if (event.type == 'mouseover') {
+                        if (event.type === 'click') {
+                            var url = baseUrl + '?' + $.param(params),
+                                specs = 'screenX=' + settings.popupX + ',screenY=' + settings.popupY + ',width=' + settings.popupWidth + ',height=' + settings.popupHeight;
+                            window.open(url, settings.popupName, specs);
+                        } else if (event.type === 'mouseover') {
                             settings.buttonOnMouseOverFunction(currentButton, currentImage);
-                        } else {
+                        } else if (event.type === 'mouseout'){
                             settings.buttonOnMouseOutFunction(currentButton, currentImage);
                         };
                     });