Remove proxy

Also I kept care to (fix?) the focus of the password input. It only works in an
anonymous function for some reason.
This commit is contained in:
rugk 2017-02-08 13:54:37 +01:00
parent 2ebcf60516
commit 4e86da8f72
No known key found for this signature in database
GPG Key ID: 05D40A636AFAB34D
1 changed files with 25 additions and 22 deletions

View File

@ -952,7 +952,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
{ {
$place = $(cname); $place = $(cname);
} }
divComment.find('button').click({commentid: comment.id}, $.proxy(me.openReply, me)); divComment.find('button').click({commentid: comment.id}, me.openReply);
helper.setElementText(divCommentData, commenttext); helper.setElementText(divCommentData, commenttext);
helper.urls2links(divCommentData); helper.urls2links(divCommentData);
@ -986,7 +986,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
'<div class="comment"><button class="btn btn-default btn-sm">' + '<div class="comment"><button class="btn btn-default btn-sm">' +
i18n._('Add comment') + '</button></div>' i18n._('Add comment') + '</button></div>'
); );
divComment.find('button').click({commentid: helper.pasteId()}, $.proxy(me.openReply, me)); divComment.find('button').click({commentid: helper.pasteId()}, me.openReply);
$comments.append(divComment); $comments.append(divComment);
$discussion.removeClass('hidden'); $discussion.removeClass('hidden');
} }
@ -1020,7 +1020,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
); );
reply.find('button').click( reply.find('button').click(
{parentid: commentid}, {parentid: commentid},
$.proxy(me.sendComment, me) me.sendComment
); );
source.after(reply); source.after(reply);
$replyStatus = $('#replystatus'); $replyStatus = $('#replystatus');
@ -1240,11 +1240,11 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
// save newly created element // save newly created element
$pasteUrl = $('#pasteurl'); $pasteUrl = $('#pasteurl');
// and add click event // and add click event
$pasteUrl.click($.proxy(me.pasteLinkClick, me)); $pasteUrl.click(me.pasteLinkClick);
var shortenButton = $('#shortenbutton'); var shortenButton = $('#shortenbutton');
if (shortenButton) { if (shortenButton) {
shortenButton.click($.proxy(me.sendToShortener, me)); shortenButton.click(me.sendToShortener);
} }
$('#deletelink').html('<a href="' + deleteUrl + '">' + i18n._('Delete data') + '</a>'); $('#deletelink').html('<a href="' + deleteUrl + '">' + i18n._('Delete data') + '</a>');
$pasteResult.removeClass('hidden'); $pasteResult.removeClass('hidden');
@ -1830,31 +1830,34 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
*/ */
function bindEvents() function bindEvents()
{ {
$burnAfterReading.change($.proxy(me.changeBurnAfterReading, me)); $burnAfterReading.change(me.changeBurnAfterReading);
$openDisc.change($.proxy(me.changeOpenDisc, me)); $openDisc.change(me.changeOpenDisc);
$sendButton.click($.proxy(me.sendData, me)); $sendButton.click(me.sendData);
$cloneButton.click($.proxy(me.clonePaste, me)); $cloneButton.click(me.clonePaste);
$rawTextButton.click($.proxy(me.rawText, me)); $rawTextButton.click(me.rawText);
$fileRemoveButton.click($.proxy(me.removeAttachment, me)); $fileRemoveButton.click(me.removeAttachment);
$('.reloadlink').click($.proxy(me.reloadPage, me)); $('.reloadlink').click(me.reloadPage);
$message.keydown(me.supportTabs); $message.keydown(me.supportTabs);
$messageEdit.click($.proxy(me.viewEditor, me)); $messageEdit.click(me.viewEditor);
$messagePreview.click($.proxy(me.viewPreview, me)); $messagePreview.click(me.viewPreview);
// bootstrap template drop downs // bootstrap template drop downs
$('ul.dropdown-menu li a', $('#expiration').parent()).click($.proxy(me.setExpiration, me)); $('ul.dropdown-menu li a', $('#expiration').parent()).click(me.setExpiration);
$('ul.dropdown-menu li a', $('#formatter').parent()).click($.proxy(me.setFormat, me)); $('ul.dropdown-menu li a', $('#formatter').parent()).click(me.setFormat);
$('#language ul.dropdown-menu li a').click($.proxy(me.setLanguage, me)); $('#language ul.dropdown-menu li a').click(me.setLanguage);
// page template drop down // page template drop down
$('#language select option').click($.proxy(me.setLanguage, me)); $('#language select option').click(me.setLanguage);
// focus password input when it is shown
$passwordModal.on('shown.bs.modal', function () {
$passwordDecrypt.focus();
});
// handle modal password request on decryption // handle modal password request on decryption
$passwordModal.on('shown.bs.modal', $.proxy($passwordDecrypt.focus, me)); $passwordModal.on('hidden.bs.modal', me.decryptPasswordModal);
$passwordModal.on('hidden.bs.modal', $.proxy(me.decryptPasswordModal, me)); $passwordForm.submit(me.submitPasswordModal);
$passwordForm.submit($.proxy(me.submitPasswordModal, me));
$(window).on('popstate', $.proxy(me.historyChange, me)); $(window).on('popstate', me.historyChange);
}; };
/** /**