Vergleich jscripts/bbcodes_sceditor.js - 1.8.0 - 1.8.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 63Zeile 63
			}
})
.set('li', { format: '[*]{0}', excludeClosing: true })

			}
})
.set('li', { format: '[*]{0}', excludeClosing: true })

		.set('*', { excludeClosing: true, isInline: false });

		.set('*', { excludeClosing: true, isInline: true });


$.sceditor.command
.set('bulletlist', { txtExec: ['[list]\n[*]', '\n[/list]'] })


$.sceditor.command
.set('bulletlist', { txtExec: ['[list]\n[*]', '\n[/list]'] })

Zeile 78Zeile 78
		format: function($elm, content) {
var fontSize,
sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'],

		format: function($elm, content) {
var fontSize,
sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'],

				size  = $elm.data('scefontsize');

				size = $elm.attr('size');;





			if(!size)
{
fontSize = $elm.css('fontSize');

// Most browsers return px value but IE returns 1-7
if(fontSize.indexOf('px') > -1) {
// convert size to an int
fontSize = fontSize.replace('px', '') - 0;
size = 1;

				if (!size) {
fontSize = $elm.css('fontSize');
// Most browsers return px value but IE returns 1-7
if(fontSize.indexOf('px') > -1) {
// convert size to an int
fontSize = fontSize.replace('px', '') - 0;
size = 1;







					if(fontSize > 9)
size = 1;
if(fontSize > 12)
size = 2;
if(fontSize > 15)
size = 3;
if(fontSize > 17)
size = 4;
if(fontSize > 23)
size = 5;
if(fontSize > 31)
size = 6;
if(fontSize > 47)






						if(fontSize > 9)
size = 2;
if(fontSize > 12)
size = 3;
if(fontSize > 15)
size = 4;
if(fontSize > 17)
size = 5;
if(fontSize > 23)
size = 6;
if(fontSize > 31)
size = 7;
}
else {
size = (~~fontSize) + 1;
}

if(size > 7)

						size = 7;

						size = 7;

 
					if(size < 1)
size = 1;

size = sizes[size-1];
}
else {
size = sizes[size-1];

				}

				}

				else
size = (~~fontSize) + 1;

 




 
			return '[size=' + size + ']' + content + '[/size]';
},
html: function(token, attrs, content) {
var sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'],
size = $.inArray(attrs.defaultattr, sizes)+1;
if (!isNaN(attrs.defaultattr)) {
size = attrs.defaultattr;

				if(size > 7)
size = 7;
if(size < 1)
size = 1;

				if(size > 7)
size = 7;
if(size < 1)
size = 1;


size = sizes[size-1];

 
			}

			}


return '[size=' + size + ']' + content + '[/size]';
},
html: function(token, attrs, content) {
return '<span data-scefontsize="' + attrs.defaultattr + '" style="font-size:' + attrs.defaultattr + '">' + content + '</span>';

			if (size < 0) {
size = 0;
}
return '<font data-scefontsize="' + attrs.defaultattr + '" size="' + size + '">' + content + '</font>';


		}
});


		}
});


Zeile 131Zeile 143
					editor.closeDropDown(true);
e.preventDefault();
};

					editor.closeDropDown(true);
e.preventDefault();
};





			for (var i=1; i <= 7; i++)
content.append($('<a class="sceditor-fontsize-option" data-size="' + i + '" href="#"><font size="' + i + '">' + i + '</font></a>').click(clickFunc));

			for (var i=1; i <= 7; i++)
content.append($('<a class="sceditor-fontsize-option" data-size="' + i + '" href="#"><font size="' + i + '">' + i + '</font></a>').click(clickFunc));





			editor.createDropDown(caller, 'fontsize-picker', content);

			editor.createDropDown(caller, 'fontsize-picker', content);

 
		},
exec: function (caller) {
var editor = this;

$.sceditor.command.get('size')._dropDown(
editor,
caller,
function(fontSize) {
editor.execCommand('fontsize', fontSize);
}
);

		},
txtExec: function(caller) {
var editor = this,

		},
txtExec: function(caller) {
var editor = this,

Zeile 164Zeile 187
			var	author = '',
$elm = $(element),
$cite = $elm.children('cite').first();

			var	author = '',
$elm = $(element),
$cite = $elm.children('cite').first();

 
				$cite.html($cite.text());


if($cite.length === 1 || $elm.data('author'))
{


if($cite.length === 1 || $elm.data('author'))
{

				author = $elm.data('author') || $cite.text();

				author = $cite.text() || $elm.data('author');


$elm.data('author', author);
$cite.remove();

content = this.elementToBbcode($(element));


$elm.data('author', author);
$cite.remove();

content = this.elementToBbcode($(element));

				if($elm.data('pid') || $elm.data('dateline'))
{
author = "='" + author;
}
else
{
author = "=" + author;
}

				author = '=' + author.replace(/(^\s+|\s+$)/g, '');









$elm.prepend($cite);


$elm.prepend($cite);

			}


			}


			if($elm.data('pid'))

			if($elm.data('pid'))

				author += "' pid='" + $elm.data('pid') + "'";


				author += " pid='" + $elm.data('pid') + "'";


			if($elm.data('dateline'))
author += " dateline='" + $elm.data('dateline') + "'";


			if($elm.data('dateline'))
author += " dateline='" + $elm.data('dateline') + "'";


Zeile 195Zeile 212
		},
