|
@@ -3446,6 +3446,8 @@ window.PrivateBin = (function () {
|
|
|
|
|
|
|
|
// cache elements
|
|
// cache elements
|
|
|
commentTail = Model.getTemplate('commenttail');
|
|
commentTail = Model.getTemplate('commenttail');
|
|
|
|
|
+
|
|
|
|
|
+ addEventListeners();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -3607,7 +3609,9 @@ window.PrivateBin = (function () {
|
|
|
*/
|
|
*/
|
|
|
me.finishDiscussion = function () {
|
|
me.finishDiscussion = function () {
|
|
|
// add 'add new comment' area
|
|
// add 'add new comment' area
|
|
|
- commentContainer.appendChild(commentTail);
|
|
|
|
|
|
|
+ commentContainer.appendChild(commentTail.cloneNode(true));
|
|
|
|
|
+
|
|
|
|
|
+ addEventListeners();
|
|
|
|
|
|
|
|
// show discussions
|
|
// show discussions
|
|
|
discussion.classList.remove('hidden');
|
|
discussion.classList.remove('hidden');
|
|
@@ -3692,6 +3696,21 @@ window.PrivateBin = (function () {
|
|
|
UiHelper.scrollTo(comment, 100, 'swing', highlightComment);
|
|
UiHelper.scrollTo(comment, 100, 'swing', highlightComment);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Binds events to templates (**and** all )
|
|
|
|
|
+ */
|
|
|
|
|
+ function addEventListeners() {
|
|
|
|
|
+ //
|
|
|
|
|
+ document.querySelectorAll('#commenttail button')
|
|
|
|
|
+ .forEach(btn => btn.addEventListener('click', openReply));
|
|
|
|
|
+
|
|
|
|
|
+ document.querySelectorAll('#comment button')
|
|
|
|
|
+ .forEach(btn => btn.addEventListener('click', openReply));
|
|
|
|
|
+
|
|
|
|
|
+ document.querySelectorAll('#reply button, #reply #replybutton')
|
|
|
|
|
+ .forEach(btn => btn.addEventListener('click', PasteEncrypter.sendComment));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* initiate
|
|
* initiate
|
|
|
*
|
|
*
|
|
@@ -3701,19 +3720,8 @@ window.PrivateBin = (function () {
|
|
|
* @function
|
|
* @function
|
|
|
*/
|
|
*/
|
|
|
me.init = function () {
|
|
me.init = function () {
|
|
|
- // bind events to templates (so they are later cloned)
|
|
|
|
|
- const commentTailTemplate = document.getElementById('commenttailtemplate');
|
|
|
|
|
- if (commentTailTemplate) {
|
|
|
|
|
- commentTailTemplate.querySelectorAll('button').forEach(btn => btn.addEventListener('click', openReply));
|
|
|
|
|
- }
|
|
|
|
|
- const commentTemplate = document.getElementById('commenttemplate');
|
|
|
|
|
- if (commentTemplate) {
|
|
|
|
|
- commentTemplate.querySelectorAll('button').forEach(btn => btn.addEventListener('click', openReply));
|
|
|
|
|
- }
|
|
|
|
|
- const replyTemplate = document.getElementById('replytemplate');
|
|
|
|
|
- if (replyTemplate) {
|
|
|
|
|
- replyTemplate.querySelectorAll('button').forEach(btn => btn.addEventListener('click', PasteEncrypter.sendComment));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // todo: remove
|
|
|
|
|
+ addEventListeners();
|
|
|
|
|
|
|
|
commentContainer = document.getElementById('commentcontainer');
|
|
commentContainer = document.getElementById('commentcontainer');
|
|
|
discussion = document.getElementById('discussion');
|
|
discussion = document.getElementById('discussion');
|
|
@@ -5433,12 +5441,12 @@ window.PrivateBin = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener(I18n.languageLoadedEvent, function () {
|
|
document.addEventListener(I18n.languageLoadedEvent, function () {
|
|
|
- const comentContainer = document.getElementById('commentcontainer');
|
|
|
|
|
- if (!comentContainer) {
|
|
|
|
|
|
|
+ const commentContainer = document.getElementById('commentcontainer');
|
|
|
|
|
+ if (!commentContainer) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- comentContainer.querySelectorAll('img.vizhash')
|
|
|
|
|
|
|
+ commentContainer.querySelectorAll('img.vizhash')
|
|
|
.forEach(img => img.setAttribute('title', I18n._('Avatar generated from IP address')));
|
|
.forEach(img => img.setAttribute('title', I18n._('Avatar generated from IP address')));
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -6088,3 +6096,5 @@ window.addEventListener('DOMContentLoaded', function () {
|
|
|
// run main controller
|
|
// run main controller
|
|
|
window.PrivateBin.Controller.init();
|
|
window.PrivateBin.Controller.init();
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+
|