-function initEditor(cb){
- if(editor==false) {
- editor = true;
- $j("#profile-jot-text-loading").show();
-
- var editorData = {
- mode : "specific_textareas",
- editor_selector : "profile-jot-text",
- auto_focus : "profile-jot-text",
- //plugins : "bbcode,paste,autoresize,inlinepopups",
- //paste_text_sticky : true,
- convert_urls : false,
- setup : function(ed) {
- cPopup = null;
- ed.onKeyDown.add(function(ed,e) {
- if(cPopup !== null)
- cPopup.onkey(e);
- });
-
- ed.onKeyUp.add(function(ed, e) {
- var txt = tinyMCE.activeEditor.getContent();
- match = txt.match(/@([^ \n]+)$/);
- if(match!==null) {
- if(cPopup === null) {
- cPopup = new ACPopup(this,baseurl+"/acl");
- }
- if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
- if(! cPopup.ready) cPopup = null;
- }
- else {
- if(cPopup !== null) { cPopup.close(); cPopup = null; }
- }
-
- textlen = txt.length;
- if(textlen != 0 && $j('#jot-perms-icon').is('.unlock')) {
- $j('#profile-jot-desc').html(window.isPublic);
- }
- else {
- $j('#profile-jot-desc').html(' ');
- }
-
- //Character count
-
- if(textlen <= 140) {
- $j('#character-counter').removeClass('red');
- $j('#character-counter').removeClass('orange');
- $j('#character-counter').addClass('grey');
- }
- if((textlen > 140) && (textlen <= 420)) {
- $j('#character-counter').removeClass('grey');
- $j('#character-counter').removeClass('red');
- $j('#character-counter').addClass('orange');
- }
- if(textlen > 420) {
- $j('#character-counter').removeClass('grey');
- $j('#character-counter').removeClass('orange');
- $j('#character-counter').addClass('red');
- }
- $j('#character-counter').text(textlen);
- });
-
- ed.onInit.add(function(ed) {
- ed.pasteAsPlainText = true;
- $j("#profile-jot-text-loading").hide();
- $j(".jothidden").show();
- if (typeof cb!="undefined") cb();
- });
-
- },
- plaintextFn : function() {
- $j("#profile-jot-text-loading").hide();
- $j("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
- $j("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
- $j(".jothidden").show();
- if (typeof cb!="undefined") cb();
- }
- };
- InitMCEEditor(editorData);