]> git.mxchange.org Git - friendica.git/blobdiff - view/js/main.js
Merge pull request #9711 from MrPetovan/bug/fatal-errors
[friendica.git] / view / js / main.js
index b523ce6e70f43af10b9004537ce7958306719542..a0ffea3718222a8aef9664f0f18eb9a13b92e86d 100644 (file)
@@ -175,6 +175,17 @@ $(function() {
                $(textarea).trigger('change');
        });
 
+       $(".comment-edit-wrapper textarea, .wall-item-comment-wrapper textarea")
+               .editor_autocomplete(baseurl + '/search/acl')
+               .bbco_autocomplete('bbcode');
+
+       // Ensures asynchronously-added comment forms recognize mentions, tags and BBCodes as well
+       document.addEventListener("postprocess_liveupdate", function() {
+               $(".comment-edit-wrapper textarea, .wall-item-comment-wrapper textarea")
+                       .editor_autocomplete(baseurl + '/search/acl')
+                       .bbco_autocomplete('bbcode');
+       });
+
        /* popup menus */
        function close_last_popup_menu() {
                if (last_popup_menu) {
@@ -568,10 +579,6 @@ function updateConvItems(data) {
                commentBusy = false;
                $('body').css('cursor', 'auto');
        }
-       /* autocomplete @nicknames */
-       $(".comment-edit-form  textarea").editor_autocomplete(baseurl + '/search/acl');
-       /* autocomplete bbcode */
-       $(".comment-edit-form  textarea").bbco_autocomplete('bbcode');
 }
 
 function liveUpdate(src) {
@@ -620,6 +627,10 @@ function liveUpdate(src) {
                in_progress = false;
                update_item = 0;
 
+               if ($('.wall-item-body', data).length == 0) {
+                       return;
+               }
+
                $('.wall-item-body', data).imagesLoaded(function() {
                        updateConvItems(data);
 
@@ -889,16 +900,29 @@ function loadScrollContent() {
 
        // get the raw content from the next page and insert this content
        // right before "#conversation-end"
-       $.get(infinite_scroll.reload_uri + '&mode=raw&last_received=' + received + '&last_commented=' + commented + '&last_created=' + created + '&last_uriid=' + uriid, function(data) {
+       $.get({
+               url: infinite_scroll.reload_uri,
+               data: {
+                       'mode'          : 'raw',
+                       'last_received' : received,
+                       'last_commented': commented,
+                       'last_created'  : created,
+                       'last_uriid'    : uriid
+               }
+       })
+       .done(function(data) {
                $("#scroll-loader").hide();
                if ($(data).length > 0) {
                        $(data).insertBefore('#conversation-end');
-                       lockLoadContent = false;
                } else {
                        $("#scroll-end").fadeIn('normal');
                }
 
                document.dispatchEvent(new Event('postprocess_liveupdate'));
+       })
+       .always(function () {
+               $("#scroll-loader").hide();
+               lockLoadContent = false;
        });
 }