Skip to content

Commit 00cfcaf

Browse files
committed
Added "Raw text" button.
1 parent 6b089b4 commit 00cfcaf

4 files changed

Lines changed: 15 additions & 1 deletion

File tree

css/zerobin.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ position:relative;
164164
top:2px;
165165
}
166166

167-
div#expiration, div#burnafterreadingoption, div#opendisc, div#syntaxcoloringoption {
167+
div#expiration, div#rawtextbutton, div#burnafterreadingoption, div#opendisc, div#syntaxcoloringoption {
168168
background-color:#414D5A;
169169
padding:6px 8px;
170170
margin:0px 5px 0px 0px;;

img/icon_raw.png

228 Bytes
Loading

js/zerobin.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ function selectText(element) {
395395
function stateNewPaste() {
396396
$('button#sendbutton').show();
397397
$('button#clonebutton').hide();
398+
$('button#rawtextbutton').hide();
398399
$('div#expiration').show();
399400
$('div#remainingtime').hide();
400401
$('div#burnafterreadingoption').show();
@@ -422,6 +423,7 @@ function stateExistingPaste() {
422423
else {
423424
$('button#clonebutton').show();
424425
}
426+
$('button#rawtextbutton').show();
425427

426428
$('div#expiration').hide();
427429
$('div#burnafterreadingoption').hide();
@@ -433,6 +435,17 @@ function stateExistingPaste() {
433435
$('div#cleartext').show();
434436
}
435437

438+
/** Return raw text
439+
*/
440+
function rawText()
441+
{
442+
history.replaceState(document.title, document.title, 'document.txt');
443+
var paste = $('div#cleartext').text();
444+
var newDoc = document.open('text/plain', 'replace');
445+
newDoc.write(paste);
446+
newDoc.close();
447+
}
448+
436449
/**
437450
* Clone the current paste.
438451
*/

tpl/page.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ <h3>{$VERSION}</h3>
4646
<button id="newbutton" onclick="window.location.href=scriptLocation();return false;" style="display:none;"><img src="img/icon_new.png#" width="11" height="15" />New</button>
4747
<button id="sendbutton" onclick="send_data();return false;" style="display:none;"><img src="img/icon_send.png#" width="18" height="15" />Send</button>
4848
<button id="clonebutton" onclick="clonePaste();return false;" style="display:none;"><img src="img/icon_clone.png#" width="15" height="17" />Clone</button>
49+
<button id="rawtextbutton" onclick="rawText();return false;" style="display:none; "><img src="img/icon_raw.png#" width="15" height="15" style="padding:1px 0px 1px 0px;"/>Raw text</button>
4950
<div id="expiration" style="display:none;">Expires:
5051
<select id="pasteExpiration" name="pasteExpiration">
5152
<option value="5min">5 minutes</option>

0 commit comments

Comments
 (0)