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;
checkTinyMCE = false;
if(jQuery('textarea.xtSimpleEditor').length>0){
var _c = '';
_c = jQuery('textarea.xtSimpleEditor').tinymce().getContent();
try{
jQuery('textarea.xtSimpleEditor').tinymce().remove();
}
catch(exc){
//window.alert("tinymce().remove(): " + 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());
try{
jQuery('textarea.xtAdvancedEditor').tinymce().remove();
}
catch(exc){
//window.alert("tinymce().remove(): " + exc);
}
jQuery('textarea.xtAdvancedEditor').removeClass('xtAdvancedEditor').addClass('noEditor_xtAdvancedEditor');
}
jQuery(this).hide();
jQuery(this).parent().find('.show, .xt-show').show();
jQuery.ajax({url: ''});
}
catch(exc2){
window.alert(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',
content_css : "",
theme : 'modern',
plugins : 'table paste image noneditable insertdatetime searchreplace fullscreen link textcolor hr template lists',
image_advtab: true,
paste_as_text : true,
image_class_list: [
{title: 'Nessuna', value: ' '},
{title: 'Allinea a sinistra', value: 'xt-img-align-left'},
{title: 'Allinea a destra', value: 'xt-img-align-right'},
{title: 'Adatta alla larghezza massima della finestra', value: 'img-responsive'}
],
plugin_insertdate_dateFormat : '%d-%m-%Y',
plugin_insertdate_timeFormat : '%H:%M:%S',
toolbar: "undo redo paste | styleselect | bold italic removeformat | numlist bullist | alignleft aligncenter alignright | link image | forecolor backcolor | fullscreen ",
convert_urls : false,
verify_css_classes: false,
theme_advanced_resizing : true,
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]',
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'}}
},
font_size_style_values: '9px,10px,12px,14px,18px,24px,36px',
language: '',
link_list : '',
image_list : '',
relative_urls: ,
forced_root_block : '',
invalid_elements : 'font,big,small,strike,pre'
});
advancedEditorInitialized = true;
}
function initializeSimpleEditor(){
jQuery('textarea.xtSimpleEditor').tinymce({
mode : 'textareas',
theme : 'modern',
convert_urls : false,
plugins : 'link textcolor lists',
toolbar: "undo redo paste | styleselect | bold italic removeformat | numlist bullist | alignleft aligncenter alignright | link | forecolor backcolor",
theme_advanced_resizing : true,
height:'250',
paste_as_text : true,
force_p_newlines : false,
fix_table_elements:true,
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'}}
},
relative_urls: ,
language: '',
link_list : '',
forced_root_block : '',
invalid_elements : 'font,big,small,strike,pre'
});
simpleEditorInitialized = true;
}