Skip to content

Instantly share code, notes, and snippets.

@vgdub
Created July 12, 2014 19:30
Show Gist options
  • Save vgdub/26d111a3ed529e3c2607 to your computer and use it in GitHub Desktop.
Save vgdub/26d111a3ed529e3c2607 to your computer and use it in GitHub Desktop.
example post signup share js/ui...simple and easy. from tap
$(function () {
var clicks = 0;
var twitClick = 0 , fbCLick = 0, playClick = 0;
function changeWidth() {
var percent = Math.min(Math.round(clicks / 3 * 100), 100);
var progress = $('#share-progress');
progress.width(percent + '%');
progress.find('.percent').html(percent+'%')
}
$('#fbshare').on('click', function () {
var w = 580, h = 300,
left = (screen.width / 2) - (w / 2),
top = (screen.height / 2) - (h / 2);
if(!twitClick )
{
twitClick = 1;
clicks++;
changeWidth();
}
var msg = "I want to TAP you! TAP is a new, super simple messaging app. I just reserved my username, check it out and reserve your username too before only the silly ones left!";
if ((screen.width < 480) || (screen.height < 480)) {
window.open('http://www.facebook.com/share.php?u=http://bit.ly/reserve-tap', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
} else {
window.open('http://www.facebook.com/share.php?u=http://bit.ly/reserve-tap', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}
});
$('#twittershare').on('click', function () {
var loc = encodeURIComponent('http://bit.ly/reserve-tap'),
title = "I want to TAP you ! Just reserved my username for TAP, reserve yours before only the silly ones are left !",
w = 580, h = 300,
left = (screen.width / 2) - (w / 2),
top = (screen.height / 2) - (h / 2);
if(!fbCLick )
{
fbCLick = 1;
clicks++;
changeWidth();
}
window.open('http://twitter.com/share?text=' + title + '&url=' + loc, '', 'height=' + h + ', width=' + w + ', top=' + top + ', left=' + left + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
});
$('.play').on('click', function () {
if(!playClick )
{
playClick = 1;
clicks++;
changeWidth();
}
var url= "http://bit.ly/tap-demo";
window.open(url,'_blank');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment