-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.payWithTweet.min.js
1 lines (1 loc) · 1.06 KB
/
jquery.payWithTweet.min.js
1
!function(e){function t(e,t,n){var o;if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),o="; expires="+i.toGMTString()}else o="";document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+o+"; path=/"}function n(e){for(var t=encodeURIComponent(e)+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return decodeURIComponent(i.substring(t.length,i.length))}return null}var o=null;e.fn.tweetAction=function(i,r){return i=e.extend({url:window.location.href,cookies:!0},i),"true"==n("tweetToDownload")&&i.cookies?void r():this.click(function(n){if(o)return void n.preventDefault();var c=550,l=350,u=(window.screen.height-l)/2,d=(window.screen.width-c)/2,s=["scrollbars=yes","resizable=yes","toolbar=no","location=yes","width="+c,"height="+l,"left="+d,"top="+u].join(",");o=window.open("http://twitter.com/intent/tweet?"+e.param(i),"TweetWindow",s),function a(){try{if(!o||o.closed)throw"Closed!";setTimeout(a,100)}catch(e){o=null,t("tweetToDownload",!0,30),r()}}(),n.preventDefault()})}}(jQuery);