function status_editor($a,$x, $notes_cid = 0, $popup=false) {
-
$o = '';
$geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
-/* $plaintext = false;
- if( local_user() && (intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext')) )
- $plaintext = true;*/
- $plaintext = true;
- if( local_user() && feature_enabled(local_user(),'richtext') )
- $plaintext = false;
-
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$newpost' => 'true',
'$baseurl' => App::get_baseurl(true),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'),
'$delitems' => t('Delete item(s)?')
));
-
$tpl = get_markup_template('jot-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$newpost' => 'true',
'$baseurl' => App::get_baseurl(true),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'),
function ACL(backend_url, preset, automention, is_mobile){
-
+
this.url = backend_url;
this.automention = automention;
this.is_mobile = is_mobile;
-
-
+
+
this.kp_timer = null;
-
+
if (preset==undefined) preset = [];
this.allow_cid = (preset[0] || []);
this.allow_gid = (preset[1] || []);
} else {
this.nw = 4;
}
-
-
+
+
this.list_content = $("#acl-list-content");
this.item_tpl = unescape($(".acl-list-item[rel=acl-template]").html());
this.showall = $("#acl-showall");
if (preset.length==0) this.showall.addClass("selected");
-
+
/*events*/
this.showall.click(this.on_showall.bind(this));
$(document).on("click", ".acl-button-show", this.on_button_show.bind(this));
$(document).on("click", ".acl-button-hide", this.on_button_hide.bind(this));
$("#acl-search").keypress(this.on_search.bind(this));
$("#acl-wrapper").parents("form").submit(this.on_submit.bind(this));
-
+
/* add/remove mentions */
this.element = $("#profile-jot-text");
this.htmlelm = this.element.get()[0];
-
+
/* startup! */
this.get(0,100);
}
ACL.prototype.remove_mention = function(id) {
- if (!this.automention) return;
+ if (!this.automention) {
+ return;
+ }
var nick = this.data[id].nick;
- var searchText = "@"+nick+"+"+id+" ";
- if (tinyMCE.activeEditor===null) {
- start = this.element.val().indexOf(searchText);
- if ( start<0) return;
- end = start+searchText.length;
- this.element.setSelection(start,end).replaceSelectedText('').collapseSelection(false);
- } else {
- start = tinyMCE.activeEditor.getContent({format : 'raw'}).search( searchText );
- if ( start<0 ) return;
- txt = tinyMCE.activeEditor.getContent();
- newtxt = txt.replace(searchText, '');
- tinyMCE.activeEditor.setContent(newtxt);
+ var searchText = "@" + nick + "+" + id + " ";
+ var start = this.element.val().indexOf(searchText);
+ if (start < 0) {
+ return;
}
+ var end = start + searchText.length;
+ this.element.setSelection(start, end).replaceSelectedText('').collapseSelection(false);
}
ACL.prototype.add_mention = function(id) {
- if (!this.automention) return;
+ if (!this.automention) {
+ return;
+ }
var nick = this.data[id].nick;
- var searchText = "@"+nick+"+"+id+" ";
- if (tinyMCE.activeEditor===null) {
- if ( this.element.val().indexOf( searchText) >= 0 ) return;
- this.element.val( searchText + this.element.val() );
- } else {
- if ( tinyMCE.activeEditor.getContent({format : 'raw'}).search(searchText) >= 0 ) return;
- tinyMCE.activeEditor.dom.add(tinyMCE.activeEditor.getBody(), 'dummy', {}, searchText);
+ var searchText = "@" + nick + "+" + id + " ";
+ if (this.element.val().indexOf( searchText) >= 0 ) {
+ return;
}
+ this.element.val(searchText + this.element.val());
}
ACL.prototype.on_submit = function(){
- aclfileds = $("#acl-fields").html("");
+ var aclfields = $("#acl-fields").html("");
$(this.allow_gid).each(function(i,v){
- aclfileds.append("<input type='hidden' name='group_allow[]' value='"+v+"'>");
+ aclfields.append("<input type='hidden' name='group_allow[]' value='"+v+"'>");
});
$(this.allow_cid).each(function(i,v){
- aclfileds.append("<input type='hidden' name='contact_allow[]' value='"+v+"'>");
+ aclfields.append("<input type='hidden' name='contact_allow[]' value='"+v+"'>");
});
$(this.deny_gid).each(function(i,v){
- aclfileds.append("<input type='hidden' name='group_deny[]' value='"+v+"'>");
+ aclfields.append("<input type='hidden' name='group_deny[]' value='"+v+"'>");
});
$(this.deny_cid).each(function(i,v){
- aclfileds.append("<input type='hidden' name='contact_deny[]' value='"+v+"'>");
- });
+ aclfields.append("<input type='hidden' name='contact_deny[]' value='"+v+"'>");
+ });
}
ACL.prototype.search = function(){
ACL.prototype.on_showall = function(event){
event.preventDefault()
event.stopPropagation();
-
+
if (this.showall.hasClass("selected")){
return false;
}
this.showall.addClass("selected");
-
+
this.allow_cid = [];
this.allow_gid = [];
this.deny_cid = [];
this.deny_gid = [];
-
+
this.update_view();
-
+
return false;
}
event.preventDefault()
event.stopImmediatePropagation()
event.stopPropagation();
-
+
this.set_allow($(event.target).parent().attr('id'));
return false;
ACL.prototype.set_allow = function(itemid){
type = itemid[0];
id = parseInt(itemid.substr(1));
-
+
switch(type){
case "g":
if (this.allow_gid.indexOf(id)<0){
this.allow_cid.remove(id);
if (this.data[id].forum=="1") this.remove_mention(id);
}
- if (this.deny_cid.indexOf(id)>=0) this.deny_cid.remove(id);
+ if (this.deny_cid.indexOf(id)>=0) this.deny_cid.remove(id);
break;
}
this.update_view();
ACL.prototype.set_deny = function(itemid){
type = itemid[0];
id = parseInt(itemid.substr(1));
-
+
switch(type){
case "g":
if (this.deny_gid.indexOf(id)<0){
/* jot acl */
$('#jot-perms-icon').removeClass('lock').addClass('unlock');
$('#jot-public').show();
- $('.profile-jot-net input').attr('disabled', false);
+ $('.profile-jot-net input').attr('disabled', false);
if(typeof editor != 'undefined' && editor != false) {
$('#profile-jot-desc').html(ispublic);
}
-
+
} else {
this.showall.removeClass("selected");
/* jot acl */
$('#jot-perms-icon').removeClass('unlock').addClass('lock');
$('#jot-public').hide();
- $('.profile-jot-net input').attr('disabled', 'disabled');
+ $('.profile-jot-net input').attr('disabled', 'disabled');
$('#profile-jot-desc').html(' ');
}
$("#acl-list-content .acl-list-item").each(function(){
$(this).removeClass("groupshow grouphide");
});
-
+
$("#acl-list-content .acl-list-item").each(function(index, element){
itemid = $(element).attr('id');
type = itemid[0];
id = parseInt(itemid.substr(1));
-
+
btshow = $(element).children(".acl-button-show").removeClass("selected");
- bthide = $(element).children(".acl-button-hide").removeClass("selected");
-
+ bthide = $(element).children(".acl-button-hide").removeClass("selected");
+
switch(type){
case "g":
var uclass = "";
bthide.addClass("selected");
uclass="grouphide";
}
-
+
$(this.group_uids[id]).each(function(i,v) {
if(uclass == "grouphide")
$("#c"+v).removeClass("groupshow");
$("#c"+v).addClass(uclass);
}
});
-
+
break;
case "c":
if (this.allow_cid.indexOf(id)>=0){
if (this.deny_cid.indexOf(id)>=0){
btshow.removeClass("selected");
bthide.addClass("selected");
- }
+ }
}
-
+
}.bind(this));
-
+
}
count:count,
search:search,
}
-
+
$.ajax({
type:'POST',
url: this.url,
html = "<div class='acl-list-item {4} {5} type{2}' title='{6}' id='{2}{3}'>"+this.item_tpl+"</div>";
html = html.format(item.photo, item.name, item.type, item.id, (item.forum=='1'?'forum':''), item.network, item.link);
if (item.uids!=undefined) this.group_uids[item.id] = item.uids;
-
+
this.list_content.append(html);
this.data[item.id] = item;
}.bind(this));
// Add src attribute for images with a data-src attribute
$(el).attr('src', $(el).data("src"));
});
-
+
this.update_view();
}
* @brief Friendica people autocomplete
*
* require jQuery, jquery.textcomplete
- *
+ *
* for further documentation look at:
* http://yuku-t.com/jquery-textcomplete/
- *
+ *
* https://github.com/yuku-t/jquery-textcomplete/blob/master/doc/how_to_use.md
*/
// 16 chars of hash should be enough. Full hash could be used if it can be done in a visually appealing way.
// 16 chars is also the minimum length in the backend (otherwise it's interpreted as a local id).
- if(id.length > 16)
+ if(id.length > 16)
id = item.id.substring(0,16);
return '$1$2' + item.nick.replace(' ', '') + '+' + id + ' ';
})( jQuery );
/**
- * Friendica people autocomplete legacy
- * code which is needed for tinymce
+ * Friendica people autocomplete legacy code
*
* require jQuery, jquery.textareas
*/
-
-function ACPopup(elm,backend_url){
- this.idsel=-1;
+function ACPopup(elm, backend_url){
+ this.idsel = -1;
this.element = elm;
- this.searchText="";
- this.ready=true;
+ this.searchText = '';
+ this.ready = true;
this.kp_timer = false;
this.url = backend_url;
this.conversation_id = null;
var conv_id = this.element.id.match(/\d+$/);
- if (conv_id) this.conversation_id = conv_id[0];
- console.log("ACPopup elm id",this.element.id,"conversation",this.conversation_id);
-
- var w = 530;
- var h = 130;
-
-
- if(tinyMCE.activeEditor == null) {
- style = $(elm).offset();
- w = $(elm).width();
- h = $(elm).height();
- }
- else {
- // I can't find an "official" way to get the element who get all
- // this fraking thing that is tinyMCE.
- // This code will broke again at some point...
- var container = $(tinyMCE.activeEditor.getContainer()).find("table");
- style = $(container).offset();
- w = $(container).width();
- h = $(container).height();
+ if (conv_id) {
+ this.conversation_id = conv_id[0];
}
- style.top=style.top+h;
+ var w = $(elm).width();
+ var h = $(elm).height();
+
+ var style = $(elm).offset();
+ style.top = style.top + h;
style.width = w;
style.position = 'absolute';
- /* style['max-height'] = '150px';
- style.border = '1px solid red';
- style.background = '#cccccc';
-
- style.overflow = 'auto';
- style['z-index'] = '100000';
- */
style.display = 'none';
- this.cont = $("<div class='acpopup-mce'></div>");
+ this.cont = $('<div class="acpopup-mce"></div>');
this.cont.css(style);
- $("body").append(this.cont);
- }
+ $('body').append(this.cont);
+}
ACPopup.prototype.close = function(){
$(this.cont).remove();
}
ACPopup.prototype.add = function(label, value){
- var that=this;
- var elm = $("<div class='acpopupitem' title='"+value+"'>"+label+"</div>");
+ var that = this;
+ var elm = $('<div class="acpopupitem" title="' + value + '">' + label + '</div>');
elm.click(function(e){
- t = $(this).attr('title').replace(new RegExp(' \- .*'),'');
- if(typeof(that.element.container) === "undefined") {
- el=$(that.element);
- sel = el.getSelection();
- sel.start = sel.start- that.searchText.length;
- el.setSelection(sel.start,sel.end).replaceSelectedText(t+' ').collapseSelection(false);
- that.close();
- }
- else {
- txt = tinyMCE.activeEditor.getContent();
- // alert(that.searchText + ':' + t);
- newtxt = txt.replace('@' + that.searchText,'@' + t +' ');
- tinyMCE.activeEditor.setContent(newtxt);
- tinyMCE.activeEditor.focus();
- that.close();
- }
+ t = $(this).attr('title').replace(new RegExp(' \- .*'), '');
+ el = $(that.element);
+ sel = el.getSelection();
+ sel.start = sel.start - that.searchText.length;
+ el.setSelection(sel.start, sel.end).replaceSelectedText(t + ' ').collapseSelection(false);
+ that.close();
});
$(this.cont).append(elm);
}
ACPopup.prototype.onkey = function(event){
if (event.keyCode == '13') {
- if(this.idsel>-1) {
+ if(this.idsel > -1) {
this.cont.children()[this.idsel].click();
event.preventDefault();
- }
- else
+ } else {
this.close();
+ }
}
if (event.keyCode == '38') { //cursor up
- cmax = this.cont.children().size()-1;
+ var cmax = this.cont.children().size() - 1;
this.idsel--;
- if (this.idsel<0) this.idsel=cmax;
+ if (this.idsel < 0) {
+ this.idsel = cmax;
+ }
event.preventDefault();
}
if (event.keyCode == '40' || event.keyCode == '9') { //cursor down
- cmax = this.cont.children().size()-1;
+ var cmax = this.cont.children().size() - 1;
this.idsel++;
- if (this.idsel>cmax) this.idsel=0;
+ if (this.idsel > cmax) {
+ this.idsel = 0;
+ }
event.preventDefault();
}
input.val(val);
});
- /* setup field_richtext */
- setupFieldRichtext();
-
/* popup menus */
function close_last_popup_menu() {
if(last_popup_menu) {
function preview_post() {
$("#jot-preview").val("1");
$("#jot-preview-content").show();
- tinyMCE.triggerSave();
$.post(
"item",
$("#profile-jot-form").serialize(),
});
}
-
-// code from http://www.tinymce.com/wiki.php/How-to_implement_a_custom_file_browser
-function fcFileBrowser (field_name, url, type, win) {
- /* TODO: If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
- the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
- These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */
-
-
- var cmsURL = baseurl+"/fbrowser/"+type+"/";
-
- tinyMCE.activeEditor.windowManager.open({
- file : cmsURL,
- title : 'File Browser',
- width : 420, // Your dimensions may differ - toy around with them!
- height : 400,
- resizable : "yes",
- inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
- close_previous : "no"
- }, {
- window : win,
- input : field_name
- });
- return false;
- }
-
-function setupFieldRichtext(){
- tinyMCE.init({
- theme : "advanced",
- mode : "specific_textareas",
- editor_selector: "fieldRichtext",
- plugins : "bbcode,paste, 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",
- theme_advanced_resizing : true,
- 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 : 'div',
- convert_urls: false,
- content_css: baseurl+"/view/custom_tinymce.css",
- theme_advanced_path : false,
- file_browser_callback : "fcFileBrowser",
- });
-}
-
-
/**
* sprintf in javascript
* "{0} and {1}".format('zero','uno');
function cal_content(App $a) {
nav_set_selected('events');
- $editselect = 'none';
- if( feature_enabled(local_user(), 'richtext') )
- $editselect = 'textareas';
-
// First day of the week (0 = Sunday)
$firstDay = get_pconfig(local_user(),'system','first_day_of_week');
if ($firstDay === false) $firstDay=0;
'$module_url' => '/cal/' . $a->data['user']['nickname'],
'$modparams' => 2,
'$i18n' => $i18n,
- '$editselect' => $editselect
));
$etpl = get_markup_template('event_end.tpl');
$a->page['end'] .= replace_macros($etpl,array(
'$baseurl' => App::get_baseurl(),
- '$editselect' => $editselect
));
$o ="";
$contact_id = $a->data['contact']['id'];
$contact = $a->data['contact'];
- $editselect = 'none';
- if( feature_enabled(local_user(),'richtext') )
- $editselect = 'exact';
-
$a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array(
'$baseurl' => App::get_baseurl(true),
- '$editselect' => $editselect,
));
$a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), array(
'$baseurl' => App::get_baseurl(true),
- '$editselect' => $editselect,
));
require_once('include/contact_selectors.php');
return;
}
-/* $plaintext = false;
- if( local_user() && intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
- $plaintext = true;*/
- $plaintext = true;
- if( local_user() && feature_enabled(local_user(),'richtext') )
- $plaintext = false;
-
-
$o .= replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => t('Edit post')
));
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $a->user['nickname']
$tpl = get_markup_template('jot-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $a->user['nickname']
nav_set_selected('events');
}
- $editselect = 'none';
- if ( feature_enabled(local_user(), 'richtext') ) {
- $editselect = 'textareas';
- }
-
// get the translation strings for the callendar
$i18n = get_event_strings();
'$module_url' => '/events',
'$modparams' => 1,
'$i18n' => $i18n,
- '$editselect' => $editselect
));
$etpl = get_markup_template('event_end.tpl');
$a->page['end'] .= replace_macros($etpl,array(
'$baseurl' => App::get_baseurl(),
- '$editselect' => $editselect
));
$o ="";
$o .= $header;
-/* $plaintext = false;
- if(intval(get_pconfig(local_user(),'system','plaintext')))
- $plaintext = true;*/
- $plaintext = true;
- if( local_user() && feature_enabled(local_user(),'richtext') )
- $plaintext = false;
-
-
$tpl = get_markup_template('msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
$tpl = get_markup_template('msg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
$o .= $header;
- $plaintext = true;
- if( local_user() && feature_enabled(local_user(),'richtext') )
- $plaintext = false;
-
$r = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb`
FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
WHERE `mail`.`uid` = %d AND `mail`.`id` = %d LIMIT 1",
$tpl = get_markup_template('msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
$tpl = get_markup_template('msg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
-
$mails = array();
$seen = 0;
$unknown = false;
require_once('include/profile_selectors.php');
-/* $editselect = 'textareas';
- if( intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
- $editselect = 'none';*/
- $editselect = 'none';
- if( feature_enabled(local_user(),'richtext') )
- $editselect = 'textareas';
-
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
'$baseurl' => App::get_baseurl(true),
- '$editselect' => $editselect,
));
$a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), array(
'$baseurl' => App::get_baseurl(true),
- '$editselect' => $editselect,
));
-
$opt_tpl = get_markup_template("profile-hide-friends.tpl");
$hide_friends = replace_macros($opt_tpl,array(
'$yesno' => array(
return;
}
-
-
- $editselect = 'none';
- if( feature_enabled(local_user(), 'richtext') )
- $editselect = '/(profile-jot-text|prvmail-text)/';
-
$tpl = get_markup_template('wallmsg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true),
- '$editselect' => $editselect,
'$nickname' => $user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
$tpl = get_markup_template('wallmsg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true),
- '$editselect' => $editselect,
'$nickname' => $user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
-
-
$tpl = get_markup_template('wallmessage.tpl');
$o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'),
-
-<script language="javascript" type="text/javascript"
- src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
- <script language="javascript" type="text/javascript">
-
-tinyMCE.init({
- theme : "advanced",
- mode : "{{$editselect}}",
- elements: "contact-edit-info",
- plugins : "bbcode",
- theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
- theme_advanced_buttons2 : "",
- theme_advanced_buttons3 : "",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "center",
- theme_advanced_styles : "blockquote,code",
- theme_advanced_resizing : true,
- gecko_spellcheck : true,
- entity_encoding : "raw",
- add_unload_trigger : false,
- remove_linebreaks : false,
- //force_p_newlines : false,
- //force_br_newlines : true,
- forced_root_block : 'div',
- content_css: "{{$baseurl}}/view/custom_tinymce.css"
-
-
-});
-
-
-</script>
-
});
</script>
-{{if $editselect != 'none'}}
-<script language="javascript" type="text/javascript"
- src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
- tinyMCE.init({
- theme : "advanced",
- mode : "textareas",
- plugins : "bbcode,paste",
- 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",
- theme_advanced_resizing : true,
- gecko_spellcheck : true,
- paste_text_sticky : true,
- entity_encoding : "raw",
- add_unload_trigger : false,
- remove_linebreaks : false,
- forced_root_block : 'div',
- content_css: "{{$baseurl}}/view/custom_tinymce.css",
- theme_advanced_path : false,
- setup : function(ed) {
- ed.onInit.add(function(ed) {
- ed.pasteAsPlainText = true;
- });
- }
-
- });
-
$(document).ready(function() {
- $('.comment-edit-bb').hide();
- });
-{{else}}
- <script language="javascript" type="text/javascript">
-{{/if}}
-
- $(document).ready(function() {
-{{if $editselect = 'none'}}
$("#comment-edit-text-desc").bbco_autocomplete('bbcode');
-{{/if}}
$('#id_share').change(function() {
<script type="text/javascript" src="library/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script>
-<script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.min.js" ></script>
<script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="js/webtoolkit.base64.js" ></script>
<script language="javascript" type="text/javascript">
-var editor=false;
+var editor = false;
var textlen = 0;
-var plaintext = '{{$editselect}}';
-function initEditor(cb){
- if (editor==false){
+function initEditor(callback) {
+ if (editor == false) {
var colorbox_options = {
{{if $APP->is_mobile}}
'width' : '100%',
'inline' : true,
'transition' : 'elastic'
}
-
-
-
- $("#profile-jot-text-loading").show();
- if(plaintext == 'none') {
- $("#profile-jot-text-loading").hide();
- $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
- $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
- $("#profile-jot-text").bbco_autocomplete('bbcode');
- editor = true;
- $("a#jot-perms-icon").colorbox(colorbox_options);
- $(".jothidden").show();
- if (typeof cb!="undefined") cb();
- return;
- }
- tinyMCE.init({
- theme : "advanced",
- mode : "specific_textareas",
- editor_selector: {{$editselect}},
- auto_focus: "profile-jot-text",
- 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",
- theme_advanced_resizing : true,
- gecko_spellcheck : true,
- 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 : 'div',
- convert_urls: false,
- content_css: "{{$baseurl}}/view/custom_tinymce.css",
- theme_advanced_path : false,
- file_browser_callback : "fcFileBrowser",
- 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(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();
- });
+ $("#profile-jot-text-loading").show();
+ $("#profile-jot-text-loading").hide();
+ $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
+ $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
+ $("#profile-jot-text").bbco_autocomplete('bbcode');
+ $("a#jot-perms-icon").colorbox(colorbox_options);
+ $(".jothidden").show();
- }
- });
editor = true;
- // setup acl popup
- $("a#jot-perms-icon").colorbox(colorbox_options);
- } else {
- if (typeof cb!="undefined") cb();
+ }
+ if (typeof callback != "undefined") {
+ callback();
}
}
function enableOnUser(){
- if (editor) return;
- $(this).val("");
+ if (editor) {
+ return;
+ }
+ $(this).val('');
initEditor();
}
$(document).ready(function() {
- /* enable tinymce on focus and click */
+ /* enable editor on focus and click */
$("#profile-jot-text").focus(enableOnUser);
$("#profile-jot-text").click(enableOnUser);
-
-
-
/* show images / file browser window
*
**/
$('#wall-file-upload').on('click', function(){
Dialog.doFileBrowser("main");
});
-
- /**
- var uploader = new window.AjaxUpload(
- 'wall-image-upload',
- { action: 'wall_upload/{{$nickname}}',
- name: 'userfile',
- onSubmit: function(file,ext) { $('#profile-rotator').show(); },
- onComplete: function(file,response) {
- addeditortext(response);
- $('#profile-rotator').hide();
- }
- }
- );
- var file_uploader = new window.AjaxUpload(
- 'wall-file-upload',
- { action: 'wall_attach/{{$nickname}}',
- name: 'userfile',
- onSubmit: function(file,ext) { $('#profile-rotator').show(); },
- onComplete: function(file,response) {
- addeditortext(response);
- $('#profile-rotator').hide();
- }
- }
- );
-
- }
- **/
});
}
function addeditortext(data) {
- if(plaintext == 'none') {
- var currentText = $("#profile-jot-text").val();
- $("#profile-jot-text").val(currentText + data);
- }
- else
- tinyMCE.execCommand('mceInsertRawHTML',false,data);
+ var currentText = $("#profile-jot-text").val();
+ $("#profile-jot-text").val(currentText + data);
}
{{$geotag}}
-
-
-<script language="javascript" type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
-
-var plaintext = '{{$editselect}}';
-
-if(plaintext != 'none') {
- tinyMCE.init({
- theme : "advanced",
- mode : "specific_textareas",
- editor_selector: /(profile-jot-text|prvmail-text)/,
- plugins : "bbcode,paste",
- theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
- theme_advanced_buttons2 : "",
- theme_advanced_buttons3 : "",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "center",
- theme_advanced_blockformats : "blockquote,code",
- theme_advanced_resizing : true,
- gecko_spellcheck : true,
- 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 : 'div',
- convert_urls: false,
- content_css: "{{$baseurl}}/view/custom_tinymce.css",
- //Character count
- theme_advanced_path : false,
- setup : function(ed) {
- 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);
- }
- });
- }
- });
-}
-else
- $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
-
-
+ $("#prvmail-text").editor_autocomplete(baseurl + '/acl');
</script>
<script type="text/javascript" src="js/ajaxupload.js" ></script>
<script>
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) {
- tinyMCE.execCommand('mceInsertRawHTML',false,response);
+ addeditortext(response);
$('#profile-rotator').hide();
- }
+ }
}
);
- {{if $editselect = 'none'}}
$("#prvmail-text").bbco_autocomplete('bbcode');
- {{/if}}
-
-
});
function jotGetLink() {
if(reply && reply.length) {
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
- tinyMCE.execCommand('mceInsertRawHTML',false,data);
+ addeditortext(data);
$('#profile-rotator').hide();
});
}
if(reply && reply.length) {
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
- tinyMCE.execCommand('mceInsertRawHTML',false,data);
+ addeditortext(data);
$('#profile-rotator').hide();
});
}
-
-<script type="text/javascript" src="js/country.js" ></script>
-
-<script language="javascript" type="text/javascript"
- src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
- <script language="javascript" type="text/javascript">
-
-
-tinyMCE.init({
- theme : "advanced",
- mode : "{{$editselect}}",
- plugins : "bbcode,paste",
- 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",
- theme_advanced_resizing : true,
- gecko_spellcheck : true,
- 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 : 'div',
- content_css: "{{$baseurl}}/view/custom_tinymce.css",
- theme_advanced_path : false,
- setup : function(ed) {
- ed.onInit.add(function(ed) {
- ed.pasteAsPlainText = true;
- });
- }
-
-});
-
-
-</script>
-
+<script type="text/javascript" src="js/country.js" ></script>
\ No newline at end of file
-
-
-<script language="javascript" type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
-
-var plaintext = '{{$editselect}}';
-
-if(plaintext != 'none') {
- tinyMCE.init({
- theme : "advanced",
- mode : "specific_textareas",
- editor_selector: /(profile-jot-text|prvmail-text)/,
- plugins : "bbcode,paste",
- theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
- theme_advanced_buttons2 : "",
- theme_advanced_buttons3 : "",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "center",
- theme_advanced_blockformats : "blockquote,code",
- theme_advanced_resizing : true,
- gecko_spellcheck : true,
- 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 : 'div',
- convert_urls: false,
- content_css: "{{$baseurl}}/view/custom_tinymce.css",
- //Character count
- theme_advanced_path : false,
- setup : function(ed) {
- 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);
- }
- });
- }
- });
-}
-else
$("#prvmail-text").editor_autocomplete(baseurl+"/acl");
-
-
</script>
<script>
if(reply && reply.length) {
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
- tinyMCE.execCommand('mceInsertRawHTML',false,data);
+ addeditortext(data);
$('#profile-rotator').hide();
});
}
if(reply && reply.length) {
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
- tinyMCE.execCommand('mceInsertRawHTML',false,data);
+ addeditortext(data);
$('#profile-rotator').hide();
});
}
<script type="text/javascript" src="library/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script>
-<script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.min.js" ></script>
<script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="js/webtoolkit.base64.js" ></script>