mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-07-22 14:30:41 -04:00
Add QR code generation when paste is created
This commit is contained in:
parent
9f973edb7d
commit
7bf5af761b
6 changed files with 114 additions and 43 deletions
|
@ -21,6 +21,7 @@
|
|||
/** global: prettyPrintOne */
|
||||
/** global: showdown */
|
||||
/** global: sjcl */
|
||||
/** global: kjua */
|
||||
|
||||
// Immediately start random number generator collector.
|
||||
sjcl.random.startCollectors();
|
||||
|
@ -1205,7 +1206,8 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
var $pasteSuccess,
|
||||
$pasteUrl,
|
||||
$remainingTime,
|
||||
$shortenButton;
|
||||
$shortenButton,
|
||||
$qrCodeLink;
|
||||
|
||||
/**
|
||||
* forward to URL shortener
|
||||
|
@ -1240,6 +1242,23 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the QR code of the current paste.
|
||||
*
|
||||
* @name PasteStatus.displayQrCode
|
||||
* @function
|
||||
* @param {Event} event
|
||||
*/
|
||||
function displayQrCode(event)
|
||||
{
|
||||
var qrCanvas = kjua({
|
||||
render: 'canvas',
|
||||
text: $pasteUrl.attr('href')
|
||||
});
|
||||
$('#qrcode-display').html(qrCanvas);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a notification after a successfull paste upload
|
||||
*
|
||||
|
@ -1336,9 +1355,11 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
// $pasteUrl is saved in me.createPasteNotification() after creation
|
||||
$remainingTime = $('#remainingtime');
|
||||
$shortenButton = $('#shortenbutton');
|
||||
$qrCodeLink = $('#qrcodelink');
|
||||
|
||||
// bind elements
|
||||
$shortenButton.click(sendToShortener);
|
||||
$qrCodeLink.click(displayQrCode);
|
||||
}
|
||||
|
||||
return me;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue