Add QR code generation when paste is created
This commit is contained in:
2
js/kjua.min.js
vendored
Normal file
2
js/kjua.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user