mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-08-01 19:16:13 -04:00
replicate template changes, fix bugs
- fixes QR code height introducing space even when hidden in page layout - fix modals in bootstrap 5 (modal syntax changed heavily, no longer jQuery integrated) - hide and show tab-toggle depending on application state - don't encode HTML entities in translated messages containing kbd tags (in addition to links)
This commit is contained in:
parent
9028ddbb97
commit
c7195aaf9a
9 changed files with 84 additions and 26 deletions
|
@ -2257,7 +2257,11 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
password = $passwordDecrypt.val();
|
||||
|
||||
// hide modal
|
||||
$passwordModal.modal('hide');
|
||||
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip.VERSION) {
|
||||
(new bootstrap.Modal($passwordModal[0])).hide();
|
||||
} else {
|
||||
$passwordModal.modal('hide');
|
||||
}
|
||||
|
||||
PasteDecrypter.run();
|
||||
}
|
||||
|
@ -2278,7 +2282,11 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
const $loadconfirmClose = $loadconfirmmodal.find('.close');
|
||||
$loadconfirmClose.off('click.close');
|
||||
$loadconfirmClose.on('click.close', Controller.newPaste);
|
||||
$loadconfirmmodal.modal('show');
|
||||
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip.VERSION) {
|
||||
(new bootstrap.Modal($loadconfirmmodal[0])).show();
|
||||
} else {
|
||||
$loadconfirmmodal.modal('show');
|
||||
}
|
||||
} else {
|
||||
if (window.confirm(
|
||||
I18n._('This secret message can only be displayed once. Would you like to see it now?')
|
||||
|
@ -2300,11 +2308,18 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
{
|
||||
// show new bootstrap method (if available)
|
||||
if ($passwordModal.length !== 0) {
|
||||
$passwordModal.modal({
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
});
|
||||
$passwordModal.modal('show');
|
||||
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip.VERSION) {
|
||||
(new bootstrap.Modal($passwordModal[0]), {
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
}).show();
|
||||
} else {
|
||||
$passwordModal.modal({
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
});
|
||||
$passwordModal.modal('show');
|
||||
}
|
||||
// focus password input
|
||||
$passwordDecrypt.focus();
|
||||
// then re-focus it, when modal causes it to loose focus again
|
||||
|
@ -2393,6 +2408,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
$messageEditParent,
|
||||
$messagePreview,
|
||||
$messagePreviewParent,
|
||||
$messageTab,
|
||||
$messageTabParent,
|
||||
$message,
|
||||
isPreview = false,
|
||||
isTabSupported = true;
|
||||
|
@ -2410,7 +2427,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
// support disabling tab support using [Esc] and [Ctrl]+[m]
|
||||
if (event.key === 'Escape' || (event.ctrlKey && event.key === 'm')) {
|
||||
toggleTabSupport();
|
||||
document.getElementById('message-tab').checked = isTabSupported;
|
||||
$messageTab[0].checked = isTabSupported;
|
||||
event.preventDefault();
|
||||
}
|
||||
// tab was pressed
|
||||
|
@ -2462,6 +2479,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
|
||||
// reshow input
|
||||
$message.removeClass('hidden');
|
||||
$messageTabParent.removeClass('hidden');
|
||||
|
||||
me.focusInput();
|
||||
|
||||
|
@ -2494,6 +2512,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
|
||||
// hide input as now preview is shown
|
||||
$message.addClass('hidden');
|
||||
$messageTabParent.addClass('hidden');
|
||||
|
||||
// show preview
|
||||
PasteViewer.setText($message.val());
|
||||
|
@ -2552,6 +2571,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
me.show = function()
|
||||
{
|
||||
$message.removeClass('hidden');
|
||||
$messageTabParent.removeClass('hidden');
|
||||
$editorTabs.removeClass('hidden');
|
||||
};
|
||||
|
||||
|
@ -2564,6 +2584,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
me.hide = function()
|
||||
{
|
||||
$message.addClass('hidden');
|
||||
$messageTabParent.addClass('hidden');
|
||||
$editorTabs.addClass('hidden');
|
||||
};
|
||||
|
||||
|
@ -2603,7 +2624,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
};
|
||||
|
||||
/**
|
||||
* init status manager
|
||||
* init editor
|
||||
*
|
||||
* preloads jQuery elements
|
||||
*
|
||||
|
@ -2614,10 +2635,12 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
{
|
||||
$editorTabs = $('#editorTabs');
|
||||
$message = $('#message');
|
||||
$messageTab = $('#messagetab');
|
||||
$messageTabParent = $messageTab.parent();
|
||||
|
||||
// bind events
|
||||
$message.keydown(supportTabs);
|
||||
$('#message-tab').change(toggleTabSupport);
|
||||
$messageTab.change(toggleTabSupport);
|
||||
|
||||
// bind click events to tab switchers (a), and save parents (li)
|
||||
$messageEdit = $('#messageedit').click(viewEditor);
|
||||
|
@ -2638,7 +2661,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
const PasteViewer = (function () {
|
||||
const me = {};
|
||||
|
||||
let $placeholder,
|
||||
let $messageTabParent,
|
||||
$placeholder,
|
||||
$prettyMessage,
|
||||
$prettyPrint,
|
||||
$plainText,
|
||||
|
@ -2718,6 +2742,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
}
|
||||
// otherwise hide the placeholder
|
||||
$placeholder.addClass('hidden');
|
||||
$messageTabParent.addClass('hidden');
|
||||
|
||||
if (format === 'markdown') {
|
||||
$plainText.removeClass('hidden');
|
||||
|
@ -2856,6 +2881,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
*/
|
||||
me.init = function()
|
||||
{
|
||||
$messageTabParent = $('#messagetab').parent();
|
||||
$placeholder = $('#placeholder');
|
||||
$plainText = $('#plaintext');
|
||||
$prettyMessage = $('#prettymessage');
|
||||
|
@ -3960,8 +3986,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
});
|
||||
$('#qrcode-display').html(qrCanvas);
|
||||
// only necessary for bootstrap 5, other templates won't have this
|
||||
if (bootstrap.Tooltip.VERSION) {
|
||||
$('#qrcodemodal').modal('show');
|
||||
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip.VERSION) {
|
||||
(new bootstrap.Modal('#qrcodemodal')).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4054,7 +4080,11 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
$emailconfirmTimezoneCurrent.off('click.sendEmailCurrentTimezone');
|
||||
$emailconfirmTimezoneCurrent.on('click.sendEmailCurrentTimezone', () => {
|
||||
const emailBody = templateEmailBody(expirationDateRoundedToSecond.toLocaleString(), isBurnafterreading);
|
||||
$emailconfirmmodal.modal('hide');
|
||||
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip.VERSION) {
|
||||
(new bootstrap.Modal($emailconfirmmodal[0])).hide();
|
||||
} else {
|
||||
$emailconfirmmodal.modal('hide');
|
||||
}
|
||||
triggerEmailSend(emailBody);
|
||||
});
|
||||
$emailconfirmTimezoneUtc.off('click.sendEmailUtcTimezone');
|
||||
|
@ -4064,10 +4094,18 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
// we don't use Date.prototype.toUTCString() because we would like to avoid GMT
|
||||
{ timeZone: 'UTC', dateStyle: 'long', timeStyle: 'long' }
|
||||
), isBurnafterreading);
|
||||
$emailconfirmmodal.modal('hide');
|
||||
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip.VERSION) {
|
||||
(new bootstrap.Modal($emailconfirmmodal[0])).hide();
|
||||
} else {
|
||||
$emailconfirmmodal.modal('hide');
|
||||
}
|
||||
triggerEmailSend(emailBody);
|
||||
});
|
||||
$emailconfirmmodal.modal('show');
|
||||
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip.VERSION) {
|
||||
(new bootstrap.Modal($emailconfirmmodal[0])).show();
|
||||
} else {
|
||||
$emailconfirmmodal.modal('show');
|
||||
}
|
||||
} else {
|
||||
triggerEmailSend(templateEmailBody(null, isBurnafterreading));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue