]> git.mxchange.org Git - friendica.git/blobdiff - view/jot-header.tpl
bug #96 move libraries to library - better alignment of like rotator
[friendica.git] / view / jot-header.tpl
index 774b37c8603653a08712b8b35303394bd76ab108..d7a429512582d8b9a4b786edd6703709a6caf8ec 100644 (file)
@@ -1,8 +1,9 @@
 
-<script language="javascript" type="text/javascript" src="$baseurl/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
+<script language="javascript" type="text/javascript" src="$baseurl/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
 <script language="javascript" type="text/javascript">
 
 var editor;
+var textlen = 0;
 
 tinyMCE.init({
        theme : "advanced",
@@ -29,23 +30,30 @@ tinyMCE.init({
             //Character count
                ed.onKeyUp.add(function(ed, e) {
                        var txt = tinyMCE.activeEditor.getContent();
-                       var text = txt.length;
-                       if(txt.length <= 140) {
+                       textlen = txt.length;
+                       if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
+                               $('#profile-jot-desc').html(ispublic);
+                       }
+                       else {
+                               $('#profile-jot-desc').html('&nbsp;');
+                       }        
+
+                       if(textlen <= 140) {
                                $('#character-counter').removeClass('red');
                                $('#character-counter').removeClass('orange');
                                $('#character-counter').addClass('grey');
                        }
-                       if((txt.length > 140) && (txt .length <= 420)) {
+                       if((textlen > 140) && (textlen <= 420)) {
                                $('#character-counter').removeClass('grey');
                                $('#character-counter').removeClass('red');
                                $('#character-counter').addClass('orange');
                        }
-                       if(txt.length > 420) {
+                       if(textlen > 420) {
                                $('#character-counter').removeClass('grey');
                                $('#character-counter').removeClass('orange');
                                $('#character-counter').addClass('red');
                        }
-                       $('#character-counter').text(text);
+                       $('#character-counter').text(textlen);
        });
 
                ed.onInit.add(function(ed) {
@@ -58,6 +66,7 @@ tinyMCE.init({
 </script>
 <script type="text/javascript" src="include/ajaxupload.js" ></script>
 <script>
+       var ispublic = '$ispublic';
        $(document).ready(function() {
                var uploader = new window.AjaxUpload(
                        'wall-image-upload',
@@ -70,15 +79,29 @@ tinyMCE.init({
                                }                                
                        }
                );
+               var file_uploader = new window.AjaxUpload(
+                       'wall-file-upload',
+                       { action: 'wall_attach/$nickname',
+                               name: 'userfile',
+                               onSubmit: function(file,ext) { $('#profile-rotator').show(); },
+                               onComplete: function(file,response) {
+                                       tinyMCE.execCommand('mceInsertRawHTML',false,response);
+                                       $('#profile-rotator').hide();
+                               }                                
+                       }
+               );
+
                $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
                        var selstr;
                        $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
                                selstr = $(this).text();
-                               $('#profile-jot-perms img').attr('src', 'images/lock_icon.gif');
+                               $('#jot-perms-icon').removeClass('unlock').addClass('lock');
+                               $('#jot-public').hide();
                                $('.profile-jot-net input').attr('disabled', 'disabled');
                        });
                        if(selstr == null) { 
-                               $('#profile-jot-perms img').attr('src', 'images/unlock_icon.gif');
+                               $('#jot-perms-icon').removeClass('lock').addClass('unlock');
+                               $('#jot-public').show();
                                $('.profile-jot-net input').attr('disabled', false);
                        }
 
@@ -86,9 +109,28 @@ tinyMCE.init({
 
        });
 
+       function deleteCheckedItems() {
+               var checkedstr = '';
+
+               $('.item-select').each( function() {
+                       if($(this).is(':checked')) {
+                               if(checkedstr.length != 0) {
+                                       checkedstr = checkedstr + ',' + $(this).val();
+                               }
+                               else {
+                                       checkedstr = $(this).val();
+                               }
+                       }       
+               });
+               $.post('item', { dropitems: checkedstr }, function(data) {
+                       window.location.reload();
+               });
+       }
+
        function jotGetLink() {
                reply = prompt("$linkurl");
                if(reply && reply.length) {
+                       reply = bin2hex(reply);
                        $('#profile-rotator').show();
                        $.get('parse_url?url=' + reply, function(data) {
                                tinyMCE.execCommand('mceInsertRawHTML',false,data);
@@ -126,6 +168,13 @@ tinyMCE.init({
                }
        }
 
+       function jotTitle() {
+               reply = prompt("$title", $('#jot-title').val());
+               if(reply && reply.length) {
+                       $('#jot-title').val(reply);
+               }
+       }
+
        function jotShare(id) {
                $('#like-rotator-' + id).show();
                $.get('share/' + id, function(data) {