Browse Source

Merge pull request #599 from emanuele45/sceditor_1.4.4

Sceditor 1.4.4
Arantor 10 năm trước cách đây
mục cha
commit
8486deade0

+ 3 - 3
Sources/ManageAttachments.php

@@ -2720,6 +2720,9 @@ function TransferAttachments()
 			$moved = array();
 			while ($row = $smcFunc['db_fetch_assoc']($request))
 			{
+				$source = getAttachmentFilename($row['filename'], $row['id_attach'], $row['id_folder'], false, $row['file_hash']);
+				$dest = $modSettings['attachmentUploadDir'][$new_dir] . '/' . basename($source);
+
 				// Size and file count check
 				if (!empty($modSettings['attachmentDirSizeLimit']) || !empty($modSettings['attachmentDirFileLimit']))
 				{
@@ -2755,9 +2758,6 @@ function TransferAttachments()
 					}
 				}
 
-				$source = getAttachmentFilename($row['filename'], $row['id_attach'], $row['id_folder'], false, $row['file_hash']);
-				$dest = $modSettings['attachmentUploadDir'][$new_dir] . '/' . basename($source);
-
 				if (@rename($source, $dest))
 				{
 					$total_moved++;

+ 1 - 0
Sources/Subs-Editor.php

@@ -1478,6 +1478,7 @@ function create_control_richedit($editorOptions)
 		loadJavascriptFile('editor.js', array('default_theme' => true), 'smf_editor');
 		loadJavascriptFile('jquery.sceditor.js', array('default_theme' => true));
 		loadJavascriptFile('jquery.sceditor.bbcode.js', array('default_theme' => true));
+		loadJavascriptFile('jquery.sceditor.smf.js', array('default_theme' => true));
 		addInlineJavascript('
 		var smf_smileys_url = \'' . $settings['smileys_url'] . '\';
 		var bbc_quote_from = \'' . addcslashes($txt['quote_from'], "'") . '\';

+ 2 - 2
Sources/Subs.php

@@ -994,8 +994,8 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
 			array(
 				'tag' => 'acronym',
 				'type' => 'unparsed_equals',
-				'before' => '<acronym title="$1">',
-				'after' => '</acronym>',
+				'before' => '<abbr title="$1">',
+				'after' => '</abbr>',
 				'quoted' => 'optional',
 				'disabled_after' => ' ($1)',
 			),

+ 6 - 2
Themes/default/GenericControls.template.php

@@ -31,12 +31,16 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 			$(document).ready(function() {
 				', !empty($context['bbcodes_handlers']) ? $context['bbcodes_handlers'] : '', '
 
-				$("#', $editor_id, '").sceditorBBCodePlugin({
+				$("#', $editor_id, '").sceditor({
 					style: "', $settings['default_theme_url'], '/css/jquery.sceditor.default.css",
 					emoticonsCompat: true,',
 					!empty($editor_context['locale']) ? '
 					locale: \'' . $editor_context['locale'] . '\',' : '', '
-					colors: "black,red,yellow,pink,green,orange,purple,blue,beige,brown,teal,navy,maroon,limegreen,white"';
+					colors: "black,red,yellow,pink,green,orange,purple,blue,beige,brown,teal,navy,maroon,limegreen,white",
+					plugins: "bbcode",
+					parserOptions: {
+						quoteType: $.sceditor.BBCodeParser.QuoteType.auto
+					}';
 
 		// Show the smileys.
 		if ((!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) && !$editor_context['disable_smiley_box'] && $smileyContainer !== null)

+ 2 - 2
Themes/default/css/jquery.sceditor.css

@@ -115,9 +115,9 @@ div.sceditor-smileyPopup {
 }
 .sceditor-fontsize-option, .sceditor-font-option {
 	display: block;
-	padding: 4px 6px;
+	padding: 6px;
 	cursor: pointer;
-	font-size: 14px;
+	font-size: 1.2em;
 	text-decoration: none;
 	color: #222;
 }

+ 27 - 1
Themes/default/languages/Editor.english.php

@@ -43,7 +43,7 @@ $editortxt['URL:'] = 'URL:';
 $editortxt['Insert a link'] = 'Insert a link';
 $editortxt['Unlink'] = 'Unlink';
 $editortxt['More'] = 'More';
-$editortxt['Insert an emoticon'] = 'Insert an emoticon';
+$editortxt['Insert an emoticon'] = 'Insert a smiley';
 $editortxt['Video URL:'] = 'Video URL:';
 $editortxt['Insert'] = 'Insert';
 $editortxt['Insert a YouTube video'] = 'Insert a YouTube video';
@@ -52,5 +52,31 @@ $editortxt['Insert current time'] = 'Insert current time';
 $editortxt['Print'] = 'Print';
 $editortxt['Preformatted Text'] = 'Preformatted Text';
 $editortxt['View source'] = 'View source';
+$editortxt['Marquee'] = 'Marquee';
+$editortxt['Teletype'] = 'Teletype';
+$editortxt['Glow'] = 'Glow';
+$editortxt['Shadow'] = 'Shadow';
+$editortxt['Pre'] = 'Preformatted text';
+// @todo flash doesn't seem to be there
+$editortxt['flash'] = 'Insert Flash';
 
+$editortxt['Insert FTP Link'] = 'Insert FTP Link';
+
+// @todo Not sure if these are really needed
+$editortxt['Black'] = 'Black';
+$editortxt['Red'] = 'Red';
+$editortxt['Yellow'] = 'Yellow';
+$editortxt['Pink'] = 'Pink';
+$editortxt['Green'] = 'Green';
+$editortxt['Orange'] = 'Orange';
+$editortxt['Purple'] = 'Purple';
+$editortxt['Blue'] = 'Blue';
+$editortxt['Beige'] = 'Beige';
+$editortxt['Brown'] = 'Brown';
+$editortxt['Teal'] = 'Teal';
+$editortxt['Navy'] = 'Navy';
+$editortxt['Maroon'] = 'Maroon';
+$editortxt['Lime Green'] = 'Lime Green';
+$editortxt['White'] = 'White';
+// end @todo
 ?>

+ 52 - 52
Themes/default/languages/Post.english.php

@@ -9,35 +9,35 @@ $txt['subject_not_filled'] = 'The subject field was not filled out. It is requir
 $txt['message_body_not_filled'] = 'The message body was not filled out. It is required.';
 // Use numeric entities in the below string.
 $txt['add_bbc'] = 'Add BBC tags';
-$txt['bold'] = 'Bold';
-$txt['italic'] = 'Italicized';
-$txt['underline'] = 'Underline';
-$txt['center'] = 'Centered';
-$txt['hyperlink'] = 'Insert Hyperlink';
-$txt['insert_email'] = 'Insert Email';
-$txt['bbc_code'] = 'Insert Code';
+$txt['bold'] = 'Bold'; // deprecated
+$txt['italic'] = 'Italicized'; // deprecated
+$txt['underline'] = 'Underline'; // deprecated
+$txt['center'] = 'Centered'; // deprecated
+$txt['hyperlink'] = 'Insert Hyperlink'; // deprecated
+$txt['insert_email'] = 'Insert Email'; // deprecated
+$txt['bbc_code'] = 'Insert Code'; // deprecated
 // Escape any single quotes in here twice.. 'it\'s' -> 'it\\\'s'.
-$txt['bbc_quote'] = 'Insert Quote';
-$txt['list'] = 'Insert List';
-$txt['list_unordered'] = 'Insert unordered list';
-$txt['list_ordered'] = 'Insert ordered list';
-
-$txt['change_color'] = 'Change color';
-$txt['black'] = 'Black';
-$txt['red'] = 'Red';
-$txt['yellow'] = 'Yellow';
-$txt['pink'] = 'Pink';
-$txt['green'] = 'Green';
-$txt['orange'] = 'Orange';
-$txt['purple'] = 'Purple';
-$txt['blue'] = 'Blue';
-$txt['beige'] = 'Beige';
-$txt['brown'] = 'Brown';
-$txt['teal'] = 'Teal';
-$txt['navy'] = 'Navy';
-$txt['maroon'] = 'Maroon';
-$txt['lime_green'] = 'Lime Green';
-$txt['white'] = 'White';
+$txt['bbc_quote'] = 'Insert Quote'; // deprecated
+$txt['list'] = 'Insert List'; // deprecated
+$txt['list_unordered'] = 'Insert unordered list'; // deprecated
+$txt['list_ordered'] = 'Insert ordered list'; // deprecated
+
+$txt['change_color'] = 'Change color'; // deprecated
+$txt['black'] = 'Black'; // deprecated
+$txt['red'] = 'Red'; // deprecated
+$txt['yellow'] = 'Yellow'; // deprecated
+$txt['pink'] = 'Pink'; // deprecated
+$txt['green'] = 'Green'; // deprecated
+$txt['orange'] = 'Orange'; // deprecated
+$txt['purple'] = 'Purple'; // deprecated
+$txt['blue'] = 'Blue'; // deprecated
+$txt['beige'] = 'Beige'; // deprecated
+$txt['brown'] = 'Brown'; // deprecated
+$txt['teal'] = 'Teal'; // deprecated
+$txt['navy'] = 'Navy'; // deprecated
+$txt['maroon'] = 'Maroon'; // deprecated
+$txt['lime_green'] = 'Lime Green'; // deprecated
+$txt['white'] = 'White'; // deprecated
 $txt['disable_smileys'] = 'Disable smileys';
 $txt['dont_use_smileys'] = 'Don\'t use smileys.';
 // Escape any single quotes in here twice.. 'it\'s' -> 'it\\\'s'.
@@ -50,33 +50,33 @@ $txt['question_mark'] = 'Question mark';
 $txt['icon_poll'] = 'Poll';
 $txt['lamp'] = 'Lamp';
 $txt['add_smileys'] = 'Add smileys';
-$txt['flash'] = 'Insert Flash';
-$txt['ftp'] = 'Insert FTP Link';
-$txt['image'] = 'Insert image';
-$txt['table'] = 'Insert table';
-$txt['table_td'] = 'Insert table column';
+$txt['flash'] = 'Insert Flash'; // deprecated
+$txt['ftp'] = 'Insert FTP Link'; // deprecated
+$txt['image'] = 'Insert image'; // deprecated
+$txt['table'] = 'Insert table'; // deprecated
+$txt['table_td'] = 'Insert table column'; // deprecated
 $txt['topic_notify_no'] = 'There are no topics with notification.';
-$txt['marquee'] = 'Marquee';
-$txt['teletype'] = 'Teletype';
-$txt['strike'] = 'Strikethrough';
-$txt['glow'] = 'Glow';
-$txt['shadow'] = 'Shadow';
-$txt['preformatted'] = 'Preformatted text';
-$txt['left_align'] = 'Left align';
-$txt['right_align'] = 'Right align';
-$txt['superscript'] = 'Superscript';
-$txt['subscript'] = 'Subscript';
-$txt['table_tr'] = 'Insert table row';
+$txt['marquee'] = 'Marquee'; // deprecated
+$txt['teletype'] = 'Teletype'; // deprecated
+$txt['strike'] = 'Strikethrough'; // deprecated
+$txt['glow'] = 'Glow'; // deprecated
+$txt['shadow'] = 'Shadow'; // deprecated
+$txt['preformatted'] = 'Preformatted text'; // deprecated
+$txt['left_align'] = 'Left align'; // deprecated
+$txt['right_align'] = 'Right align'; // deprecated
+$txt['superscript'] = 'Superscript'; // deprecated
+$txt['subscript'] = 'Subscript'; // deprecated
+$txt['table_tr'] = 'Insert table row'; // deprecated
 // post_too_long seems unused (duplicate in Errors: error_post_too_long
 $txt['post_too_long'] = 'Your message is too long. Please go back and shorten it, then try again.';
-$txt['horizontal_rule'] = 'Horizontal Rule';
-$txt['font_size'] = 'Font size';
-$txt['font_face'] = 'Font face';
-$txt['toggle_view'] = 'Toggle view';
-$txt['unformat_text'] = 'Remove formatting';
-
-$txt['rich_edit_wont_work'] = 'Your browser does not support Rich Text editing.';
-$txt['rich_edit_function_disabled'] = 'Your browser does not support this function.';
+$txt['horizontal_rule'] = 'Horizontal Rule'; // deprecated
+$txt['font_size'] = 'Font size'; // deprecated
+$txt['font_face'] = 'Font face'; // deprecated
+$txt['toggle_view'] = 'Toggle view'; // deprecated
+$txt['unformat_text'] = 'Remove formatting'; // deprecated
+
+$txt['rich_edit_wont_work'] = 'Your browser does not support Rich Text editing.'; // deprecated
+$txt['rich_edit_function_disabled'] = 'Your browser does not support this function.'; // deprecated
 
 // Use numeric entities in the below five strings.
 $txt['notifyUnsubscribe'] = 'Unsubscribe to this topic by clicking here';

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1189 - 17
Themes/default/scripts/jquery.sceditor.bbcode.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2457 - 1011
Themes/default/scripts/jquery.sceditor.js


+ 693 - 0
Themes/default/scripts/jquery.sceditor.smf.js

@@ -0,0 +1,693 @@
+/**
+ * Simple Machines Forum (SMF)
+ *
+ * @package SMF
+ * @author Simple Machines
+ * @copyright 2013 Simple Machines and individual contributors
+ * @license http://www.simplemachines.org/about/smf/license.php BSD
+ *
+ * @version 2.1 Alpha 1
+ */
+
+(function($) {
+	var extensionMethods = {
+		InsertText: function(text, bClear) {
+			var bIsSource = this.inSourceMode();
+
+			// @TODO make it put the quote close to the current selection
+
+			if (!bIsSource)
+				this.toggleSourceMode();
+
+			var current_value = bClear ? text + "\n" : this.getSourceEditorValue(false) + "\n" + text + "\n";
+			this.setSourceEditorValue(current_value);
+
+			if (!bIsSource)
+				this.toggleSourceMode();
+
+		},
+		getText: function(filter) {
+			var current_value = '';
+
+			if(this.inSourceMode())
+				current_value = this.getSourceEditorValue(false);
+			else
+				current_value  = this.getWysiwygEditorValue(filter);
+
+			return current_value;
+		},
+		appendEmoticon: function (code, emoticon) {
+			if (emoticon == '')
+				line.append($('<br />'));
+			else
+				line.append($('<img />')
+					.attr({
+						src: emoticon,
+						alt: code,
+					})
+					.click(function (e) {
+						var	start = '', end = '';
+						
+						if (base.opts.emoticonsCompat)
+						{
+							start = '<span> ';
+							end   = ' </span>';
+						}
+
+						if (base.inSourceMode())
+							base.sourceEditorInsertText(' ' + $(this).attr('alt') + ' ');
+						else
+							base.wysiwygEditorInsertHtml(start + '<img src="' + $(this).attr("src") + '" data-sceditor-emoticon="' + $(this).attr('alt') + '" />' + end);
+
+						e.preventDefault();
+					})
+				);
+
+			if (line.children().length > 0)
+				content.append(line);
+
+			$(".sceditor-toolbar").append(content);
+		},
+		storeLastState: function (){
+			this.wasSource = this.inSourceMode();
+		},
+		setTextMode: function () {
+			if (!this.inSourceMode())
+				this.toggleSourceMode();
+		},
+		createPermanentDropDown: function() {
+			var	emoticons	= $.extend({}, this.opts.emoticons.dropdown);
+			var popup_exists = false;
+			content = $('<div class="sceditor-insertemoticon" />');
+			line = $('<div />');
+			base = this;
+
+			for (smiley_popup in this.opts.emoticons.popup)
+			{
+				popup_exists = true;
+				break;
+			}
+			if (popup_exists)
+			{
+				this.opts.emoticons.more = this.opts.emoticons.popup;
+				moreButton = $('<div class="sceditor-more-button sceditor-more" />').text('[' + this._('More') + ']').click(function () {
+					if ($(".sceditor-smileyPopup").length > 0)
+					{
+						$(".sceditor-smileyPopup").fadeIn('fast');
+					}
+					else
+					{
+						var emoticons = $.extend({}, base.opts.emoticons.popup);
+						var popup_position;
+						var titlebar = $('<div class="catbg sceditor-popup-grip"/>');
+						popupContent = $('<div id="sceditor-popup"/>');
+						allowHide = true;
+						line = $('<div id="sceditor-popup-smiley"/>');
+						adjheight = 0;
+
+						popupContent.append(titlebar);
+						closeButton = $('<span />').text('[' + base._('Close') + ']').click(function () {
+							$(".sceditor-smileyPopup").fadeOut('fast');
+						});
+
+						$.each(emoticons, base.appendEmoticon);
+
+						if (line.children().length > 0)
+							popupContent.append(line);
+						if (typeof closeButton !== "undefined")
+							popupContent.append(closeButton);
+
+						// IE needs unselectable attr to stop it from unselecting the text in the editor.
+						// The editor can cope if IE does unselect the text it's just not nice.
+						if(base.ieUnselectable !== false) {
+							content = $(content);
+							content.find(':not(input,textarea)').filter(function() { return this.nodeType===1; }).attr('unselectable', 'on');
+						}
+
+						$dropdown = $('<div class="sceditor-dropdown sceditor-smileyPopup" />').append(popupContent);
+
+						$dropdown.appendTo($('body'));
+						dropdownIgnoreLastClick = true;
+						adjheight = closeButton.height() + titlebar.height();
+						$dropdown.css({
+							position: "fixed",
+							top: $(window).height() * 0.2,
+							left: $(window).width() * 0.5 - ($dropdown.find('#sceditor-popup-smiley').width() / 2),
+							"max-width": "50%",
+							"max-height": "50%",
+						}).find('#sceditor-popup-smiley').css({
+							height: $dropdown.height() - adjheight,
+							"overflow": "auto"
+						});
+
+						$('.sceditor-smileyPopup').animaDrag({ 
+							speed: 150, 
+							interval: 120, 
+							during: function(e) {
+								$(this).height(this.startheight);
+								$(this).width(this.startwidth);
+							},
+							before: function(e) {
+								this.startheight = $(this).innerHeight();
+								this.startwidth = $(this).innerWidth();
+							},
+							grip: '.sceditor-popup-grip'
+						});
+						// stop clicks within the dropdown from being handled
+						$dropdown.click(function (e) {
+							e.stopPropagation();
+						});
+					}
+				});
+			}
+			$.each(emoticons, base.appendEmoticon);
+			if (typeof moreButton !== "undefined")
+				content.append(moreButton);
+		}
+	};
+
+	$.extend(true, $['sceditor'].prototype, extensionMethods);
+})(jQuery);
+
+$.sceditor.command.set(
+	'ftp', {
+		tooltip: 'Insert FTP Link',
+		txtExec: ["[ftp]", "[/ftp]"],
+		exec: function (caller) {
+			var	editor  = this,
+				content = $(this._('<form><div><label for="link">{0}</label> <input type="text" id="link" value="ftp://" /></div>' +
+						'<div><label for="des">{1}</label> <input type="text" id="des" value="" /></div></form>',
+					this._("URL:"),
+					this._("Description (optional):")
+				))
+				.submit(function () {return false;});
+
+			content.append($(
+				this._('<div><input type="button" class="button" value="{0}" /></div>',
+					this._("Insert")
+				)).click(function (e) {
+				var val = $(this).parent("form").find("#link").val(),
+					description = $(this).parent("form").find("#des").val();
+
+				if(val !== "" && val !== "ftp://") {
+					// needed for IE to reset the last range
+					editor.focus();
+
+					if(!editor.getRangeHelper().selectedHtml() || description)
+					{
+						if(!description)
+							description = val;
+
+						editor.wysiwygEditorInsertHtml('<a href="' + val + '">' + description + '</a>');
+					}
+					else
+						editor.execCommand("createlink", val);
+				}
+
+				editor.closeDropDown(true);
+				e.preventDefault();
+			}));
+
+			editor.createDropDown(caller, "insertlink", content);
+		}
+	}
+);
+$.sceditor.command.set(
+	'glow', {
+		tooltip: 'Glow',
+		txtExec: ["[glow=red,2,300]", "[/glow]"],
+		exec: function () {
+			this.wysiwygEditorInsertHtml('[glow=red,2,300]', '[/glow]');
+		}
+	}
+);
+$.sceditor.command.set(
+	'shadow', {
+		tooltip: 'Shadow',
+		txtExec: ["[shadow=red,left]", "[/shadow]"],
+		exec: function () {
+			this.wysiwygEditorInsertHtml('[shadow=red,left]', '[/shadow]');
+		}
+	}
+);
+$.sceditor.command.set(
+	'tt', {
+		tooltip: 'Teletype',
+		txtExec: ["[tt]", "[/tt]"],
+		exec: function () {
+			this.wysiwygEditorInsertHtml('<tt>', '</tt>');
+		}
+	}
+);
+$.sceditor.command.set(
+	'pre', {
+		tooltip: 'Pre',
+		txtExec: ["[pre]", "[/pre]"],
+		exec: function () {
+			this.wysiwygEditorInsertHtml('<pre>', '</pre>');
+		}
+	}
+);
+$.sceditor.command.set(
+	'move', {
+		tooltip: 'Marquee',
+		txtExec: ["[move]", "[/move]"],
+		exec: function () {
+			this.wysiwygEditorInsertHtml('<marquee>', '</marquee>');
+		}
+	}
+);
+
+$.sceditor.command.set(
+	'email', {
+		txtExec: function(caller, selected) {
+			var	display = selected && selected.indexOf('@') > -1 ? null : selected,
+				email	= prompt(this._("Enter the e-mail address:"), (display ? '' : selected));
+			if (email)
+			{
+				var text	= prompt(this._("Enter the displayed text:"), display || email) || email;
+				this.insertText("[email=" + email + "]" + text + "[/email]");
+			}
+		}
+	}
+);
+$.sceditor.command.set(
+	'link', {
+		txtExec: function(caller, selected) {
+			var	display = selected && selected.indexOf('http://') > -1 ? null : selected,
+				url	= prompt(this._("Enter URL:"), (display ? 'http://' : selected));
+			if (url)
+			{
+				var text	= prompt(this._("Enter the displayed text:"), display || url) || url;
+				this.insertText("[url=" + url + "]" + text + "[/url]");
+			}
+		}
+	}
+);
+
+$.sceditor.command.set(
+	'bulletlist', {
+		txtExec: ["[list]\n[li]", "[/li]\n[li][/li]\n[/list]"]
+	}
+);
+
+$.sceditor.command.set(
+	'orderedlist', {
+		txtExec:  ["[list type=decimal]\n[li]", "[/li]\n[li][/li]\n[/list]"]
+	}
+);
+
+$.sceditor.command.set(
+	'table', {
+		txtExec: ["[table]\n[tr]\n[td]", "[/td]\n[/tr]\n[/table]"]
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'abbr', {
+		tags: {
+			abbr: {
+				title: null
+			}
+		},
+		format: function(element, content) {
+			return '[abbr=' + element.attr('title') + ']' + content + '[/abbr]';
+		},
+		html: function(element, attrs, content) {
+			if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
+				return content;
+
+			return '<abbr title="' + attrs.defaultattr + '">' + content + '</abbr>';
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'acronym', {
+		tags: {
+			acronym: {
+				title: null
+			}
+		},
+		format: function(element, content) {
+			return '[abbr=' + element.attr('title') + ']' + content + '[/abbr]';
+		},
+		html: function(element, attrs, content) {
+			if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
+				return content;
+
+			return '<abbr title="' + attrs.defaultattr + '">' + content + '</abbr>';
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'bdo', {
+		tags: {
+			bdo: {
+				dir: null
+			}
+		},
+		format: function(element, content) {
+			return '[bdo=' + element.attr('dir') + ']' + content + '[/bdo]';
+		},
+		html: function(element, attrs, content) {
+			if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
+				return content;
+			if (attrs.defaultattr != 'rtl' && attrs.defaultattr != 'ltr')
+				return '[bdo=' + attrs.defaultattr + ']' + content + '[/bdo]';
+
+			return '<bdo dir="' + attrs.defaultattr + '">' + content + '</bdo>';
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'black', {
+		html: '<font color="black">{0}</font>'
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'blue', {
+		html: '<font color="blue">{0}</font>'
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'green', {
+		html: '<font color="green">{0}</font>'
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'red', {
+		html: '<font color="red">{0}</font>'
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'white', {
+		html: '<font color="white">{0}</font>'
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'list', {
+		breakStart: true,
+		isInline: false,
+		allowedChildren: ['*', 'li'],
+		html: function(element, attrs, content) {
+			var style = '';
+			var code = 'ul';
+
+			if (attrs.type)
+					style = ' style="list-style-type: ' + attrs.type + '"';
+
+			return '<' + code + style + '>' + content + '</' + code + '>';
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'ul', {
+		tags: {
+			ul: null
+		},
+		breakStart: true,
+		isInline: false,
+		html: '<ul>{0}</ul>',
+		format: function(element, content) {
+			if ($(element[0]).css('list-style-type') == 'disc')
+				return '[list]' + content + '[/list]';
+			else
+				return '[list type=' + $(element[0]).css('list-style-type') + ']' + content + '[/list]';
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'ol', {
+		tags: {
+			ol: null
+		},
+		breakStart: true,
+		isInline: false,
+		format: "[list type=decimal]{0}[/list]",
+		html: '<ol>{0}</ol>'
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'img', {
+		tags: {
+			img: {
+				src: null
+			}
+		},
+		allowsEmpty: true,
+		quoteType: $.sceditor.BBCodeParser.QuoteType.never,
+		format: function(element, content) {
+			var	attribs = '',
+				style = function(name) {
+					return element.style ? element.style[name] : null;
+				};
+
+			// check if this is an emoticon image
+			if(typeof element.attr('data-sceditor-emoticon') !== "undefined")
+				return content;
+
+			// only add width and height if one is specified
+			if(element.attr('width') || style('width'))
+				attribs += " width=" + $(element).width();
+			if(element.attr('height') || style('height'))
+				attribs += " height=" + $(element).height();
+			if(element.attr('alt'))
+				attribs += " alt=" + element.attr('alt');
+
+			return '[img' + attribs + ']' + element.attr('src') + '[/img]';
+		},
+		html: function(token, attrs, content) {
+			var	parts,
+				attribs = '';
+
+			// handle [img width=340 height=240]url[/img]
+			if(typeof attrs.width !== "undefined")
+				attribs += ' width="' + attrs.width + '"';
+			if(typeof attrs.height !== "undefined")
+				attribs += ' height="' + attrs.height + '"';
+			if(typeof attrs.alt !== "undefined")
+				attribs += ' alt="' + attrs.alt + '"';
+
+			return '<img' + attribs + ' src="' + content + '" />';
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'url', {
+		allowsEmpty: true,
+		tags: {
+			a: {
+				href: null
+			}
+		},
+		format: function(element, content) {
+			var url = element.attr('href');
+
+			// make sure this link is not an e-mail, if it is return e-mail BBCode
+			if(url.substr(0, 7) === 'mailto:')
+				return '[email=' + url.substr(7) + ']' + content + '[/email]';
+			// make sure this link is not an ftp, if it is return ftp BBCode
+			else if(url.substr(0, 3) === 'ftp')
+				return '[ftp=' +  url + ']' + content + '[/ftp]';
+
+			if(element.attr('target') !== undefined)
+				return '[url=' + decodeURI(url) + ']' + content + '[/url]';
+			else
+				return '[iurl=' + decodeURI(url) + ']' + content + '[/iurl]';
+		},
+		html: function(token, attrs, content) {
+			if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
+				attrs.defaultattr = content;
+
+			return '<a target="_blank" href="' + encodeURI(attrs.defaultattr) + '">' + content + '</a>';
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'iurl', {
+		allowsEmpty: true,
+		html: function(token, attrs, content) {
+			if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
+				attrs.defaultattr = content;
+
+			return '<a href="' + encodeURI(attrs.defaultattr) + '">' + content + '</a>';
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'ftp', {
+		allowsEmpty: true,
+		html: function(token, attrs, content) {
+			if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
+				attrs.defaultattr = content;
+
+			return '<a target="_blank" href="' + encodeURI(attrs.defaultattr) + '">' + content + '</a>';
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'tt', {
+		tags: {
+			tt: null
+		},
+		format: "[tt]{0}[/tt]",
+		html: '<tt>{0}</tt>'
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'pre', {
+		tags: {
+			pre: null
+		},
+		isBlock: true,
+		format: "[pre]{0}[/pre]",
+		html: "<pre>{0}</pre>\n"
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'move', {
+		tags: {
+			marquee: null
+		},
+		format: "[move]{0}[/move]",
+		html: '<marquee>{0}</marquee>'
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'php', {
+		isInline: false,
+		format: "[php]{0}[/php]",
+		html: '<code class="php">{0}</code>'
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'code', {
+		tags: {
+			code: null
+		},
+		isInline: false,
+		allowedChildren: ['#', '#newline'],
+		format: function(element, content) {
+			if ($(element[0]).hasClass('php'))
+				return '[php]' + content.replace('&#91;', '[') + '[/php]';
+
+			var from = '';
+			if ($(element).children("cite:first").length === 1)
+			{
+				from = $(element).children("cite:first").text();
+
+				$(element).attr({'from': from.php_htmlspecialchars()});
+
+				from = '=' + from;
+				content = '';
+				$(element).children("cite:first").remove();
+				content = this.elementToBbcode($(element));
+			}
+			else
+			{
+				if (typeof $(element).attr('from') != 'undefined')
+				{
+					from = '=' + $(element).attr('from').php_unhtmlspecialchars();
+				}
+			}
+
+			return '[code' + from + ']' + content.replace('&#91;', '[') + '[/code]';
+
+		},
+		html: function(element, attrs, content) {
+			var from = '';
+			if(typeof attrs.defaultattr !== "undefined")
+				from = '<cite>' + attrs.defaultattr + '</cite>';
+
+			return '<code>' + from + content.replace('[', '&#91;') + '</code>'
+		}
+	}
+);
+
+$.sceditorBBCodePlugin.bbcode.set(
+	'quote', {
+		tags: {
+			blockquote: null,
+			cite: null
+		},
+		quoteType: $.sceditor.BBCodeParser.QuoteType.never,
+		breakBefore: false,
+		isInline: false,
+		format: function(element, content) {
+			var author = '';
+			var date = '';
+			var link = '';
+
+			// The <cite> contains only the graphic for the quote, so we can skip it
+			if(element[0].tagName.toLowerCase() === 'cite')
+				return '';
+
+			if(element.attr('author'))
+				author = ' author=' + element.attr('author').php_unhtmlspecialchars();
+			if(element.attr('date'))
+				date = ' date=' + element.attr('date');
+			if(element.attr('link'))
+				link = ' link=' + element.attr('link');
+
+			return '[quote' + author + date + link + ']' + content + '[/quote]';
+		},
+		html: function(element, attrs, content) {
+			var attr_author = '', author = '';
+			var attr_date = '', sDate = '';
+			var attr_link = '', link = '';
+
+			if(typeof attrs.author !== "undefined" && attrs.author)
+			{
+				attr_author = attrs.author;
+				author = bbc_quote_from + ': ' + attr_author;
+			}
+
+			// Links could be in the form: link=topic=71.msg201#msg201 that would fool javascript, so we need a workaround
+			// Probably no more necessary
+			for (var key in attrs)
+			{
+				if (key.substr(0, 4) == 'link' && attrs.hasOwnProperty(key))
+				{
+					var attr_link = key.length > 4 ? key.substr(5) + '=' + attrs[key] : attrs[key];
+
+					link = attr_link.substr(0, 7) == 'http://' ? attr_link : smf_scripturl + '?' + attr_link;
+					author = author == '' ? '<a href="' + link + '">' + bbc_quote_from + ': ' + link + '</a>' : '<a href="' + link + '">' + author + '</a>';
+				}
+			}
+
+			if(typeof attrs.date !== "undefined" && attrs.date)
+			{
+				attr_date = attrs.date;
+				sDate = '<date timestamp="' + attr_date + '">' + new Date(attrs.date * 1000) + '</date>';
+			}
+
+			if (author == '' && sDate == '')
+				author = bbc_quote;
+			else
+				author += ' ' + bbc_search_on;
+
+			content = '<blockquote author="' + attr_author + '" date="' + attr_date + '" link="' + attr_link + '"><cite>' + author + ' ' + sDate + '</cite>' + content + '</blockquote>';
+
+			return content;
+		}
+	}
+);

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác