Version 2.2.0 RC-1
This commit is contained in:
1 parent
f73f8bff6d
commit
22f1b963ee
1034 files changed
+178610
-70897
No files matched your search
@@ -0,0 +1,103 @@
|
||||
var ie_ptags_to_newlines=true;var IPS_editor=new Array();var buttons_update=new Array("bold","italic","underline","justifyleft","justifycenter","justifyright","insertorderedlist","insertunorderedlist");var ips_primary_colors=new Array('#000000','#A0522D','#556B2F','#006400','#483D8B','#000080','#4B0082','#2F4F4F','#8B0000','#FF8C00','#808000','#008000','#008080','#0000FF','#708090','#696969','#FF0000','#F4A460','#9ACD32','#2E8B57','#48D1CC','#4169E1','#800080','#808080','#FF00FF','#FFA500','#FFFF00','#00FF00','#00FFFF','#00BFFF','#9932CC','#C0C0C0','#FFC0CB','#F5DEB3','#FFFACD','#98FB98','#AFEEEE','#ADD8E6','#DDA0DD','#FFFFFF');var ips_primary_fonts=new Array("Arial","Arial Black","Arial Narrow","Book Antiqua","Century Gothic","Comic Sans MS","Courier New","Franklin Gothic Medium","Garamond","Georgia","Impact","Lucida Console","Lucida Sans Unicode","Microsoft Sans Serif","Palatino Linotype","Tahoma","Times New Roman","Trebuchet MS","Verdana");var ips_primary_sizes=new Array(1,2,3,4,5,6,7);var ips_format_items={'cmd_subscript':'Sub-script','cmd_superscript':'Super-script','cmd_strikethrough':'Strikethrough'};var ips_format_item_images={'cmd_subscript':'rte-subscript.gif','cmd_superscript':'rte-superscript.gif','cmd_strikethrough':'rte-strike.gif'};ips_language_array={};function ips_text_editor(editor_id,mode,use_bbcode,file_path,initial_text){this.editor_id=editor_id;this.is_rte=mode;this.initialized=false;this.buttons=new Array();this.fonts=new Array();this.state=new Array();this.text_obj=document.getElementById(this.editor_id+'_textarea');this.control_obj=document.getElementById(this.editor_id+'_controls');this.font_obj=document.getElementById(this.editor_id+'_out_fontname');this.size_obj=document.getElementById(this.editor_id+'_out_fontsize');this.special_obj=document.getElementById(this.editor_id+'_out_special');this.format_obj=document.getElementById(this.editor_id+'_out_format');this.mainbar=document.getElementById(this.editor_id+'_main-bar');this.use_menus=(typeof(ipsmenu)=='undefined'?false:true);this.is_ie=is_ie;this.is_moz=is_moz;this.is_opera=is_opera;this.is_safari=is_safari;this.file_path=file_path?file_path:global_rte_includes_url;this.font_state=null;this.size_state=null;this.use_bbcode=use_bbcode;this.open_brace=this.use_bbcode?'[':'<';this.close_brace=this.use_bbcode?']':'>';this.allow_advanced=this.use_bbcode?0:1;this.ips_frame_html='';this.popups=new Array();this.char_set=global_rte_char_set?global_rte_char_set:'UTF-8';this.forum_fix_ie_newlines=0;this.emoticon_window_id='';this.is_loading=0;this.hidden_objects=new Array();this.history_pointer=-1;this.history_recordings=new Array();this._showing_html=0;this._ie_cache=null;this.current_bar_object=null;this.ips_special_items={};ips_format_items['cmd_subscript']=ips_language_array['js_rte_sub']?ips_language_array['js_rte_sub']:'Sub-script';ips_format_items['cmd_superscript']=ips_language_array['js_rte_sup']?ips_language_array['js_rte_sup']:'Super-script';ips_format_items['cmd_strikethrough']=ips_language_array['js_rte_strike']?ips_language_array['js_rte_strike']:'Strikethrough';this.init=function(){if(this.initialized){return;}this.control_obj.style.display='';try{document.getElementById(this.editor_id+'_wysiwyg_used').value=parseInt(this.is_rte);}catch(err){}this.ips_frame_html=this.get_frame_html();this.editor_set_content(initial_text);this.editor_set_functions();this.editor_set_controls();this.initialized=true;};this.get_frame_html=function(){var ips_frame_html="";ips_frame_html+="<html id=\""+this.editor_id+"_html\">\n";ips_frame_html+="<head>\n";ips_frame_html+="<meta http-equiv=\"content-type\" content=\"text/html; charset="+this.char_set+"\" />";ips_frame_html+="<style type='text/css' media='all'>\n";ips_frame_html+="body {\n";ips_frame_html+=" background: #FFFFFF;\n";ips_frame_html+=" margin: 0px;\n";ips_frame_html+=" padding: 4px;\n";ips_frame_html+=" font-family: Verdana, arial, sans-serif;\n";ips_frame_html+=" font-size: 10pt;\n";ips_frame_html+="}\n";ips_frame_html+="</style>\n";ips_frame_html+="</head>\n";ips_frame_html+="<body>\n";ips_frame_html+="{:content:}\n";ips_frame_html+="</body>\n";ips_frame_html+="</html>";return ips_frame_html;};this.editor_check_focus=function(){if(!this.editor_window.has_focus){if(this.is_opera){this.editor_window.focus();}this.editor_window.focus();}};this.editor_set_controls=function(){var controls=new Array();var _c=0;if(!this.control_obj){return;}var items=this.control_obj.getElementsByTagName("DIV");for(var i=0;i<items.length;i++){if((items[i].className=='rte-normal'||items[i].className=='rte-menu-button'||items[i].className=='rte-normal-menubutton')&&items[i].id){controls[controls.length]=items[i].id;}}for(var i=0;i<controls.length;i++){var control=document.getElementById(controls[i]);if(control.className=='rte-normal'){this.init_editor_button(control);}else if(control.className=='rte-menu-button'||control.className=='rte-normal-menubutton'){this.init_editor_popup_button(control);}}ipsclass.seLine truncated
|
||||
{
|
||||
this.editor_document.selectionStart = open;
|
||||
this.editor_document.selectionEnd = open + text.length;
|
||||
this.editor_document.scrollTop = st;
|
||||
}
|
||||
}
|
||||
else if ( ( document.selection && document.selection.createRange ) || this._ie_cache )
|
||||
{
|
||||
var sel = this._ie_cache ? this._ie_cache : document.selection.createRange();
|
||||
sel.text = text.replace(/\r?\n/g, '\r\n');
|
||||
sel.select();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.editor_document.value += text;
|
||||
}
|
||||
this._ie_cache = null;
|
||||
};
|
||||
this.insert_emoticon = function( emo_id, emo_image, emo_code, event )
|
||||
{
|
||||
emo_code = this.unhtmlspecialchars( emo_code );
|
||||
this.wrap_tags_lite( " " + emo_code, " ");
|
||||
if ( this.is_ie )
|
||||
{
|
||||
if ( IPS_editor[ this.editor_id ].emoticon_window_id != '' && typeof( IPS_editor[ this.editor_id ].emoticon_window_id ) != 'undefined' )
|
||||
{
|
||||
IPS_editor[ this.editor_id ].emoticon_window_id.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.insertorderedlist = function(e)
|
||||
{
|
||||
this.insertlist( 'ol');
|
||||
};
|
||||
this.insertunorderedlist = function(e)
|
||||
{
|
||||
this.insertlist( 'ul');
|
||||
};
|
||||
this.insertlist = function( list_type )
|
||||
{
|
||||
var open_tag;
|
||||
var close_tag;
|
||||
var item_open_tag = '<li>';
|
||||
var item_close_tag = '</li>';
|
||||
var regex = '';
|
||||
var all_add = '';
|
||||
if ( this.use_bbcode )
|
||||
{
|
||||
regex = new RegExp('([\r\n]+|^[\r\n]*)(?!\\[\\*\\]|\\[\\/?list)(?=[^\r\n])', 'gi');
|
||||
open_tag = list_type == 'ol' ? '[list=1]\n' : '[list]\n';
|
||||
close_tag = '[/list]';
|
||||
item_open_tag = '[*]';
|
||||
item_close_tag = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
regex = new RegExp('([\r\n]+|^[\r\n]*)(?!<li>|<\\/?ol|ul)(?=[^\r\n])', 'gi');
|
||||
open_tag = list_type == 'ol' ? '<ol>\n' : '<ul>\n';
|
||||
close_tag = list_type == 'ol' ? '</ol>\n' : '</ul>\n';
|
||||
}
|
||||
if ( text = this.get_selection() )
|
||||
{
|
||||
text = open_tag + text.replace( regex, "\n" + item_open_tag + '$1' + item_close_tag ) + '\n' + close_tag;
|
||||
if ( this.use_bbcode )
|
||||
{
|
||||
text = text.replace( new RegExp( '\\[\\*\\][\r\n]', 'gi' ), item_open_tag );
|
||||
}
|
||||
this.insert_text( text );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( this.is_moz )
|
||||
{
|
||||
this.insert_text( open_tag + close_tag );
|
||||
while ( val = prompt( ipb_global_lang['editor_enter_list'], '') )
|
||||
{
|
||||
this.insert_text( open_tag + all_add + item_open_tag + val + item_close_tag + '\n' + close_tag );
|
||||
all_add += item_open_tag + val + item_close_tag + '\n';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.insert_text( open_tag );
|
||||
while ( val = prompt( ipb_global_lang['editor_enter_list'], '') )
|
||||
{
|
||||
this.insert_text( item_open_tag + val + item_close_tag + '\n' );
|
||||
}
|
||||
this.insert_text( close_tag );
|
||||
}
|
||||
}
|
||||
};
|
||||
this.unlink = function()
|
||||
{
|
||||
var text = this.get_selection();
|
||||
var link_regex = '';
|
||||
var link_text = '';
|
||||
if ( text !== false )
|
||||
{
|
||||
if ( text.match( link_regex ) )
|
||||
{
|
||||
text = ( this.use_bbcode ) ? text.replace( /\[url=([^\]]+?)\]([^\[]+?)\[\/url\]/ig, "$2" )
|
||||
: text.replace( /<a href=['\"]([^\"']+?)['\"]([^>]+?)?>(.+?)<\/a>/ig,"$3");}this.insert_text(text);}};this.undo=function(){this.history_record_state(this.editor_get_contents());this.history_time_shift(-1);if((text=this.history_fetch_recording())!==false){this.editor_document.value=text;}};this.redo=function(){this.history_time_shift(1);if((text=this.history_fetch_recording())!==false){this.editor_document.value=text;}};this.update_for_form_submit=function(subjecttext,minchars){return true;};}this.___SAFARI_FUNCTIONS=function(){};if(this.is_safari){try{document.getElementById(this.editor_id+'_cmd_switcheditor').style.display='none';}catch(error){}}this.___IPB_FUNCTIONS=function(){};this.createlink=function(e){var _text=this.get_selection();_text=_text.replace( /\n|\r|<br \/>/g,'');if(_text.match( /(<a href|\[url)/ig)){this.format_text(e,"unlink",false);}else{var _url=prompt(ipb_global_lang['editor_enter_url'],'http://');if(!_url||_url==null||_url=='http://'){return false;}_text=_text?_text:prompt(ipb_global_lang['editor_enter_title']);if(!_text||_text==null){return false;}this.wrap_tags('url',_url,_text);}};this.insertemail=function(e){var _text=this.get_selection();_text=_text.replace( /\n|\r|<br \/>/g,'');if(_text.match( /(<a href|\[email)/ig)){this.format_text(e,"unlink",false);}else{var _url=prompt(ipb_global_lang['editor_enter_email'],'');if(!_url||_url==null){return false;}_text=_text?_text:prompt(ipb_global_lang['editor_enter_title']);if(!_text||_text==null){return false;}this.wrap_tags('email',_url,_text);}};this.insertimage=function(){var _text=this.get_selection();_text=_text.replace( /\n|\r|<br \/>/g,'');var _url=prompt(ipb_global_lang['editor_enter_image'],_text?_text:"http://");if(!_url||_url==null||_url=='http://'){return false;}if(!this.is_rte){this.wrap_tags('img',false,_url);}else{this.wrap_tags('img',_url,'');}};this.ipb_quote=function(){this.wrap_tags_lite('[quote]','[/quote]',0)};this.ipb_code=function(){this.wrap_tags_lite('[code]','[/code]',0)};this.init();}function ips_editor_events(){}ips_editor_events.prototype.button_onmouse_event=function(e){if(is_ie){e=ipsclass.cancel_bubble(e,true);}if(e.type=='click'){IPS_editor[this.editor_id].format_text(e,this.cmd,false,true);}IPS_editor[this.editor_id].set_button_context(this,e.type);};ips_editor_events.prototype.special_onmouse_event=function(e){e=ipsclass.cancel_bubble(e,true);if(e.type=='click'){if(!this.loader_key){IPS_editor[this.editor_id].format_text(e,this.cmd,false,true);ipsmenu.close();}else{IPS_editor[this.editor_id].module_load(this,e,this.loader_key);}}IPS_editor[this.editor_id].set_button_context(this,e.type,'menu');};ips_editor_events.prototype.editor_window_onfocus=function(e){this.has_focus=true;};ips_editor_events.prototype.editor_window_onblur=function(e){this.has_focus=false;};ips_editor_events.prototype.editor_document_onmouseup=function(e){try{if(typeof(this.editor_id=='undefined')&&is_moz){this.editor_id=e.view.editor_id;}}catch(me){}IPS_editor[this.editor_id].set_context();menu_action_close();};ips_editor_events.prototype.editor_document_onkeyup=function(e){IPS_editor[this.editor_id].set_context();};ips_editor_events.prototype.editor_document_onkeypress=function(e){if(e.ctrlKey){switch(String.fromCharCode(e.charCode).toLowerCase()){case 'b':cmd='bold';break;case 'i':cmd='italic';break;case 'u':cmd='underline';break;default:return;}e.preventDefault();IPS_editor[this.editor_id].apply_formatting(cmd,false,null);return false;}};ips_editor_events.prototype.popup_button_onmouseevent=function(e){e=ipsclass.cancel_bubble(e,true);if(e.type=='click'){this._onclick(e);IPS_editor[this.editor_id].set_menu_context(this,'mouseover');}else{IPS_editor[this.editor_id].set_menu_context(this,e.type);}};ips_editor_events.prototype.popup_button_show=function(obj){if(typeof IPS_editor[obj.editor_id].popups[obj.cmd]=='undefined'||IPS_editor[obj.editor_id].popups[obj.cmd]==null){IPS_editor[obj.editor_id].init_editor_menu(obj);}this._open(obj);};ips_editor_events.prototype.menu_option_onmouseevent=function(e){e=ipsclass.cancel_bubble(e,true);IPS_editor[this.editor_id].set_button_context(this,e.type,'menu');};ips_editor_events.prototype.font_format_option_onclick=function(e){IPS_editor[this.editor_id].format_text(e,this.cmd,this.firstChild.innerHTML);ipsmenu.close();};ips_editor_events.prototype.emoticon_onclick=function(e){e=ipsclass.cancel_bubble(e,true);IPS_editor[this.editor_id].insert_emoticon(this.emo_id,this.emo_image,this.emo_code,e);ipsmenu.close();};ips_editor_events.prototype.color_cell_onclick=function(e){IPS_editor[this.editor_id].format_text(e,this.cmd,this.colorname);ipsmenu.close();};ips_editor_events.prototype.editor_document_onkeydown=function(e){};
|
||||
Reference in new issue
Block a user