]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/dispy/jot-header.tpl
Merge branch 'pull'
[friendica.git] / view / theme / dispy / jot-header.tpl
index 93df84aaebed0bc70671fdbdaa0e213c13e0b6de..e72000b4ce811b335e702cc7545a2492b2b8f024 100644 (file)
@@ -1,7 +1,8 @@
+<script type="text/javascript" src="$baseurl/library/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
+<script type="text/javascript" src="$baseurl/js/ajaxupload.js"></script>
+<script type="text/javascript">
 
-<script language="javascript" type="text/javascript">
-
-var editor=false;
+var editor = false;
 var textlen = 0;
 var plaintext = '$editselect';
 // this is here because of the silly tinymce error. didn't help.
@@ -19,15 +20,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",
@@ -51,9 +48,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) {
@@ -64,7 +60,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,9 +98,9 @@ function initEditor(cb) {
                                        ed.pasteAsPlainText = true;
                                        $("#profile-jot-text-loading").hide();
                                        $(".jothidden").show();
-
-                                       if (typeof cb!="undefined") { cb(); }
+                                       if (typeof cb!="undefined") cb();
                                });
+
                        }
                });
                editor = true;
@@ -118,51 +114,21 @@ function initEditor(cb) {
        }
 }
 
-function charCounter() {
-       // character count part deux
-       $('#profile-jot-text').keyup(function(event) {
-               var textlen = $(this).val().length();
-               var maxLen1 = 140;
-               var maxLen2 = 420;
-
-               $('#character-counter').removeClass('jothidden');
-               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').html($(this).val().length);
-       });
-}
-
 function enableOnUser(){
        if (editor) return;
        $(this).val("");
        initEditor();
-       charCounter();
 }
 
-</script>
-<script type="text/javascript" src="$baseurl/js/ajaxupload.js" ></script>
-<script>
        var ispublic = '$ispublic';
        var addtitle = '$addtitle';
 
        $(document).ready(function() {
-               
                /* enable tinymce on focus and click */
                $("#profile-jot-text").focus(enableOnUser);
                $("#profile-jot-text").click(enableOnUser);
+               $("#profile-jot-text").focus(charCounter);
+               $("#profile-jot-text").click(charCounter);
 
                var uploader = new window.AjaxUpload(
                        'wall-image-upload',
@@ -313,5 +279,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>