Skip to content

Commit

Permalink
Add data link for downloading resulting text
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryCutts committed Jan 5, 2013
1 parent 85a2ef1 commit bd733b5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

<textarea readonly rows="4" id="outputDisplay" placeholder="The encrypted or decrypted text will appear here."></textarea>

<div id="plainTextDiv"><a id="plainTextLink" rel="nofollow">Open as plain text</a> (right click &gt; Save link as... to download.) </div>

<!-- Descriptive text -->
<div class="columnContainer">
<div class="column" id="col1">
Expand Down Expand Up @@ -102,6 +104,7 @@ <h3 class="columnHeader">How does it work?</h3>
decryptRB = document.getElementById("decryptRB");
button = document.getElementById("button");
outputDisplay = document.getElementById("outputDisplay");
plainTextLink = document.getElementById("plainTextLink");
//-->
</script>
</body>
Expand Down
3 changes: 2 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with Just Encrypt. If not, see <http://www.gnu.org/licenses/>.
*/

var pwField, dataField, outputDisplay, encryptRB, decryptRB, button;
var pwField, dataField, outputDisplay, encryptRB, decryptRB, button, plainTextLink;

function encrypt() {
var pw = pwField.value;
Expand Down Expand Up @@ -48,6 +48,7 @@ function decrypt() {

function output(text) {
outputDisplay.value = text;
plainTextLink.href = "data:text/plain," + text
}

function showPWConfirm() {
Expand Down
6 changes: 6 additions & 0 deletions stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ input.invalid {
width:25%;
}

#plainTextDiv {
text-align:right;
font-size:small;
padding-bottom:1em;
}

/* Text Styles */
p, li, div {
font-family:"Trebuchet",sans-serif;
Expand Down

0 comments on commit bd733b5

Please sign in to comment.