Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Bitcoin payment info #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ <h3><span class="glyphicon glyphicon-ok why" aria-hidden="true" style="color:#1A
</p>
<h3><span class="glyphicon glyphicon-ok why" aria-hidden="true" style="color:#1ABC9C"></span> Easy for Publishers</h3>
<p>There's nothing to sign up for or install.
No changes to your pages or CMS. All you
need to do is register a PayPal or Dwolla account
to receive payments.
No changes to your pages or CMS. All you
need to do is register a PayPal or Dwolla account,
or get a Bitcoin wallet address to receive payments.
</p>
<h3><span class="glyphicon glyphicon-ok why" aria-hidden="true" style="color:#1ABC9C"></span> Private</h3>
<p>Tipsy is completely private. No Tipsy
Expand Down Expand Up @@ -259,7 +259,7 @@ <h3>Getting Paid</h3>
or <a href="https://www.dwolla.com/">Dwolla</a>
account to receive payments, and (2) publish
that account's ID in a single <samp>tipsy.txt</samp>
file on your web site. That's
file on your web site. That's
it&mdash;you don't have to change a single
page or any step in your CMS workflow.
There's nothing to install.
Expand All @@ -275,9 +275,9 @@ <h3>Getting Paid</h3>
email. For Dwolla you need to <a href="#"
data-toggle="modal"
data-target="#dwollaKeyInfo">get a key</a>.
Paypal charges transaction fees while Dwolla
PaPpal charges transaction fees while Dwolla
does not. But more users have (and can pay
with) Paypal accounts. You can use
with) their PayPal accounts. You can use
either <b>or both</b> on your site.
</div>
</div>
Expand Down Expand Up @@ -732,6 +732,13 @@ <h4 class="modal-title" id="myModalLabel">Link Tag</h4>
placeholder="kRrCD32hkwH0E7ldn/xeI/WCQKqR2dVPLuQjF6Bu/g4OlMnZa9" />
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="bitcoinWallet">Bitcoin Wallet Address</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="bitcoinWallet"
placeholder="56aa4626057f4e415444b373f5f9d6aa" />
</div>
</div>
</form>
<button type="button" class="btn btn-primary" id="linkTagGenerateBtn">Generate</button>
<hr />
Expand Down Expand Up @@ -775,13 +782,17 @@ <h4 class="modal-title" id="myModalLabel">tipsy.txt</h4>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="payPalEmail">Payment Info</label>
<div class="col-sm-4">
<div class="col-sm-3">
<input type="email" class="form-control" id="payPalEmail1" placeholder="PayPal Email" />
</div>
<div class="col-sm-5">
<div class="col-sm-3">
<input type="text" class="form-control" id="dwollaKey1"
placeholder="Dwolla Key" />
</div>
<div class="col-sm-3">
<input type="text" class="form-control" id="bitcoinWallet1"
placeholder="Bitcoin Wallet Address" />
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -924,11 +935,12 @@ <h4><samp>Payment methods</samp></h4>
&nbsp;&nbsp;&nbsp;3 d<br/>
payment-methods:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;mysite.html:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bitcoin: 56aa4626057f4e415444b373f5f9d6aa<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;paypal: [email protected]<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwolla: kRrCD32hkwH0E7ldn/xeI/WCQKqR <br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwolla: kRrCD32hkwH0E7ldn/xeI/WCQKqR<br/>
&nbsp;&nbsp;&nbsp;&nbsp;_:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;paypal:[email protected]<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwolla: H0E7ldH0E7ldKqR/KqRD32hkw <br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwolla: H0E7ldH0E7ldKqR/KqRD32hkw<br/>
</samp>
</div>
<p>All you need to make sure is to have the colons at the end of each heading and keep the indentation levels consistent.
Expand Down
34 changes: 22 additions & 12 deletions data/js/tipsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ $(function() {
var name = $('#linkTagName').val();
var paypalEmail = $('#payPalEmail').val();
var dwollaKey = $('#dwollaKey').val();
var bitcoinWallet = $('#bitcoinWallet').val();

var data = ""
var nameIn = ""
Expand All @@ -24,7 +25,7 @@ $(function() {

if (paypalEmail != "") {
if (!(regex.test(paypalEmail))) {
$('#noData').html("<div class='alert alert-warning text-center' id='alertMessage'>Make sure your paypal email is valid.</div>");
$('#noData').html("<div class='alert alert-warning text-center' id='alertMessage'>Make sure your PayPal email is valid.</div>");
window.setTimeout(function() {
$("#alertMessage").fadeTo(500, 0).slideUp(500, function() {
$(this).remove();
Expand All @@ -33,21 +34,26 @@ $(function() {
return
}

data += " data-paypal='" + paypalEmail + "'";
data += " data-paypal=\"" + paypalEmail + '"';
}

if (dwollaKey != "") {
data += " data-dwolla='" + dwollaKey + "'";
data += " data-dwolla=\"" + dwollaKey + '"';
}
var textArea = "<code> &ltlink rel='author'" + nameIn + data + "&gt</code>";

if (bitcoinWallet != "") {
data += " data-bitcoin=\"" + bitcoinWallet + '"';
}

var textArea = '<code>&ltlink rel="author"' + nameIn + data + "&gt</code>";

if (data != "") {
$('#noData').empty();
$('#placeFollowing').html("<p>Place the following in the <samp>HEAD</samp> of your site:</p>");
$('#placeFollowing').html("<p>Place the following in the <samp>&lt;head&gt;</samp> of your site:</p>");
$('#generatedLinkTag').html(textArea);
} else {

$('#noData').html("<div class='alert alert-warning text-center' id='alertMessage'>Please make sure you provided at least either PayPal or dwolla information.</div>");
$('#noData').html("<div class='alert alert-warning text-center' id='alertMessage'>Please make sure you provide <strong>at least one</strong> payment option.</div>");

window.setTimeout(function() {
$("#alertMessage").fadeTo(500, 0).slideUp(500, function() {
Expand Down Expand Up @@ -122,7 +128,7 @@ $('#txtBar').click(function(e) {

function makeGroup(number) {
var i = number.toString();
var str = "<div class='groups' id='group" + i + "'><div class='form-group group'><hr><label class='control-label col-sm-3' for='urlPrefix" + i + "'>URL Prefix " + i + "</label><div class='col-sm-9'><input type='text' class='form-control' id='urlPrefix" + i + "' placeholder='(leave blank to cover your entire domain)' /></div></div><div class='form-group'><label class='control-label col-sm-3' for='payPalEmail'>Payment Info " + i + "</label><div class='col-sm-4'><input type='email' class='form-control' id='payPalEmail" + i + "' placeholder='PayPal Email' /></div><div class='col-sm-5'><input type='text' class='form-control' id='dwollaKey" + i + "' placeholder='Dwolla Key' /></div></div></div>";
var str = "<div class='groups' id='group" + i + "'><div class='form-group group'><hr><label class='control-label col-sm-3' for='urlPrefix" + i + "'>URL Prefix " + i + "</label><div class='col-sm-9'><input type='text' class='form-control' id='urlPrefix" + i + "' placeholder='(leave blank to cover your entire domain)' /></div></div><div class='form-group'><label class='control-label col-sm-3' for='payPalEmail'>Payment Info " + i + "</label><div class='col-sm-3'><input type='email' class='form-control' id='payPalEmail" + i + "' placeholder='PayPal Email' /></div><div class='col-sm-3'><input type='text' class='form-control' id='dwollaKey" + i + "' placeholder='Dwolla Key' /></div><div class='col-sm-3'><input type='text' class='form-control' id='bitcoinWallet" + i + "' placeholder='Bitcoin Wallet Address' /></div></div></div>";
return str

}
Expand Down Expand Up @@ -165,6 +171,7 @@ function generateTxtOutput() {
}
var payPal = $("#payPalEmail" + (i + 1).toString()).val();
var dwolla = $("#dwollaKey" + (i + 1).toString()).val();
var bitcoin = $("#bitcoinWallet" + (i + 1).toString()).val();
if (payPal != "" && !(regex.test(payPal))) {
$('#noDataTxt').html("<div class='alert alert-warning text-center' id='alertMessage'>Please make sure the PayPal email you provide for the Payment Info " + num + " is correct.</div>");

Expand All @@ -176,7 +183,7 @@ function generateTxtOutput() {
return;

}
if (payPal != "" || dwolla != "") {
if (payPal != "" || dwolla != "" || bitcoin != "") {
outString += "payment-methods:<br/>"
isThereAnyPaymentInfo = true;
break
Expand All @@ -201,6 +208,7 @@ function generateTxtOutput() {
for (var i = 0; i < groups.length; i++) {
var payPal = $("#payPalEmail" + (i + 1).toString()).val();
var dwolla = $("#dwollaKey" + (i + 1).toString()).val();
var bitcoin = $("#bitcoinWallet" + (i + 1).toString()).val();

var num;
if (i == 0) {
Expand Down Expand Up @@ -229,13 +237,15 @@ function generateTxtOutput() {
}
outString += "&nbsp;&nbsp;" + currUrlPrefix + ":&nbsp;<br/>"

if (payPal != "") {
outString += "&nbsp;&nbsp;&nbsp;&nbsp;paypal: " + payPal + "<br/>"
if (bitcoin != "") {
outString += "&nbsp;&nbsp;&nbsp;&nbsp;bitcoin: " + bitcoin + "<br/>"
}

if (dwolla != "") {
outString += "&nbsp;&nbsp;&nbsp;&nbsp;dwolla: " + dwolla + "<br/>"
}
if (payPal != "") {
outString += "&nbsp;&nbsp;&nbsp;&nbsp;paypal: " + payPal + "<br/>"
}
}
}

Expand Down Expand Up @@ -304,4 +314,4 @@ saveAs(blob, "tipsy.txt");
}
}));

});
});