diff options
Diffstat (limited to 'view/jot-header.tpl')
-rw-r--r-- | view/jot-header.tpl | 149 |
1 files changed, 78 insertions, 71 deletions
diff --git a/view/jot-header.tpl b/view/jot-header.tpl index 7d215bd46..061f6a71d 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -1,72 +1,94 @@ <script language="javascript" type="text/javascript"> -var editor; +var editor=false; var textlen = 0; -tinyMCE.init({ - theme : "advanced", - mode : "specific_textareas", - editor_selector: /(profile-jot-text|prvmail-text)/, - plugins : "bbcode,paste,autoresize", - 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", - paste_text_sticky : true, - entity_encoding : "raw", - add_unload_trigger : false, - remove_linebreaks : false, - force_p_newlines : false, - force_br_newlines : true, - forced_root_block : '', - convert_urls: false, - content_css: "$baseurl/view/custom_tinymce.css", - theme_advanced_path : false, - setup : function(ed) { - //Character count - ed.onKeyUp.add(function(ed, e) { - var txt = tinyMCE.activeEditor.getContent(); - textlen = txt.length; - if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) { - $('#profile-jot-desc').html(ispublic); - } - else { - $('#profile-jot-desc').html(' '); - } - - 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); - }); +function initEditor(){ + $("#profile-jot-text-loading").show(); + tinyMCE.init({ + theme : "advanced", + mode : "specific_textareas", + editor_selector: /(profile-jot-text|prvmail-text)/, + plugins : "bbcode,paste,autoresize", + 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", + paste_text_sticky : true, + entity_encoding : "raw", + add_unload_trigger : false, + remove_linebreaks : false, + force_p_newlines : false, + force_br_newlines : true, + forced_root_block : '', + convert_urls: false, + content_css: "$baseurl/view/custom_tinymce.css", + theme_advanced_path : false, + setup : function(ed) { + //Character count + ed.onKeyUp.add(function(ed, e) { + var txt = tinyMCE.activeEditor.getContent(); + textlen = txt.length; + if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) { + $('#profile-jot-desc').html(ispublic); + } + else { + $('#profile-jot-desc').html(' '); + } - ed.onInit.add(function(ed) { - ed.pasteAsPlainText = true; - }); + 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(); + $("#profile-jot-submit-wrapper").show(); + }); + + } + }); + editor = true; + + // setup acl popup + $("#profile-jot-acl-wrapper").hide(); + $("a#jot-perms-icon").fancybox({ + 'transitionIn' : 'none', + 'transitionOut' : 'none' + }); +} </script> <script type="text/javascript" src="include/ajaxupload.js" ></script> <script> var ispublic = '$ispublic'; $(document).ready(function() { + + /* enable tinymce on focus */ + $("#profile-jot-text").focus(function(){ + if (editor) return; + $(this).val(""); + initEditor(); + }); + + var uploader = new window.AjaxUpload( 'wall-image-upload', { action: 'wall_upload/$nickname', @@ -90,21 +112,6 @@ tinyMCE.init({ } ); - /*$('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() { - var selstr; - $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() { - selstr = $(this).text(); - $('#jot-perms-icon').removeClass('unlock').addClass('lock'); - $('#jot-public').hide(); - $('.profile-jot-net input').attr('disabled', 'disabled'); - }); - if(selstr == null) { - $('#jot-perms-icon').removeClass('lock').addClass('unlock'); - $('#jot-public').show(); - $('.profile-jot-net input').attr('disabled', false); - } - - }).trigger('change');*/ }); |