"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Upload/jscripts/bbcodes_sceditor.js" between
mybb_1823.zip and mybb_1824.zip

About: MyBB is a multilingual, standards-compliant and free forum (discussion board) software.

bbcodes_sceditor.js  (mybb_1823):bbcodes_sceditor.js  (mybb_1824)
skipping to change at line 61 skipping to change at line 61
// Add custom MyBB CSS // Add custom MyBB CSS
$('<style type="text/css">' + $('<style type="text/css">' +
'.sceditor-dropdown { text-align: ' + ($('body').css('direction') === 'rtl' ? 'right' : 'left') + '; }' + '.sceditor-dropdown { text-align: ' + ($('body').css('direction') === 'rtl' ? 'right' : 'left') + '; }' +
'</style>').appendTo('body'); '</style>').appendTo('body');
// Update editor to use align= as alignment // Update editor to use align= as alignment
$.sceditor.formats.bbcode $.sceditor.formats.bbcode
.set('align', { .set('align', {
html: function (element, attrs, content) { html: function (element, attrs, content) {
return '<div align="' + (attrs.defaultattr || 'le ft') + '">' + content + '</div>'; return '<div align="' + ($.sceditor.escapeEntitie s(attrs.defaultattr) || 'left') + '">' + content + '</div>';
}, },
isInline: false isInline: false
}); });
$.each(mybbCmd.align, function (i, val) { $.each(mybbCmd.align, function (i, val) {
$.sceditor.formats.bbcode.set(val, { $.sceditor.formats.bbcode.set(val, {
format: '[align=' + val + ']{0}[/align]' format: '[align=' + val + ']{0}[/align]'
}); });
$.sceditor.command $.sceditor.command
.set(val, { .set(val, {
txtExec: ['[align=' + val + ']', '[/align]'] txtExec: ['[align=' + val + ']', '[/align]']
skipping to change at line 171 skipping to change at line 171
if (!isNaN(attrs.defaultattr)) { if (!isNaN(attrs.defaultattr)) {
size = attrs.defaultattr; size = attrs.defaultattr;
if (size > 7) if (size > 7)
size = 7; size = 7;
if (size < 1) if (size < 1)
size = 1; size = 1;
} }
if (size < 0) { if (size < 0) {
size = 0; size = 0;
} }
return '<font data-scefontsize="' + attrs.defaultattr + ' " size="' + size + '">' + content + '</font>'; return '<font data-scefontsize="' + $.sceditor.escapeEnti ties(attrs.defaultattr) + '" size="' + size + '">' + content + '</font>';
} }
}); });
$.sceditor.command.set('size', { $.sceditor.command.set('size', {
_dropDown: function (editor, caller, callback) { _dropDown: function (editor, caller, callback) {
var content = $('<div />'), var content = $('<div />'),
clickFunc = function (e) { clickFunc = function (e) {
callback($(this).data('size')); callback($(this).data('size'));
editor.closeDropDown(true); editor.closeDropDown(true);
e.preventDefault(); e.preventDefault();
skipping to change at line 221 skipping to change at line 221
); );
} }
}); });
// Update quote to support pid and dateline // Update quote to support pid and dateline
$.sceditor.formats.bbcode.set('quote', { $.sceditor.formats.bbcode.set('quote', {
format: function (element, content) { format: function (element, content) {
var author = '', var author = '',
$elm = $(element), $elm = $(element),
$cite = $elm.children('cite').first(); $cite = $elm.children('cite').first();
$cite.html($cite.text());
if ($cite.length === 1 || $elm.data('author')) { if ($cite.length === 1 || $elm.data('author')) {
author = $cite.text() || $elm.data('author'); author = $cite.text() || $elm.data('author');
$elm.data('author', author); $elm.data('author', author);
$cite.remove(); $cite.remove();
content = this.elementToBbcode(element); content = this.elementToBbcode(element);
author = '=' + author.replace(/(^\s+|\s+$)/g, '') ; author = '=' + author.replace(/(^\s+|\s+$)/g, '') ;
skipping to change at line 247 skipping to change at line 246
if ($elm.data('dateline')) if ($elm.data('dateline'))
author += " dateline='" + $elm.data('dateline') + "'"; author += " dateline='" + $elm.data('dateline') + "'";
return '[quote' + author + ']' + content + '[/quote]'; return '[quote' + author + ']' + content + '[/quote]';
}, },
html: function (token, attrs, content) { html: function (token, attrs, content) {
var data = ''; var data = '';
if (attrs.pid) if (attrs.pid)
data += ' data-pid="' + attrs.pid + '"'; data += ' data-pid="' + $.sceditor.escapeEntities (attrs.pid) + '"';
if (attrs.dateline) if (attrs.dateline)
data += ' data-dateline="' + attrs.dateline + '"' ; data += ' data-dateline="' + $.sceditor.escapeEnt ities(attrs.dateline) + '"';
if (typeof attrs.defaultattr !== "undefined") if (typeof attrs.defaultattr !== "undefined")
content = '<cite>' + attrs.defaultattr.replace(/ /g, '&nbsp;') + '</cite>' + content; content = '<cite>' + $.sceditor.escapeEntities(at trs.defaultattr).replace(/ /g, '&nbsp;') + '</cite>' + content;
return '<blockquote' + data + '>' + content + '</blockquo te>'; return '<blockquote' + data + '>' + content + '</blockquo te>';
}, },
quoteType: function (val, name) { quoteType: function (val, name) {
var quoteChar = val.indexOf('"') !== -1 ? "'" : '"'; var quoteChar = val.indexOf('"') !== -1 ? "'" : '"';
return quoteChar + val + quoteChar; return quoteChar + val + quoteChar;
}, },
breakStart: true, breakStart: true,
breakEnd: true breakEnd: true
skipping to change at line 282 skipping to change at line 281
if (typeof font == 'string' && font != '' && font != 'def aultattr') { if (typeof font == 'string' && font != '' && font != 'def aultattr') {
return '[font=' + this.stripQuotes(font) + ']' + content + '[/font]'; return '[font=' + this.stripQuotes(font) + ']' + content + '[/font]';
} else { } else {
return content; return content;
} }
}, },
html: function (token, attrs, content) { html: function (token, attrs, content) {
if (typeof attrs.defaultattr == 'string' && attrs.default attr != '' && attrs.defaultattr != '{defaultattr}') { if (typeof attrs.defaultattr == 'string' && attrs.default attr != '' && attrs.defaultattr != '{defaultattr}') {
return '<font face="' + return '<font face="' +
attrs.defaultattr + $.sceditor.escapeEntities(attrs.defaultat tr) +
'">' + content + '</font>'; '">' + content + '</font>';
} else { } else {
return content; return content;
} }
} }
}); });
// Add MyBB PHP command // Add MyBB PHP command
$.sceditor.formats.bbcode.set('php', { $.sceditor.formats.bbcode.set('php', {
allowsEmpty: true, allowsEmpty: true,
 End of changes. 7 change blocks. 
7 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)