]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/dispy/jot-header.tpl
Merge remote-tracking branch 'friendica/master'
[friendica.git] / view / theme / dispy / jot-header.tpl
index 0a559aae76892a6385677108a0b60c893cc70810..4c8f59d7969bd2348ebbacf1d3daa26da4f6f4e2 100644 (file)
@@ -1,13 +1,10 @@
-
-<script language="javascript" type="text/javascript">
-
-var editor=false;
+<script type="text/javascript">
+var editor = false;
 var textlen = 0;
 var plaintext = '$editselect';
-var skin = 'default';
 
-function initEditor(cb){
-       if (editor==false){
+function initEditor(cb) {
+       if (editor==false) {
                $("#profile-jot-text-loading").show();
                if(plaintext == 'none') {
                        $("#profile-jot-text-loading").hide();
@@ -18,14 +15,11 @@ function initEditor(cb){
                                'transitionOut' : 'elastic'
                        });
                        $(".jothidden").show();
-                       if (typeof cb!="undefined") {
-                cb();
-            }
+                       if (typeof cb!="undefined") cb();
                        return;
-               }       
+               }
                tinyMCE.init({
                        theme : "advanced",
-            skin : "default",
                        mode : "specific_textareas",
                        editor_selector: $editselect,
                        auto_focus: "profile-jot-text",
@@ -49,9 +43,8 @@ function initEditor(cb){
                        setup : function(ed) {
                                cPopup = null;
                                ed.onKeyDown.add(function(ed,e) {
-                                       if(cPopup !== null) {
+                                       if(cPopup !== null)
                                                cPopup.onkey(e);
-                    }
                                });
 
                                ed.onKeyUp.add(function(ed, e) {
@@ -62,7 +55,7 @@ function initEditor(cb){
                                                        cPopup = new ACPopup(this,baseurl+"/acl");
                                                }
                                                if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
-                                               if(! cPopup.ready) { cPopup = null; }
+                                               if(! cPopup.ready) cPopup = null;
                                        }
                                        else {
                                                if(cPopup !== null) { cPopup.close(); cPopup = null; }
@@ -102,6 +95,7 @@ function initEditor(cb){
                                        $(".jothidden").show();
                                        if (typeof cb!="undefined") cb();
                                });
+
                        }
                });
                editor = true;
@@ -122,8 +116,8 @@ function enableOnUser(){
 }
 
 </script>
-<script type="text/javascript" src="$baseurl/js/ajaxupload.js" ></script>
-<script>
+<script type="text/javascript" src="$baseurl/js/ajaxupload.js"></script>
+<script type="text/javascript">
        var ispublic = '$ispublic';
        var addtitle = '$addtitle';
 
@@ -132,6 +126,9 @@ function enableOnUser(){
                /* enable tinymce on focus and click */
                $("#profile-jot-text").focus(enableOnUser);
                $("#profile-jot-text").click(enableOnUser);
+               /* enable character counter */
+               $("#profile-jot-text").focus(charCounter);
+               $("#profile-jot-text").click(charCounter);
 
                var uploader = new window.AjaxUpload(
                        'wall-image-upload',
@@ -266,6 +263,18 @@ function enableOnUser(){
                }
        }
 
+       function itemFiler(id) {
+               reply = prompt("$fileas");
+               if(reply && reply.length) {
+                       commentBusy = true;
+                       $('body').css('cursor', 'wait');
+                       $.get('filer/' + id + '?term=' + reply);
+                       if(timer) clearTimeout(timer);
+                       timer = setTimeout(NavUpdate,3000);
+                       liking = 1;
+               }
+       }
+
        function jotClearLocation() {
                $('#jot-coord').val('');
                $('#profile-nolocation-wrapper').hide();
@@ -282,5 +291,36 @@ function enableOnUser(){
 
        $geotag
 
+       function charCounter() {
+               // character count part deux
+               //$(this).val().length is not a function Line 282(3)
+               $('#profile-jot-text').keyup(function() {
+                       var textlen = 0;
+                       var maxLen1 = 140;
+                       var maxLen2 = 420;
+
+                       $('#character-counter').removeClass('jothidden');
+
+                       textLen = $(this).val().length;
+                       if(textLen <= maxLen1) {
+                               $('#character-counter').removeClass('red');
+                               $('#character-counter').removeClass('orange');
+                               $('#character-counter').addClass('grey');
+                       }
+                       if((textLen > maxLen1) && (textlen <= maxLen2)) {
+                               $('#character-counter').removeClass('grey');
+                               $('#character-counter').removeClass('red');
+                               $('#character-counter').addClass('orange');
+                       }
+                       if(textLen > maxLen2) {
+                               $('#character-counter').removeClass('grey');
+                               $('#character-counter').removeClass('orange');
+                               $('#character-counter').addClass('red');
+                       }
+                       $('#character-counter').text( textLen );
+               });
+               $('#profile-jot-text').keyup();
+       }
+
 </script>