From fdc87a7fcf874699d8eb4d2edb84823980220c46 Mon Sep 17 00:00:00 2001 From: Sebastien SAUVAGE Date: Sun, 24 Feb 2013 16:29:13 +0100 Subject: [PATCH] Added "Raw text" button. (cherry picked from commit 00cfcafc996c55afd069b665ad3875693e22d36d) Conflicts: css/zerobin.css js/zerobin.js tpl/page.html --- css/zerobin.css | 6 +++++- img/icon_raw.png | Bin 0 -> 204 bytes js/zerobin.js | 13 +++++++++++++ tpl/page.html | 7 ++++--- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 img/icon_raw.png diff --git a/css/zerobin.css b/css/zerobin.css index ec1b9515..d2ea8043 100644 --- a/css/zerobin.css +++ b/css/zerobin.css @@ -178,7 +178,7 @@ button img { top: 2px; } -#expiration, #burnafterreadingoption, #opendisc { +#expiration, #rawtextbutton, #burnafterreadingoption, #opendisc { background-color: #414d5a; padding: 6px 8px; margin: 0 5px 0 0; @@ -198,6 +198,10 @@ button img { background: #414d5a; } +#rawtextbutton img { + padding: 1px 0 1px 0; +} + #remainingtime { color: #94a3b4; display: inline; diff --git a/img/icon_raw.png b/img/icon_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..162a6a74e7222325dc2b487242e6d87b5d368340 GIT binary patch literal 204 zcmeAS@N?(olHy`uVBq!ia0vp^{2z_}7YB&o#B8wRqc>F+^vA(=V87LU#>Eal|A)Cx$W@ct;X2zFb zkdUCMo5&Ev#?!O1Q^BpE(@=S{XCZ@ghG#}lmWSqyzyPjPj*dmfGBFF4xK;(Qacj2- vo;bsi*s@}ogM{Nczl65Jf{cOgTe~DWM4f$E!fg literal 0 HcmV?d00001 diff --git a/js/zerobin.js b/js/zerobin.js index f8588421..a8b06716 100644 --- a/js/zerobin.js +++ b/js/zerobin.js @@ -381,6 +381,7 @@ function selectText(element) { function stateNewPaste() { $('button#sendbutton').removeClass('hidden'); $('button#clonebutton').addClass('hidden'); + $('button#rawtextbutton').addClass('hidden'); $('div#expiration').removeClass('hidden'); $('div#remainingtime').addClass('hidden'); $('div#burnafterreadingoption').removeClass('hidden'); @@ -408,6 +409,7 @@ function stateExistingPaste() { else { $('button#clonebutton').removeClass('hidden'); } + $('button#rawtextbutton').show(); $('div#expiration').addClass('hidden'); $('div#burnafterreadingoption').addClass('hidden'); @@ -419,6 +421,17 @@ function stateExistingPaste() { $('div#prettymessage').removeClass('hidden'); } +/** Return raw text + */ +function rawText() +{ + history.replaceState(document.title, document.title, 'document.txt'); + var paste = $('div#cleartext').text(); + var newDoc = document.open('text/plain', 'replace'); + newDoc.write(paste); + newDoc.close(); +} + /** * Clone the current paste. */ diff --git a/tpl/page.html b/tpl/page.html index 2cecb2a9..c278b439 100644 --- a/tpl/page.html +++ b/tpl/page.html @@ -46,9 +46,10 @@
{$STATUS|htmlspecialchars}
- - - + + + +