var simpleEditorInitialized = false;
var advancedEditorInitialized = false;
jQuery(function() {
jQuery('.editor-controller .hide, .editor-controller .xt-hide').bind('click',function(ev){
try{
simpleEditorInitialized = false;
advancedEditorInitialized = false;
if(jQuery('textarea.xtSimpleEditor').length>0){
var _c = '';
try{
_c = jQuery('textarea.xtSimpleEditor').tinymce().getContent();
jQuery('textarea.xtSimpleEditor').tinymce().remove();
}
catch(exc){
window.status = exc;
}
jQuery('textarea.xtSimpleEditor').val(_c);
jQuery('textarea.xtSimpleEditor').removeClass('xtSimpleEditor').addClass('noEditor_xtSimpleEditor');
}
if(jQuery('textarea.xtAdvancedEditor').length>0){
jQuery('textarea.xtAdvancedEditor').val(jQuery('textarea.xtAdvancedEditor').tinymce().getContent());
jQuery('textarea.xtAdvancedEditor').tinymce().remove();
jQuery('textarea.xtAdvancedEditor').removeClass('xtAdvancedEditor').addClass('noEditor_xtAdvancedEditor');
}
jQuery(this).hide();
jQuery(this).parent().find('.show, .xt-show').show();
jQuery.ajax({url: ''});
checkTinyMCE = false;
}
catch(exc2){
window.status = exc2;
}
return false;
});
jQuery('.editor-controller .show, .editor-controller .xt-show').click(function(){
try{
if(jQuery('textarea.noEditor_xtAdvancedEditor').length>0){
jQuery('textarea.noEditor_xtAdvancedEditor').removeClass('noEditor_xtAdvancedEditor').addClass('xtAdvancedEditor');
if(!advancedEditorInitialized){
initializeAdvancedEditor();
}
else{
jQuery('textarea.xtAdvancedEditor').tinymce().show();
}
}
if(jQuery('textarea.noEditor_xtSimpleEditor').length>0){
jQuery('textarea.noEditor_xtSimpleEditor').removeClass('noEditor_xtSimpleEditor').addClass('xtSimpleEditor');
if(!simpleEditorInitialized){
initializeSimpleEditor();
}
else{
jQuery('textarea.xtSimpleEditor').tinymce().show();
}
}
jQuery(this).hide();
jQuery(this).parent().find('.hide, .xt-hide').show();
jQuery.ajax({url: ''});
checkTinyMCE = true;
}
catch(ex){
window.status = ex;
}
return false;
});
jQuery('.editor-controller .show').hide();
jQuery('.editor-controller .hide').hide();
if(jQuery('textarea.xtSimpleEditor').length>0){
initializeSimpleEditor();
}
if(jQuery('textarea.xtAdvancedEditor').length>0){
initializeAdvancedEditor();
}
});
function initializeAdvancedEditor(){
jQuery('textarea.xtAdvancedEditor').tinymce({
mode : 'textareas',
theme : 'advanced',
plugins : 'table,iespell,noneditable,insertdatetime,searchreplace,contextmenu,advimage,safari,fullscreen,template,paste,style',
theme_advanced_buttons1_add_before : 'fontselect,fontsizeselect',
theme_advanced_buttons2_add : 'cut,copy,paste,pastetext,separator,forecolor,backcolor',
theme_advanced_buttons2_add_before: 'search,replace,separator',
theme_advanced_buttons3_add_before : 'fullscreen,tablecontrols,separator,template,library,styleprops',
theme_advanced_toolbar_location : 'top',
theme_advanced_toolbar_align : 'left',
theme_advanced_path_location : 'bottom',
plugin_insertdate_dateFormat : '%d-%m-%Y',
plugin_insertdate_timeFormat : '%H:%M:%S',
convert_urls : false,
verify_css_classes: false,
theme_advanced_resizing : true,
width : '100%',
height:'600',
force_p_newlines : false,
fullscreen_new_window : false,
convert_fonts_to_spans : true,
fix_table_elements : true,
fullscreen_settings : { theme_advanced_path_location : 'top' },
extended_valid_elements:'iframe[src|width|height|name|align]',
invalid_elements : 'font,big,small,strike,pre',
fix_nesting : true,
entity_encoding : 'raw',
formats : {
bold : {'inline' : 'span', 'styles' : {'font-weight':'bold'}},
italic : {'inline' : 'span', 'styles' : {'font-style':'italic'}},
underline : {'inline' : 'span', 'styles' : {'text-decoration':'underline'}},
strikethrough : {'inline' : 'span', 'styles' : {'text-decoration':'line-through'}}
},
paste_remove_styles : true,
inline_styles : false,
keep_styles : false,
inline_styles: true,
keep_styles : true,
paste_remove_styles: false,
font_size_style_values: '9px,10px,12px,14px,18px,24px,36px',
language: '',
relative_urls: ,
content_css: '',
content_css: '',
forced_root_block : 'div',
readonly :
});
advancedEditorInitialized = true;
}
function initializeSimpleEditor(){
jQuery('textarea.xtSimpleEditor').tinymce({
mode : 'textareas',
theme : 'advanced',
theme_advanced_buttons1 : 'fontselect,fontsizeselect,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,safari,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink',
theme_advanced_buttons2 : '',
theme_advanced_buttons3 : '',
theme_advanced_toolbar_location : 'top',
theme_advanced_toolbar_align : 'left',
theme_advanced_path_location : 'bottom',
convert_urls : false,
verify_css_classes: false,
theme_advanced_resizing : true,
width : '100%',
height:'250',
force_p_newlines : false,
fix_table_elements:true,
entity_encoding : 'raw',
extended_valid_elements : 'iframe[src|width|height|name|align]',
convert_fonts_to_spans : true,
dialog_type : 'modal',
fix_nesting : true,
formats : {
bold : {'inline' : 'span', 'styles' : {'font-weight':'bold'}},
italic : {'inline' : 'span', 'styles' : {'font-style':'italic'}},
underline : {'inline' : 'span', 'styles' : {'text-decoration':'underline'}},
strikethrough : {'inline' : 'span', 'styles' : {'text-decoration':'line-through'}}
},
paste_remove_styles:true,
inline_styles: false,
keep_styles : false,
inline_styles: true,
keep_styles : true,
paste_remove_styles: false,
font_size_style_values: '9px,10px,12px,14px,18px,24px,36px',
relative_urls: ,
language: '',
content_css: '',
forced_root_block : 'div',
invalid_elements : 'font,big,small,strike,pre',
readonly :
});
simpleEditorInitialized = true;
}