aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-07-20 11:08:42 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-07-20 11:08:42 +0200
commit7a069c1438eb0c6b84e9e93985722a34b4bca4e1 (patch)
treebe755ce3f75da6efb77fb5831898eaf72e201dbd
parent11d1d309c28b7c09ae566c2a9e36bea0c5aee85a (diff)
downloadvolse-hubzilla-7a069c1438eb0c6b84e9e93985722a34b4bca4e1.tar.gz
volse-hubzilla-7a069c1438eb0c6b84e9e93985722a34b4bca4e1.tar.bz2
volse-hubzilla-7a069c1438eb0c6b84e9e93985722a34b4bca4e1.zip
Load tinyMCE on post editor only if needed.
-rw-r--r--mod/editpost.php8
-rw-r--r--view/jot-header.tpl137
-rw-r--r--view/jot.tpl6
-rw-r--r--view/theme/duepuntozero/style.css7
-rw-r--r--view/theme/loozah/style.css7
5 files changed, 98 insertions, 67 deletions
diff --git a/mod/editpost.php b/mod/editpost.php
index cd0bbf223..c396ee44b 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -80,7 +80,9 @@ function editpost_content(&$a) {
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
- $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
+
+ //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
+
$o .= replace_macros($tpl,array(
'$return_path' => $_SESSION['return_url'],
@@ -110,10 +112,10 @@ function editpost_content(&$a) {
'$lockstate' => $lockstate,
'$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb),
'$bang' => (($group) ? '!' : ''),
- '$profile_uid' => $_SESSION['uid']
+ '$profile_uid' => $_SESSION['uid'],
+ '$jotplugins' => $jotplugins,
));
-
return $o;
}
diff --git a/view/jot-header.tpl b/view/jot-header.tpl
index 7e7e393ac..061f6a71d 100644
--- a/view/jot-header.tpl
+++ b/view/jot-header.tpl
@@ -1,68 +1,79 @@
<script language="javascript" type="text/javascript">
-var editor;
+var editor=false;
var textlen = 0;
+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('&nbsp;');
+ }
-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('&nbsp;');
- }
-
- 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;
- });
+ 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>
@@ -70,11 +81,13 @@ tinyMCE.init({
var ispublic = '$ispublic';
$(document).ready(function() {
- $("#profile-jot-acl-wrapper").hide();
- $("a#jot-perms-icon").fancybox({
- 'transitionIn' : 'none',
- 'transitionOut' : 'none'
- });
+ /* enable tinymce on focus */
+ $("#profile-jot-text").focus(function(){
+ if (editor) return;
+ $(this).val("");
+ initEditor();
+ });
+
var uploader = new window.AjaxUpload(
'wall-image-upload',
diff --git a/view/jot.tpl b/view/jot.tpl
index 43c20b90e..aa9892cbb 100644
--- a/view/jot.tpl
+++ b/view/jot.tpl
@@ -15,10 +15,12 @@
<input type="hidden" name="title" id="jot-title" value="" />
<input type="hidden" name="post_id" value="$post_id" />
- <textarea rows="5" cols="64" class="profile-jot-text" id="profile-jot-text" name="body" >$content</textarea>
+ <img id="profile-jot-text-loading" src="images/rotator.gif" alt="$wait" title="$wait" style="display: none;" />
+ <textarea rows="5" cols="64" class="profile-jot-text" id="profile-jot-text" name="body" >{{ if $content }}$content{{ else }}$share{{ endif }}</textarea>
+ {{ if $content }}<script>initEditor();</script>{{ endif }}
-<div id="profile-jot-submit-wrapper" >
+<div id="profile-jot-submit-wrapper" style="display:none">
<input type="submit" id="profile-jot-submit" name="submit" value="$share" />
<div id="profile-upload-wrapper" style="display: $visitor;" >
<div id="wall-image-upload-div" ><a href="#" onclick="return false;" id="wall-image-upload" class="icon camera" title="$upload"></a></div>
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css
index b4feaaa27..90ed2119c 100644
--- a/view/theme/duepuntozero/style.css
+++ b/view/theme/duepuntozero/style.css
@@ -1483,6 +1483,13 @@ input#dfrn-url {
width: 180px;
}
+#profile-jot-text {
+ height: 20px;
+ color:#cccccc;
+ border: 1px solid #cccccc;
+}
+
+
/** acl **/
#profile-jot-acl-wrapper{
diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css
index 698f30803..f46fa0064 100644
--- a/view/theme/loozah/style.css
+++ b/view/theme/loozah/style.css
@@ -1561,6 +1561,13 @@ padding: 5px 10px 0px;
overflow: auto;
}
+#profile-jot-text {
+ height: 20px;
+ color:#cccccc;
+ border: 1px solid #cccccc;
+}
+
+
/** acl **/
#profile-jot-acl-wrapper{
display:block!important;