mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-05-02 22:45:10 -04:00
Add config and basic page template support
* load JS file asyncronously (just HTML5 async attribut) * add basic support for page template, where it generates the code inside of a simple div at the top * added option to turn off QR code support
This commit is contained in:
parent
7bf5af761b
commit
414ab0eb71
9 changed files with 74 additions and 52 deletions
|
@ -1206,8 +1206,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
var $pasteSuccess,
|
||||
$pasteUrl,
|
||||
$remainingTime,
|
||||
$shortenButton,
|
||||
$qrCodeLink;
|
||||
$shortenButton;
|
||||
|
||||
/**
|
||||
* forward to URL shortener
|
||||
|
@ -1242,23 +1241,6 @@ 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
|
||||
*
|
||||
|
@ -1355,11 +1337,9 @@ 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;
|
||||
|
@ -2429,6 +2409,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
$password,
|
||||
$passwordInput,
|
||||
$rawTextButton,
|
||||
$qrCodeLink,
|
||||
$sendButton;
|
||||
|
||||
var pasteExpiration = '1week';
|
||||
|
@ -2606,6 +2587,22 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
event.preventDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the QR code of the current paste (URL).
|
||||
*
|
||||
* @name TopNav.displayQrCode
|
||||
* @function
|
||||
* @param {Event} event
|
||||
*/
|
||||
function displayQrCode(event)
|
||||
{
|
||||
var qrCanvas = kjua({
|
||||
render: 'canvas',
|
||||
text: window.location.href
|
||||
});
|
||||
$('#qrcode-display').html(qrCanvas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows all elements belonging to viwing an existing pastes
|
||||
*
|
||||
|
@ -2622,6 +2619,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
$newButton.removeClass('hidden');
|
||||
$cloneButton.removeClass('hidden');
|
||||
$rawTextButton.removeClass('hidden');
|
||||
$qrCodeLink.removeClass('hidden');
|
||||
|
||||
viewButtonsDisplayed = true;
|
||||
}
|
||||
|
@ -2642,6 +2640,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
$newButton.addClass('hidden');
|
||||
$cloneButton.addClass('hidden');
|
||||
$rawTextButton.addClass('hidden');
|
||||
$qrCodeLink.addClass('hidden');
|
||||
|
||||
viewButtonsDisplayed = false;
|
||||
}
|
||||
|
@ -2892,6 +2891,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
$passwordInput = $('#passwordinput');
|
||||
$rawTextButton = $('#rawtextbutton');
|
||||
$sendButton = $('#sendbutton');
|
||||
$qrCodeLink = $('#qrcodelink');
|
||||
|
||||
// bootstrap template drop down
|
||||
$('#language ul.dropdown-menu li a').click(setLanguage);
|
||||
|
@ -2906,6 +2906,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
$cloneButton.click(Controller.clonePaste);
|
||||
$rawTextButton.click(rawText);
|
||||
$fileRemoveButton.click(removeAttachment);
|
||||
$qrCodeLink.click(displayQrCode);
|
||||
|
||||
// bootstrap template drop downs
|
||||
$('ul.dropdown-menu li a', $('#expiration').parent()).click(updateExpiration);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue