aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js/main.js')
-rw-r--r--view/js/main.js28
1 files changed, 19 insertions, 9 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 560868046..3dae45cff 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -56,7 +56,7 @@ $.ajaxSetup({cache: false});
$(document).ready(function() {
- $(document).on('click focus', '.comment-edit-form', handle_comment_form);
+ $(document).on('click', '.comment-edit-form', handle_comment_form);
$(document).on('click', '.conversation-settings-link', getConversationSettings);
$(document).on('click', '#settings_module_ajax_submit', postConversationSettings);
@@ -95,7 +95,6 @@ $(document).ready(function() {
jQuery.timeago.settings.allowFuture = true;
-
if(sse_enabled) {
if(typeof(window.SharedWorker) === 'undefined') {
// notifications with multiple tabs open will not work very well in this scenario
@@ -244,8 +243,6 @@ $(document).ready(function() {
cache_next_page();
});
-
-
});
function getConversationSettings() {
@@ -325,7 +322,8 @@ function handle_comment_form(e) {
}
// handle click outside of form (close empty forms)
- $(document).on('click', function(e) {
+ $(document).one('click', function(e) {
+
fields.each(function() {
if($(this).val() != '')
fields_empty = false;
@@ -344,23 +342,30 @@ function handle_comment_form(e) {
form.find(':button[type=submit]').prop('title', '');
}
});
-
+
var commentSaveTimer = null;
var emptyCommentElm = form.find('.comment-edit-text').attr('id');
var convId = emptyCommentElm.replace('comment-edit-text-','');
- $(document).on('focusout','#' + emptyCommentElm,function(e){
+ $('#' + emptyCommentElm).on('focusout',function(e){
if(commentSaveTimer)
clearTimeout(commentSaveTimer);
commentSaveChanges(convId,true);
commentSaveTimer = null;
+ $('#' + emptyCommentElm).off();
});
- $(document).on('focusin','#' + emptyCommentElm,function(e){
+ $('#' + emptyCommentElm).on('focusin', function (e){
commentSaveTimer = setTimeout(function () {
commentSaveChanges(convId,false);
},10000);
});
+ $('#' + emptyCommentElm).on('keydown', function (e) {
+ if (e.ctrlKey && e.keyCode === 13) {
+ post_comment(convId);
+ }
+ });
+
function commentSaveChanges(convId, isFinal) {
if(typeof isFinal === 'undefined')
@@ -379,8 +384,11 @@ function handle_comment_form(e) {
}
}
}
+
}
+
+
function commentClose(obj, id) {
if(obj.value === '') {
obj.value = aStr.comment;
@@ -1414,7 +1422,7 @@ function post_comment(id) {
$(document).unbind( "click.commentOpen");
}
if(timer) clearTimeout(timer);
- timer = setTimeout(updateInit,1500);
+ timer = setTimeout(updateInit, 500);
}
if(data.reload) {
window.location.href=data.reload;
@@ -1425,6 +1433,8 @@ function post_comment(id) {
return false;
}
+
+
function preview_comment(id) {
$("#comment-preview-inp-" + id).val("1");
$("#comment-edit-preview-" + id).show();