Added download feature (#5318).
This commit is contained in:
parent
02e9fd2de3
commit
9bf5b6dbde
|
@ -249,6 +249,10 @@ button img {
|
||||||
padding: 1px 0 1px 0;
|
padding: 1px 0 1px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#downloadtextbutton img {
|
||||||
|
padding: 1px 0 1px 0;
|
||||||
|
}
|
||||||
|
|
||||||
#remainingtime, #password {
|
#remainingtime, #password {
|
||||||
color: #94a3b4;
|
color: #94a3b4;
|
||||||
display: inline;
|
display: inline;
|
||||||
|
|
|
@ -3508,6 +3508,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
$password,
|
$password,
|
||||||
$passwordInput,
|
$passwordInput,
|
||||||
$rawTextButton,
|
$rawTextButton,
|
||||||
|
$downloadTextButton,
|
||||||
$qrCodeLink,
|
$qrCodeLink,
|
||||||
$emailLink,
|
$emailLink,
|
||||||
$sendButton,
|
$sendButton,
|
||||||
|
@ -3635,6 +3636,30 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
newDoc.close();
|
newDoc.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* download text
|
||||||
|
*
|
||||||
|
* @name TopNav.downloadText
|
||||||
|
* @private
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
function downloadText()
|
||||||
|
{
|
||||||
|
var filename='paste.txt';
|
||||||
|
var text = PasteViewer.getText();
|
||||||
|
|
||||||
|
var element = document.createElement('a');
|
||||||
|
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||||
|
element.setAttribute('download', filename);
|
||||||
|
|
||||||
|
element.style.display = 'none';
|
||||||
|
document.body.appendChild(element);
|
||||||
|
|
||||||
|
element.click();
|
||||||
|
|
||||||
|
document.body.removeChild(element);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* saves the language in a cookie and reloads the page
|
* saves the language in a cookie and reloads the page
|
||||||
*
|
*
|
||||||
|
@ -3859,6 +3884,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
$newButton.removeClass('hidden');
|
$newButton.removeClass('hidden');
|
||||||
$cloneButton.removeClass('hidden');
|
$cloneButton.removeClass('hidden');
|
||||||
$rawTextButton.removeClass('hidden');
|
$rawTextButton.removeClass('hidden');
|
||||||
|
$downloadTextButton.removeClass('hidden');
|
||||||
$qrCodeLink.removeClass('hidden');
|
$qrCodeLink.removeClass('hidden');
|
||||||
|
|
||||||
viewButtonsDisplayed = true;
|
viewButtonsDisplayed = true;
|
||||||
|
@ -3879,6 +3905,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
$cloneButton.addClass('hidden');
|
$cloneButton.addClass('hidden');
|
||||||
$newButton.addClass('hidden');
|
$newButton.addClass('hidden');
|
||||||
$rawTextButton.addClass('hidden');
|
$rawTextButton.addClass('hidden');
|
||||||
|
$downloadTextButton.addClass('hidden');
|
||||||
$qrCodeLink.addClass('hidden');
|
$qrCodeLink.addClass('hidden');
|
||||||
me.hideEmailButton();
|
me.hideEmailButton();
|
||||||
|
|
||||||
|
@ -4040,6 +4067,17 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
$rawTextButton.addClass('hidden');
|
$rawTextButton.addClass('hidden');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* only hides the download text button
|
||||||
|
*
|
||||||
|
* @name TopNav.hideRawButton
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
me.hideDownloadButton = function()
|
||||||
|
{
|
||||||
|
$downloadTextButton.addClass('hidden');
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* only hides the qr code button
|
* only hides the qr code button
|
||||||
*
|
*
|
||||||
|
@ -4278,6 +4316,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
$password = $('#password');
|
$password = $('#password');
|
||||||
$passwordInput = $('#passwordinput');
|
$passwordInput = $('#passwordinput');
|
||||||
$rawTextButton = $('#rawtextbutton');
|
$rawTextButton = $('#rawtextbutton');
|
||||||
|
$downloadTextButton = $('#downloadtextbutton');
|
||||||
$retryButton = $('#retrybutton');
|
$retryButton = $('#retrybutton');
|
||||||
$sendButton = $('#sendbutton');
|
$sendButton = $('#sendbutton');
|
||||||
$qrCodeLink = $('#qrcodelink');
|
$qrCodeLink = $('#qrcodelink');
|
||||||
|
@ -4295,6 +4334,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
$sendButton.click(PasteEncrypter.sendPaste);
|
$sendButton.click(PasteEncrypter.sendPaste);
|
||||||
$cloneButton.click(Controller.clonePaste);
|
$cloneButton.click(Controller.clonePaste);
|
||||||
$rawTextButton.click(rawText);
|
$rawTextButton.click(rawText);
|
||||||
|
$downloadTextButton.click(downloadText);
|
||||||
$retryButton.click(clickRetryButton);
|
$retryButton.click(clickRetryButton);
|
||||||
$fileRemoveButton.click(removeAttachment);
|
$fileRemoveButton.click(removeAttachment);
|
||||||
$qrCodeLink.click(displayQrCode);
|
$qrCodeLink.click(displayQrCode);
|
||||||
|
@ -4631,6 +4671,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
TopNav.showEmailButton();
|
TopNav.showEmailButton();
|
||||||
|
|
||||||
TopNav.hideRawButton();
|
TopNav.hideRawButton();
|
||||||
|
TopNav.hideDownloadButton();
|
||||||
Editor.hide();
|
Editor.hide();
|
||||||
|
|
||||||
// parse and show text
|
// parse and show text
|
||||||
|
|
|
@ -72,7 +72,7 @@ endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.8.js" integrity="sha512-QwcEKGuEmKtMguCO9pqNtUtZqq9b/tJ8gNr5qhY8hykq3zKTlDOvpZAmf6Rs8yH35Bz1ZdctUjj2qEWxT5aXCg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.8.js" integrity="sha512-QwcEKGuEmKtMguCO9pqNtUtZqq9b/tJ8gNr5qhY8hykq3zKTlDOvpZAmf6Rs8yH35Bz1ZdctUjj2qEWxT5aXCg==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-+4ay2Dw/9w/DOTutdpoiHvF6RxqV0V8ABSXHlebjGbQ7Td+3If7mOZ5OIu/lWCifcgP6vyhJuiB8+jl8FGtuwg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-uFEL2FsrA5XWPVmKy00j1i6KX6OVBleQTrJ6iGM39I55d2fq9+WA/9EqJ46yj24JWZDV9oJ5wYvnZXcL6zywvg==" crossorigin="anonymous"></script>
|
||||||
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
||||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
||||||
<link rel="icon" type="image/png" href="img/favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
|
<link rel="icon" type="image/png" href="img/favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
|
||||||
|
@ -199,6 +199,9 @@ endif;
|
||||||
<button id="rawtextbutton" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
|
<button id="rawtextbutton" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
|
||||||
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
|
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
|
||||||
</button>
|
</button>
|
||||||
|
<button id="downloadtextbutton" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
|
||||||
|
<span class="glyphicon glyphicon glyphicon-download-alt" aria-hidden="true"></span> Download
|
||||||
|
</button>
|
||||||
<button id="emaillink" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
|
<button id="emaillink" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
|
||||||
<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> <?php echo I18n::_('Email'), PHP_EOL; ?>
|
<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> <?php echo I18n::_('Email'), PHP_EOL; ?>
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in New Issue