]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frio/templates/jot-header.tpl
Merge develop into 0308-Notifications-restructure
[friendica.git] / view / theme / frio / templates / jot-header.tpl
index 5b826f45e2f41d06e59dedb098ff9f12de4b3578..7c8d502de6c82b29ed189751183fc54cb7c337bd 100644 (file)
@@ -127,7 +127,7 @@ function initEditor(cb){
 
 function enableOnUser(){
        if (editor) return;
-       $(this).val("");
+       //$(this).val("");
        initEditor();
 }
 
@@ -146,7 +146,11 @@ function enableOnUser(){
                $("#profile-jot-text").focus(enableOnUser);
                $("#profile-jot-text").click(enableOnUser);
 
-
+               // When clicking on a forum in acl we should remove the profile jot textarea
+               // default value before inserting the forum mention
+               $("body").on('click', '#jot-modal .acl-list-item.forum', function(){
+                       jotTextOpenUI(document.getElementById("profile-jot-text"));
+               });
 
 
                /* show images / file browser window
@@ -283,23 +287,11 @@ function enableOnUser(){
        }
 
        function jotShare(id) {
-//             if ($('#jot-popup').length != 0) $('#jot-popup').show();
-//
-//             $('#like-rotator-' + id).show();
-//             $.get('share/' + id, function(data) {
-//                     if (!editor) $("#profile-jot-text").val("");
-//                     initEditor(function(){
-//                             addeditortext(data);
-//                             $('#like-rotator-' + id).hide();
-//                             $(window).scrollTop(0);
-//                     });
-//
-//             });
-
                $.get('share/' + id, function(data) {
-                       if (!editor) $("#profile-jot-text").val("");
+                       // remove the former content of the text input
+                       $("#profile-jot-text").val("");
                        initEditor(function(){
-                       addeditortext(data);
+                               addeditortext(data);
                        });
                });
 
@@ -388,8 +380,14 @@ function enableOnUser(){
 
        function addeditortext(data) {
                if(plaintext == 'none') {
+                       // get the textfield
+                       var textfield = document.getElementById("profile-jot-text");
+                       // check if the textfield does have the default-value
+                       jotTextOpenUI(textfield);
+                       // save already existent content
                        var currentText = $("#profile-jot-text").val();
-                       $("#profile-jot-text").val(currentText + data);
+                       //insert the data as new value
+                       textfield.value = currentText + data;
                }
                else
                        tinyMCE.execCommand('mceInsertRawHTML',false,data);
@@ -399,20 +397,12 @@ function enableOnUser(){
 
        function jotShow() {
                var modal = $('#jot-modal').modal();
-               var jot = $("#profile-jot-form");
-
-               // Clear bs modal on close
-               // We need this to prevent that the modal displays old content
-               $('body').on('hidden.bs.modal', '#jot-modal', function () {
-                       $(this).removeData('bs.modal');
-                       $("#jot-content").append(jot);
-               });
+               jotcache = $("#profile-jot-form");
 
                modal
-                       .find('#jot-modal-body')
-                       .append(jot)
-                       .modal.show
-                       ;
+                       .find('#jot-modal-content')
+                       .append(jotcache)
+                       .modal.show;
        }
 
        // the following functions show/hide the specific jot content 
@@ -445,5 +435,6 @@ function enableOnUser(){
                $(function() {Dialog.showJot();});
        }
 
+
 </script>