]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/dispy/jot-header.tpl
Merge pull request #45 from annando/master
[friendica.git] / view / theme / dispy / jot-header.tpl
old mode 100644 (file)
new mode 100755 (executable)
index 1555950..8dccf71
@@ -8,6 +8,34 @@ var textlen = 0;
 function initEditor(cb) {
     if (editor==false) {
         $("#profile-jot-text-loading").show();
+               $("#jot-title-desc").show();
+ if(plaintext == 'none') {
+            $("#profile-jot-text-loading").hide();
+            $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
+            $(".jothidden").show();
+            editor = true;
+            $("a#jot-perms-icon").fancybox({
+                'transitionIn' : 'elastic',
+                'transitionOut' : 'elastic'
+            });
+                                   $("#profile-jot-submit-wrapper").show();
+                                                               {{ if $newpost }}
+                                   $("#profile-upload-wrapper").show();
+                                       $("#profile-attach-wrapper").show();
+                                   $("#profile-link-wrapper").show();
+                                       $("#profile-video-wrapper").show();
+                                   $("#profile-audio-wrapper").show();
+                                       $("#profile-location-wrapper").show();
+                                   $("#profile-nolocation-wrapper").show();
+                                       $("#profile-title-wrapper").show();
+                                       $("#profile-jot-plugin-wrapper").show();
+                                       $("#jot-preview-link").show();
+                                                               {{ endif }}   
+
+
+            if (typeof cb!="undefined") cb();
+            return;
+        }
         tinyMCE.init({
                 theme : "advanced",
                 mode : "specific_textareas",
@@ -90,7 +118,7 @@ function initEditor(cb) {
     }
 } // initEditor
 </script>
-<script type="text/javascript" src="include/ajaxupload.js" ></script>
+<script type="text/javascript" src="js/ajaxupload.js" ></script>
 <script>
     var ispublic = '$ispublic';
        $(document).ready(function() {
@@ -100,13 +128,38 @@ function initEditor(cb) {
                     $(this).val("");
                     initEditor();
                 }); 
+
+               $("#jot-title").mouseout(function() {
+                       $("#jot-title").hide();
+                       var ttl = $("#jot-title").val();
+                       $('#jot-title-display').html(ttl);
+                       if(ttl.length) {
+                               $("#jot-title-display").show();
+                       }
+                       else {
+                               $("#jot-title-desc").show();
+                       }
+               });
+
+               $("#jot-title-display").hover(function() {
+                       $("#jot-title-display").hide();
+                       $("#jot-title").show();
+                       $("#jot-title").focus();
+               });             
+
+               $("#jot-title-desc").click(function() {
+                       $("#jot-title-desc").hide();
+                       $("#jot-title").show();
+                       $("#jot-title").focus();
+               });             
+
                var uploader = new window.AjaxUpload(
                        'wall-image-upload',
                        { action: 'wall_upload/$nickname',
                                name: 'userfile',
                                onSubmit: function(file,ext) { $('#profile-rotator').show(); },
                                onComplete: function(file,response) {
-                                       tinyMCE.execCommand('mceInsertRawHTML',false,response);
+                                       addeditortext(response);
                                        $('#profile-rotator').hide();
                                }                                
                        }
@@ -117,7 +170,7 @@ function initEditor(cb) {
                                name: 'userfile',
                                onSubmit: function(file,ext) { $('#profile-rotator').show(); },
                                onComplete: function(file,response) {
-                                       tinyMCE.execCommand('mceInsertRawHTML',false,response);
+                                       addeditortext(response);
                                        $('#profile-rotator').hide();
                                }                                
                        }
@@ -163,8 +216,8 @@ function initEditor(cb) {
                if(reply && reply.length) {
                        reply = bin2hex(reply);
                        $('#profile-rotator').show();
-                       $.get('parse_url?url=' + reply, function(data) {
-                               tinyMCE.execCommand('mceInsertRawHTML',false,data);
+                       $.get('parse_url?binurl=' + reply, function(data) {
+                               addeditortext(data);
                                $('#profile-rotator').hide();
                        });
                }
@@ -173,21 +226,21 @@ function initEditor(cb) {
        function jotGetVideo() {
                reply = prompt("$utubeurl");
                if(reply && reply.length) {
-                       tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]');
+                       addeditortext('[youtube]' + reply + '[/youtube]');
                }
        }
 
        function jotVideoURL() {
                reply = prompt("$vidurl");
                if(reply && reply.length) {
-                       tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]');
+                       addeditortext('[video]' + reply + '[/video]');
                }
        }
 
        function jotAudioURL() {
                reply = prompt("$audurl");
                if(reply && reply.length) {
-                       tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]');
+                       addeditortext('[audio]' + reply + '[/audio]');
                }
        }
 
@@ -211,7 +264,7 @@ function initEditor(cb) {
                $.get('share/' + id, function(data) {
                                if (!editor) $("#profile-jot-text").val("");
                                initEditor(function(){
-                                       tinyMCE.execCommand('mceInsertRawHTML',false,data);
+                                       addeditortext(data);
                                        $('#like-rotator-' + id).hide();
                                        $(window).scrollTop(0);
                                });
@@ -229,11 +282,12 @@ function initEditor(cb) {
                event.target.textContent = reply;
                event.preventDefault();
                if(reply && reply.length) {
+                       reply = bin2hex(reply);
                        $('#profile-rotator').show();
-                       $.get('parse_url?url=' + reply, function(data) {
+                       $.get('parse_url?binurl=' + reply, function(data) {
                                if (!editor) $("#profile-jot-text").val("");
                                initEditor(function(){
-                                       tinyMCE.execCommand('mceInsertRawHTML',false,data);
+                                       addeditortext(data);
                                        $('#profile-rotator').hide();
                                });
                        });
@@ -245,6 +299,15 @@ function initEditor(cb) {
                $('#profile-nolocation-wrapper').hide();
        }
 
+  function addeditortext(data) {
+        if(plaintext == 'none') {
+            var currentText = $("#profile-jot-text").val();
+            $("#profile-jot-text").val(currentText + data);
+        }
+        else
+            tinyMCE.execCommand('mceInsertRawHTML',false,data);
+    }
+
        $geotag
 
 </script>