From e58433877693efc2a1422e1b1cfd2fbf6cdfbdd4 Mon Sep 17 00:00:00 2001 From: dorey Date: Tue, 22 May 2012 03:10:13 -0400 Subject: [PATCH 1/2] 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 + From 60ddbf49c638d6687b1573123ecc71164522f4c9 Mon Sep 17 00:00:00 2001 From: dorey Date: Wed, 23 May 2012 01:52:20 -0400 Subject: [PATCH 2/2] minimal javascript to automatically open up an email message (tested and works in chrome,ff when a mailto client is available.) --- zerobin/static/js/behavior.js | 23 ----------------------- zerobin/views/paste.tpl | 2 +- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/zerobin/static/js/behavior.js b/zerobin/static/js/behavior.js index 362ef3c..df3b84f 100644 --- a/zerobin/static/js/behavior.js +++ b/zerobin/static/js/behavior.js @@ -458,29 +458,6 @@ 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 c3183e5..3f4f766 100644 --- a/zerobin/views/paste.tpl +++ b/zerobin/views/paste.tpl @@ -24,7 +24,7 @@

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