'#system-menu-list-closing': false
};
- /* enable tinymce on focus and click */
+ /* enable editor on focus and click */
$("#profile-jot-text").focus(enableOnUser);
$("#profile-jot-text").click(enableOnUser);
if ($('#id_share').is(':checked')) {
$('#acl-wrapper').show();
- }
- else {
+ } else {
$('#acl-wrapper').hide();
}
}).trigger('change');
if (window.navMenuTimeout[menuID + '-closing']) {
window.navMenuTimeout[menuID + '-closing'] = false;
clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
- }
- else {
+ } else {
window.navMenuTimeout[menuID + '-opening'] = true;
window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
if (window.navMenuTimeout[menuID + '-opening']) {
window.navMenuTimeout[menuID + '-opening'] = false;
clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
- }
- else {
+ } else {
window.navMenuTimeout[menuID + '-closing'] = true;
window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
/*
- * TinyMCE/Editor
+ * Editor
*/
-function InitMCEEditor(editorData) {
- var tinyMCEInitConfig = {
- theme : "advanced",
- //mode : // SPECIFIC
- //editor_selector: // SPECIFIC
- //elements: // SPECIFIC
- plugins : "bbcode,paste,autoresize,inlinepopups",
- theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
- theme_advanced_buttons2 : "",
- theme_advanced_buttons3 : "",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "center",
- theme_advanced_blockformats : "blockquote,code",
- gecko_spellcheck : true,
- paste_text_sticky : true, // COUPLED WITH paste PLUGIN
- entity_encoding : "raw",
- add_unload_trigger : false,
- remove_linebreaks : false,
- //force_p_newlines : false,
- //force_br_newlines : true,
- forced_root_block : 'div',
- //convert_urls: false, //SPECIFIC?
- content_css: baseurl + "/view/custom_tinymce.css",
- theme_advanced_path : false,
- file_browser_callback : "fcFileBrowser",
- //setup : // SPECIFIC
- };
-
- if (window.editSelect != 'none') {
- $.extend(tinyMCEInitConfig, editorData);
- tinyMCE.init(tinyMCEInitConfig);
- }
- else if (typeof editorData.plaintextFn == 'function') {
- (editorData.plaintextFn)();
- }
-}
-
var editor = false;
var textlen = 0;
-function initEditor(cb) {
- if (editor==false) {
- editor = true;
+function initEditor(callback) {
+ if(editor == false) {
$("#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 && $('#jot-perms-icon').is('.unlock')) {
- $('#profile-jot-desc').html(window.isPublic);
- }
- else {
- $('#profile-jot-desc').html(' ');
- }
-
- //Character count
-
- if (textlen <= 140) {
- $('#character-counter').removeClass('red');
- $('#character-counter').removeClass('orange');
- $('#character-counter').addClass('grey');
- }
- if ((textlen > 140) && (textlen <= 420)) {
- $('#character-counter').removeClass('grey');
- $('#character-counter').removeClass('red');
- $('#character-counter').addClass('orange');
- }
- if (textlen > 420) {
- $('#character-counter').removeClass('grey');
- $('#character-counter').removeClass('orange');
- $('#character-counter').addClass('red');
- }
- $('#character-counter').text(textlen);
- });
-
- ed.onInit.add(function(ed) {
- ed.pasteAsPlainText = true;
- $("#profile-jot-text-loading").hide();
- $(".jothidden").show();
- if (typeof cb!="undefined") cb();
- });
-
- },
- plaintextFn : function() {
- $("#profile-jot-text-loading").hide();
- $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
- $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
- $(".jothidden").show();
- if (typeof cb!="undefined") cb();
- }
- };
- InitMCEEditor(editorData);
-
+ $("#profile-jot-text-loading").hide();
+ $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
+ $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
+ $(".jothidden").show();
// setup acl popup
$("a#jot-perms-icon").colorbox({
'inline' : true,
'transition' : 'elastic'
});
- } else {
- if (typeof cb!="undefined") cb();
+
+ editor = true;
+ }
+ if (typeof callback != "undefined") {
+ callback();
}
}
function enableOnUser() {
- if (editor) return;
+ if (editor) {
+ return;
+ }
$(this).val("");
initEditor();
}
-
function msgInitEditor() {
- var editorData = {
- mode : "specific_textareas",
- editor_selector : "prvmail-text",
- //plugins : "bbcode,paste",
- //paste_text_sticky : true,
- convert_urls : false,
- //theme_advanced_path : 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 && $('#jot-perms-icon').is('.unlock')) {
- $('#profile-jot-desc').html(window.isPublic);
- }
- else {
- $('#profile-jot-desc').html(' ');
- }
- });
-
- ed.onInit.add(function(ed) {
- ed.pasteAsPlainText = true;
- var editorId = ed.editorId;
- var textarea = $('#'+editorId);
- if (typeof(textarea.attr('tabindex')) != "undefined") {
- $('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
- textarea.attr('tabindex', null);
- }
- });
- },
- plaintextFn : function() {
- $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
- }
- }
- InitMCEEditor(editorData);
-}
-
-
-function contactInitEditor() {
- var editorData = {
- mode : "exact",
- elements : "contact-edit-info",
- //plugins : "bbcode"
- }
- InitMCEEditor(editorData);
-}
-
-
-function eventInitEditor() {
- var editorData = {
- mode : "textareas",
- //plugins : "bbcode,paste",
- //paste_text_sticky : true,
- //theme_advanced_path : false,
- setup : function(ed) {
- ed.onInit.add(function(ed) {
- ed.pasteAsPlainText = true;
- });
- }
- }
- InitMCEEditor(editorData);
-}
-
-
-function profInitEditor() {
- var editorData = {
- mode : "textareas",
- //plugins : "bbcode,paste",
- //paste_text_sticky : true,
- //theme_advanced_path : false,
- setup : function(ed) {
- ed.onInit.add(function(ed) {
- ed.pasteAsPlainText = true;
- });
- }
- }
- InitMCEEditor(editorData);
+ $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
}
-
/*
* Jot
*/
function addeditortext(textElem, data) {
- if (window.editSelect == 'none') {
- var currentText = $(textElem).val();
- $(textElem).val(currentText + data);
- }
- else
- tinyMCE.execCommand('mceInsertRawHTML',false,data);
+ var currentText = $(textElem).val();
+ $(textElem).val(currentText + data);
}
function jotVideoURL() {
if ($(this).is(':checked')) {
if (checkedstr.length != 0) {
checkedstr = checkedstr + ',' + $(this).val();
- }
- else {
+ } else {
checkedstr = $(this).val();
}
}
* Comments
*/
-function insertFormatting(comment,BBcode,id) {
-
+function insertFormatting(BBcode, id) {
var tmpStr = $("#comment-edit-text-" + id).val();
- if(tmpStr == comment) {
- tmpStr = "";
+ if (tmpStr == "") {
$("#comment-edit-text-" + id).addClass("comment-edit-text-full");
$("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
openMenu("comment-edit-submit-wrapper-" + id);
- $("#comment-edit-text-" + id).val(tmpStr);
}
textarea = document.getElementById("comment-edit-text-" +id);
if (document.selection) {
textarea.focus();
selected = document.selection.createRange();
- if (BBcode == "url"){
- selected.text = "["+BBcode+"=http://]" + selected.text + "[/"+BBcode+"]";
- } else
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
var start = textarea.selectionStart;
var end = textarea.selectionEnd;
- if (BBcode == "url"){
- textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
- } else
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
}
+
return true;
}