]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frio/templates/jot-header.tpl
Avoid memory issue in exception
[friendica.git] / view / theme / frio / templates / jot-header.tpl
index 6aad9889d1a0822f7b5d94a46bada87282cf1277..ac59caed8e16dd18ff32052ce925088d41caed70 100644 (file)
@@ -1,5 +1,7 @@
 
-<script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
+<script type="text/javascript" src="{{$baseurl}}/view/js/ajaxupload.js"></script>
+<script type="text/javascript" src="{{$baseurl}}/view/js/linkPreview.js"></script>
+<script type="text/javascript" src="{{$baseurl}}/view/theme/frio/js/jot.js"></script>
 
 <script type="text/javascript">
        var editor = false;
@@ -39,6 +41,7 @@
 
 <script type="text/javascript">
        var ispublic = '{{$ispublic}}';
+       aStr.linkurl = '{{$linkurl}}';
 
 
        $(document).ready(function() {
                }
        }
 
-       function jotGetLink() {
-               reply = prompt("{{$linkurl}}");
-               if(reply && reply.length) {
-                       reply = bin2hex(reply);
-                       $('#profile-rotator').show();
-                       $.get('parse_url?binurl=' + reply, function(data) {
-                               addeditortext(data);
-                               $('#profile-rotator').hide();
-                       });
-               }
-       }
-
        function jotVideoURL() {
                reply = prompt("{{$vidurl}}");
                if(reply && reply.length) {
                }
        }
 
-
        function jotGetLocation() {
                reply = prompt("{{$whereareu}}", $('#jot-location').val());
                if(reply && reply.length) {
                $("#jot-popup").show();
        }
 
-       function linkdropper(event) {
+       function linkDropper(event) {
                var linkFound = event.dataTransfer.types.contains("text/uri-list");
                if(linkFound)
                        event.preventDefault();
        }
 
-       function linkdrop(event) {
+       function linkDrop(event) {
                var reply = event.dataTransfer.getData("text/uri-list");
+               var noAttachment = '';
                event.target.textContent = reply;
                event.preventDefault();
                if(reply && reply.length) {
                        reply = bin2hex(reply);
                        $('#profile-rotator').show();
-                       $.get('parse_url?binurl=' + reply, function(data) {
+                       if (currentText.includes("[attachment") && currentText.includes("[/attachment]")) {
+                               noAttachment = '&noAttachment=1';
+                       }
+                       $.get('parse_url?binurl=' + reply + noAttachment, function(data) {
                                if (!editor) $("#profile-jot-text").val("");
                                initEditor(function(){
                                        addeditortext(data);
                                        $('#profile-rotator').hide();
                                });
                        });
+                       autosize.update($("#profile-jot-text"));
                }
        }
 
        }
 
        function itemFiler(id) {
-
                var bordercolor = $("input").css("border-color");
 
                $.get('filer/', function(data){
                var currentText = $("#profile-jot-text").val();
                //insert the data as new value
                textfield.value = currentText + data;
+               autosize.update($("#profile-jot-text"));
        }
 
-       {{$geotag}}
+       {{$geotag nofilter}}
 
        function jotShow() {
                var modal = $('#jot-modal').modal();
                        .find('#jot-modal-content')
                        .append(jotcache)
                        .modal.show;
-       }
 
-       // the following functions show/hide the specific jot content
-       // in dependence of the selected nav
-       function aclActive() {
-               $(".modal-body #profile-jot-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").addClass("minimize");
-               $(".modal-body #profile-jot-acl-wrapper").removeClass("minimize");
-       }
-
-
-       function previewActive() {
-               $(".modal-body #profile-jot-wrapper, .modal-body #profile-jot-acl-wrapper,.modal-body #jot-fbrowser-wrapper").addClass("minimize");
-               var postPreview = preview_post();
-               if (postPreview && typeof postPreview !== "undefined") {
-                       $(".modal-body #jot-preview-content").removeClass("minimize");
-               }
+               // Jot attachment live preview.
+               linkPreview = $('#profile-jot-text').linkPreview();
        }
 
+       // Activate the jot text section in the jot modal
        function jotActive() {
-               $(".modal-body #profile-jot-acl-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").addClass("minimize");
-               $(".modal-body #profile-jot-wrapper").removeClass("minimize");
-
-               //make sure jot text does have really the active class (we do this because there are some
-               // other events which trigger jot text
-               toggleJotNav($("#jot-modal .jot-nav #jot-text-lnk"));
-       }
-
-       function fbrowserActive() {
-               $(".modal-body #profile-jot-wrapper, .modal-body #jot-preview-content, .modal-body #profile-jot-acl-wrapper").addClass("minimize");
-
-               $(".modal-body #jot-fbrowser-wrapper").removeClass("minimize");
-
-               $(function() {Dialog.showJot();});
+               // Make sure jot text does have really the active class (we do this because there are some
+               // other events which trigger jot text (we need to do this for the desktop and mobile
+               // jot nav
+               var elem = $("#jot-modal .jot-nav #jot-text-lnk");
+               var elemMobile = $("#jot-modal .jot-nav #jot-text-lnk-mobile")
+               toggleJotNav(elem[0]);
+               toggleJotNav(elemMobile[0]);
        }
-
-
 </script>
-