html: function(token, attrs, content) {
var data = '';

		},
html: function(token, attrs, content) {
var data = '';





			if(attrs.pid)
data += ' data-pid="' + attrs.pid + '"';


			if(attrs.pid)
data += ' data-pid="' + attrs.pid + '"';


Zeile 203Zeile 220
				data += ' data-dateline="' + attrs.dateline + '"';

if(typeof attrs.defaultattr !== "undefined")

				data += ' data-dateline="' + attrs.dateline + '"';

if(typeof attrs.defaultattr !== "undefined")

			{
content = '<cite contenteditable="false">' + attrs.defaultattr.replace(/\s/g, '&nbsp;') + '</cite>' + content;
data += ' data-author="' + attrs.defaultattr + '"';
}

				content = '<cite>' + attrs.defaultattr.replace(/ /g, '&nbsp;') + '</cite>' + content;





return '<blockquote' + data + '>' + content + '</blockquote>';
},


return '<blockquote' + data + '>' + content + '</blockquote>';
},

Zeile 267Zeile 281
	});

$.sceditor.command.set("php", {

	});

$.sceditor.command.set("php", {

		_dropDown: function (editor, caller, html) {

		_dropDown: function (editor, caller) {

			var $content;

			var $content;





			$content = $(
'<div>' +
'<label for="php">' + editor._('PHP') + ':</label> ' +

			$content = $(
'<div>' +
'<label for="php">' + editor._('PHP') + ':</label> ' +

Zeile 281Zeile 295
			setTimeout(function() {
$content.find('#php').focus();
},100);

			setTimeout(function() {
$content.find('#php').focus();
},100);





			$content.find('.button').click(function (e) {
var val = $content.find('#php').val(),
before = '[php]',
end = '[/php]';


			$content.find('.button').click(function (e) {
var val = $content.find('#php').val(),
before = '[php]',
end = '[/php]';


				if (html) {
before = before + html + end;
end = null;
}
else if (val) {
before = before + val + end;
end = null;
}


				if (val) {
before = before + val + end;
end = null;
}






				editor.insert(before, end);
editor.closeDropDown(true);
e.preventDefault();

				editor.insert(before, end);
editor.closeDropDown(true);
e.preventDefault();

Zeile 304Zeile 314
			editor.createDropDown(caller, 'insertphp', $content);
},
exec: function (caller) {

			editor.createDropDown(caller, 'insertphp', $content);
},
exec: function (caller) {

 
			if ($.trim(this.getRangeHelper().selectedRange())) {
this.insert('[php]', '[/php]');
return;
}

			$.sceditor.command.get('php')._dropDown(this, caller);
},
txtExec: ['[php]', '[/php]'],
tooltip: "PHP"

			$.sceditor.command.get('php')._dropDown(this, caller);
},
txtExec: ['[php]', '[/php]'],
tooltip: "PHP"

	});



	});




/******************************
* Update code to support PHP *


/******************************
* Update code to support PHP *

Zeile 332Zeile 346
	});

$.sceditor.command.set("code", {

	});

$.sceditor.command.set("code", {

		_dropDown: function (editor, caller, html) {

		_dropDown: function (editor, caller) {

			var $content;

$content = $(

			var $content;

$content = $(

Zeile 346Zeile 360
			setTimeout(function() {
$content.find('#code').focus();
},100);

			setTimeout(function() {
$content.find('#code').focus();
},100);





			$content.find('.button').click(function (e) {
var val = $content.find('#code').val(),
before = '[code]',
end = '[/code]';


			$content.find('.button').click(function (e) {
var val = $content.find('#code').val(),
before = '[code]',
end = '[/code]';


				if (html) {
before = before + html + end;
end = null;
}
else if (val) {

				if (val) {





					before = before + val + end;
end = null;
}

					before = before + val + end;
end = null;
}

Zeile 369Zeile 379
			editor.createDropDown(caller, 'insertcode', $content);
},
exec: function (caller) {

			editor.createDropDown(caller, 'insertcode', $content);
},
exec: function (caller) {

 
			if ($.trim(this.getRangeHelper().selectedRange())) {
this.insert('[code]', '[/code]');
return;
}

			$.sceditor.command.get('code')._dropDown(this, caller);
},
txtExec: ['[code]', '[/code]'],
});

			$.sceditor.command.get('code')._dropDown(this, caller);
},
txtExec: ['[code]', '[/code]'],
});









	/***************************************
* Update email to support description *
***************************************/

	/***************************************
* Update email to support description *
***************************************/

Zeile 387Zeile 401
				'<div>' +
'<label for="email">' + editor._('E-mail:') + '</label> ' +
'<input type="text" id="email" />' +

				'<div>' +
'<label for="email">' + editor._('E-mail:') + '</label> ' +
'<input type="text" id="email" />' +

				'</div>' +

				'</div>' +

				'<div>' +
'<label for="des">' + editor._('Description (optional):') + '</label> ' +
'<input type="text" id="des" />' +

				'<div>' +
'<label for="des">' + editor._('Description (optional):') + '</label> ' +
'<input type="text" id="des" />' +

Zeile 406Zeile 420
					if(!editor.getRangeHelper().selectedHtml() || description) {
if(!description)
description = val;

					if(!editor.getRangeHelper().selectedHtml() || description) {
if(!description)
description = val;





						editor.wysiwygEditorInsertHtml('<a href="' + 'mailto:' + val + '">' + description + '</a>');

						editor.wysiwygEditorInsertHtml('<a href="' + 'mailto:' + val + '">' + description + '</a>');

					}

					}

					else
editor.execCommand('createlink', 'mailto:' + val);
}

					else
editor.execCommand('createlink', 'mailto:' + val);
}





				editor.closeDropDown(true);
e.preventDefault();
});

