From e58433877693efc2a1422e1b1cfd2fbf6cdfbdd4 Mon Sep 17 00:00:00 2001 From: dorey Date: Tue, 22 May 2012 03:10:13 -0400 Subject: [PATCH] allows quick-sending of email links. (#2) --- zerobin/static/js/behavior.js | 23 +++++++++++++++++++++++ zerobin/views/paste.tpl | 8 ++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/zerobin/static/js/behavior.js b/zerobin/static/js/behavior.js index df3b84f..362ef3c 100644 --- a/zerobin/static/js/behavior.js +++ b/zerobin/static/js/behavior.js @@ -458,6 +458,29 @@ if (content && key) { bar.container.show(); bar.set('Decrypting paste...', '25%'); + /* Pop up a form to enter an email address to quickly + send the encrypted link. */ + $('#email-link').click(function(e){ + e.preventDefault(); + var submitLink = $('', {'href':'#', 'class':'btn btn-small'}) + .attr('title', 'Starts a new email in your default client') + .html(""); + var emailInput = $('', { + 'type': 'text', + 'class': 'input-small', + 'placeholder': 'Email' + }).change(function(){ + var emailTxt = $(this).val(); + if(emailTxt) { + submitLink.attr('href', 'mailto:' + emailTxt + '?subject=0bin%20Message&body='+window.location.toString()); + } + }); + $('', {'class': 'form-inline'}) + .append(emailInput) + .append(submitLink) + .insertAfter($(this).hide()); + }); + zerobin.decrypt(key, content, /* On error*/ diff --git a/zerobin/views/paste.tpl b/zerobin/views/paste.tpl index 19021fa..c3183e5 100644 --- a/zerobin/views/paste.tpl +++ b/zerobin/views/paste.tpl @@ -22,10 +22,10 @@

- Copy To Clipboard - | - Get short url + Copy To Clipboard | + Get short url | +  Email +