X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Ffrost%2Fjs%2Ftheme.js;h=bf7bdd585c625c0ced878e51c6c9f1f6d26c59fb;hb=25662eb6f4fe6a3218d2723d39a2a09376363849;hp=a4a975880333d2710b1f0bbbba09039e999f0d47;hpb=b61479ba6eb66a5d23ff997f204319bf934783e0;p=friendica.git diff --git a/view/theme/frost/js/theme.js b/view/theme/frost/js/theme.js index a4a9758803..bf7bdd585c 100644 --- a/view/theme/frost/js/theme.js +++ b/view/theme/frost/js/theme.js @@ -12,7 +12,7 @@ $(document).ready(function() { '#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); @@ -384,249 +384,52 @@ function hideNavMenu(menuID) { /* - * 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); + $("#prvmail-text").editor_autocomplete(baseurl+"/acl"); } - -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); -} - - /* * 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() { @@ -800,19 +603,11 @@ function insertFormatting(BBcode, 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+"]"; - } + 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); - } + textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length); } return true;