editor.createDropDown(caller, 'insertemail', $content);

				editor.closeDropDown(true);
e.preventDefault();
});

editor.createDropDown(caller, 'insertemail', $content);

		},

		},

		exec: function (caller) {
$.sceditor.command.get('email')._dropDown(this, caller);
}
});


		exec: function (caller) {
$.sceditor.command.get('email')._dropDown(this, caller);
}
});







/**************************
* Add MyBB video command *
**************************/
$.sceditor.plugins.bbcode.bbcode.set('video', {
allowsEmpty: true,


/**************************
* Add MyBB video command *
**************************/
$.sceditor.plugins.bbcode.bbcode.set('video', {
allowsEmpty: true,

 
		allowedChildren: ['#', '#newline'],

		tags: {
iframe: {
'data-mybb-vt': null

		tags: {
iframe: {
'data-mybb-vt': null

Zeile 448Zeile 463
					metacafe: '<iframe src="{url}" width="440" height="248" frameborder=0 data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>',
veoh: '<iframe src="{url}" width="410" height="341" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>',
vimeo: '<iframe src="{url}" width="500" height="281" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>',

					metacafe: '<iframe src="{url}" width="440" height="248" frameborder=0 data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>',
veoh: '<iframe src="{url}" width="410" height="341" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>',
vimeo: '<iframe src="{url}" width="500" height="281" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>',

					youtube: '<iframe width="560" height="315" src="{url}" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>'


					youtube: '<iframe width="560" height="315" src="{url}" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>',
twitch: '<iframe src="{url}" frameborder="0" scrolling="no" height="378" width="620" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>'

				};

if(html[attrs.defaultattr])

				};

if(html[attrs.defaultattr])

Zeile 482Zeile 498
					case 'youtube':
matches = content.match(/(?:v=|v\/|embed\/|youtu\.be\/)(.{11})/);
url = matches ? '//www.youtube.com/embed/' + matches[1] : false;

					case 'youtube':
matches = content.match(/(?:v=|v\/|embed\/|youtu\.be\/)(.{11})/);
url = matches ? '//www.youtube.com/embed/' + matches[1] : false;

 
						break;
case 'twitch':
matches = content.match(/twitch\.tv\/(?:[\w+_-]+)\/v\/(\d+)/);
url = matches ? '//player.twitch.tv/?video=v' + matches[1] : false;

						break;
}


						break;
}


Zeile 514Zeile 534
						'<option value="veoh">' + editor._('Veoh') + '</option>' +
'<option value="vimeo">' + editor._('Vimeo') + '</option>' +
'<option value="youtube">' + editor._('Youtube') + '</option>' +

						'<option value="veoh">' + editor._('Veoh') + '</option>' +
'<option value="vimeo">' + editor._('Vimeo') + '</option>' +
'<option value="youtube">' + editor._('Youtube') + '</option>' +

 
						'<option value="twitch">' + editor._('Twitch') + '</option>' +

					'</select>'+
'</div>' +
'<div>' +

					'</select>'+
'</div>' +
'<div>' +

Zeile 548Zeile 569


/*************************************



/*************************************

	 * Remove last bits of table support *

	 * Remove last bits of table, superscript/subscript, youtube and ltr/rtl support *

	 *************************************/

	 *************************************/

	$.sceditor.command.remove('table');
$.sceditor.plugins.bbcode.bbcode.remove('table')
.remove('tr')
.remove('th')
.remove('td');

	$.sceditor.command
.remove('table').remove('subscript').remove('superscript').remove('youtube').remove('ltr').remove('rtl');

$.sceditor.plugins.bbcode.bbcode
.remove('table').remove('tr').remove('th').remove('td').remove('sub').remove('sup').remove('youtube').remove('ltr').remove('rtl');









Zeile 606Zeile 627
				}
});
}

				}
});
}

 



/****************
* Fix url code *
****************/
$.sceditor.plugins.bbcode.bbcode.set('url', {
html: function(token, attrs, content) {

if(!attrs.defaultattr)
attrs.defaultattr = content;

return '<a href="' + $.sceditor.escapeUriScheme($.sceditor.escapeEntities(attrs.defaultattr)) + '">' + content + '</a>';
}
});

});

});