Zeile 31 | Zeile 31 |
---|
'url': '//mixer.com/embed/player/', 'html': '<iframe allowfullscreen="true" src="{url}" width="620" height="349" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>' },
|
'url': '//mixer.com/embed/player/', 'html': '<iframe allowfullscreen="true" src="{url}" width="620" height="349" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>' },
|
'Vemio': {
| 'Vimeo': {
|
'match': /vimeo.com\/(\d+)($|\/)/, 'url': '//player.vimeo.com/video/', 'html': '<iframe src="{url}" width="500" height="281" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>'
| 'match': /vimeo.com\/(\d+)($|\/)/, 'url': '//player.vimeo.com/video/', 'html': '<iframe src="{url}" width="500" height="281" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>'
|
Zeile 58 | Zeile 58 |
---|
$.sceditor.formats.bbcode .set('align', { html: function (element, attrs, content) {
|
$.sceditor.formats.bbcode .set('align', { html: function (element, attrs, content) {
|
return '<div align="' + (attrs.defaultattr || 'left') + '">' + content + '</div>';
| return '<div align="' + ($.sceditor.escapeEntities(attrs.defaultattr) || 'left') + '">' + content + '</div>';
|
}, isInline: false });
| }, isInline: false });
|
Zeile 107 | Zeile 107 |
---|
$.sceditor.command .set('bulletlist', {
|
$.sceditor.command .set('bulletlist', {
|
txtExec: ['[list]\n[*]', '\n[/list]']
| txtExec: function (caller, selected) { var content = '';
$.each(selected.split(/\r?\n/), function () { content += (content ? '\n' : '') + '[*]' + this; });
this.insertText('[list]\n' + content + '\n[/list]'); }
|
}) .set('orderedlist', {
|
}) .set('orderedlist', {
|
txtExec: ['[list=1]\n[*]', '\n[/list]']
| txtExec: function (caller, selected) { var content = '';
$.each(selected.split(/\r?\n/), function () { content += (content ? '\n' : '') + '[*]' + this; });
this.insertText('[list=1]\n' + content + '\n[/list]'); }
|
});
// Update size tag to use xx-small-xx-large instead of 1-7
| });
// Update size tag to use xx-small-xx-large instead of 1-7
|
Zeile 150 | Zeile 168 |
---|
if (size < 0) { size = 0; }
|
if (size < 0) { size = 0; }
|
return '<font data-scefontsize="' + attrs.defaultattr + '" size="' + size + '">' + content + '</font>';
| return '<font data-scefontsize="' + $.sceditor.escapeEntities(attrs.defaultattr) + '" size="' + size + '">' + content + '</font>';
|
} });
| } });
|
Zeile 200 | Zeile 218 |
---|
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')) { author = $cite.text() || $elm.data('author');
| if ($cite.length === 1 || $elm.data('author')) { author = $cite.text() || $elm.data('author');
|
Zeile 210 | Zeile 227 |
---|
content = this.elementToBbcode(element); author = '=' + author.replace(/(^\s+|\s+$)/g, '');
|
content = this.elementToBbcode(element); author = '=' + author.replace(/(^\s+|\s+$)/g, '');
|
|
|
$elm.prepend($cite); }
|
$elm.prepend($cite); }
|
|
|
if ($elm.data('pid')) author += " pid='" + $elm.data('pid') + "'";
|
if ($elm.data('pid')) author += " pid='" + $elm.data('pid') + "'";
|
|
|
if ($elm.data('dateline')) author += " dateline='" + $elm.data('dateline') + "'";
return '[quote' + author + ']' + content + '[/quote]';
|
if ($elm.data('dateline')) author += " dateline='" + $elm.data('dateline') + "'";
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.escapeEntities(attrs.dateline) + '"';
|
if (typeof attrs.defaultattr !== "undefined")
|
if (typeof attrs.defaultattr !== "undefined")
|
content = '<cite>' + attrs.defaultattr.replace(/ /g, ' ') + '</cite>' + content;
| content = '<cite>' + $.sceditor.escapeEntities(attrs.defaultattr).replace(/ /g, ' ') + '</cite>' + content;
|
return '<blockquote' + data + '>' + content + '</blockquote>'; }, quoteType: function (val, name) {
|
return '<blockquote' + data + '>' + content + '</blockquote>'; }, quoteType: function (val, name) {
|
return "'" + val.replace("'", "\\'") + "'";
| var quoteChar = val.indexOf('"') !== -1 ? "'" : '"';
return quoteChar + val + quoteChar;
|
}, breakStart: true, breakEnd: true
| }, breakStart: true, breakEnd: true
|
Zeile 249 | Zeile 268 |
---|
var font; if (element.nodeName.toLowerCase() !== 'font' || !(font = $(element).attr('face'))) font = $(element).css('font-family');
|
var font; if (element.nodeName.toLowerCase() !== 'font' || !(font = $(element).attr('face'))) font = $(element).css('font-family');
|
|
|
if (typeof font == 'string' && font != '' && font != 'defaultattr') { return '[font=' + this.stripQuotes(font) + ']' + content + '[/font]';
|
if (typeof font == 'string' && font != '' && font != 'defaultattr') { return '[font=' + this.stripQuotes(font) + ']' + content + '[/font]';
|
} else { return content; }
| } else { return content; }
|
}, html: function (token, attrs, content) { if (typeof attrs.defaultattr == 'string' && attrs.defaultattr != '' && attrs.defaultattr != '{defaultattr}') { return '<font face="' +
|
}, html: function (token, attrs, content) { if (typeof attrs.defaultattr == 'string' && attrs.defaultattr != '' && attrs.defaultattr != '{defaultattr}') { return '<font face="' +
|
attrs.defaultattr +
| $.sceditor.escapeEntities(attrs.defaultattr) +
|
'">' + content + '</font>'; } else {
|
'">' + content + '</font>'; } else {
|
return content; } }
| return content; } }
|
});
// Add MyBB PHP command
| });
// Add MyBB PHP command
|
Zeile 285 | Zeile 304 |
---|
'<div>' + '<div>' + '<label for="php">' + editor._('PHP') + ':</label> ' +
|
'<div>' + '<div>' + '<label for="php">' + editor._('PHP') + ':</label> ' +
|
'<textarea type="text" id="php" />' +
| '<textarea type="text" id="php"></textarea>' +
|
'</div>' + '<div><input type="button" class="button" value="' + editor._('Insert') + '" /></div>' + '</div>'
| '</div>' + '<div><input type="button" class="button" value="' + editor._('Insert') + '" /></div>' + '</div>'
|
Zeile 304 | Zeile 323 |
---|
before = before + val + end; end = null; }
|
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 315 | Zeile 334 |
---|
exec: function (caller) { if ($.trim(this.getRangeHelper().selectedRange())) { this.insert('[php]', '[/php]');
|
exec: function (caller) { if ($.trim(this.getRangeHelper().selectedRange())) { this.insert('[php]', '[/php]');
|
return; }
| return; }
|
$.sceditor.command.get('php')._dropDown(this, caller); }, txtExec: ['[php]', '[/php]'],
| $.sceditor.command.get('php')._dropDown(this, caller); }, txtExec: ['[php]', '[/php]'],
|
Zeile 348 | Zeile 367 |
---|
'<div>' + '<div>' + '<label for="code">' + editor._('Code') + ':</label> ' +
|
'<div>' + '<div>' + '<label for="code">' + editor._('Code') + ':</label> ' +
|
'<textarea type="text" id="code" />' +
| '<textarea type="text" id="code"></textarea>' +
|
'</div>' + '<div><input type="button" class="button" value="' + editor._('Insert') + '" /></div>' + '</div>'
| '</div>' + '<div><input type="button" class="button" value="' + editor._('Insert') + '" /></div>' + '</div>'
|
Zeile 366 | Zeile 385 |
---|
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 448 | Zeile 467 |
---|
var params = mybbCmd.video[Object.keys(mybbCmd.video).find(key => key.toLowerCase() === attrs.defaultattr)]; var matches, url; var n = (attrs.defaultattr == 'dailymotion') ? 2 : 1;
|
var params = mybbCmd.video[Object.keys(mybbCmd.video).find(key => key.toLowerCase() === attrs.defaultattr)]; var matches, url; var n = (attrs.defaultattr == 'dailymotion') ? 2 : 1;
|
if (params['html']) {
| if (typeof params !== "undefined") {
|
matches = content.match(params['match']); url = matches ? params['url'] + matches[n] : false; }
| matches = content.match(params['match']); url = matches ? params['url'] + matches[n] : false; }
|
Zeile 465 | Zeile 484 |
---|
$.each(mybbCmd.video, function (provider, data) { videoOpts += '<option value="' + provider.toLowerCase() + '">' + editor._(provider) + '</option>';
|
$.each(mybbCmd.video, function (provider, data) { videoOpts += '<option value="' + provider.toLowerCase() + '">' + editor._(provider) + '</option>';
|
}); $content = $( '<div>' + '<div>' +
| }); $content = $( '<div>' + '<div>' +
|
'<label for="videotype">' + editor._('Video Type:') + '</label> ' + '<select id="videotype">' + videoOpts + '</select>' + '</div>' + '<div>' + '<label for="link">' + editor._('Video URL:') + '</label> ' + '<input type="text" id="videourl" value="http://" />' +
|
'<label for="videotype">' + editor._('Video Type:') + '</label> ' + '<select id="videotype">' + videoOpts + '</select>' + '</div>' + '<div>' + '<label for="link">' + editor._('Video URL:') + '</label> ' + '<input type="text" id="videourl" value="http://" />' +
|
'</div>' +
| '</div>' +
|
'<div><input type="button" class="button" value="' + editor._('Insert') + '" /></div>' + '</div>' );
| '<div><input type="button" class="button" value="' + editor._('Insert') + '" /></div>' + '</div>' );
|
Zeile 491 | Zeile 510 |
---|
e.preventDefault(); });
|
e.preventDefault(); });
|
editor.createDropDown(caller, 'insertvideo', $content.get(0));
| editor.createDropDown(caller, 'insertvideo', $content.get(0)); }, exec: function (caller) { $.sceditor.command.get('video')._dropDown(this, caller); }, txtExec: function (caller) { $.sceditor.command.get('video')._dropDown(this, caller); }, tooltip: 'Insert a video' });
// Update image command to support MyBB syntax $.sceditor.formats.bbcode.set('img', { format: function (element, content) { if ($(element).data('sceditor-emoticon')) return content;
var url = $(element).attr('src'), width = $(element).attr('width'), height = $(element).attr('height'), align = $(element).data('scealign');
var attrs = width !== undefined && height !== undefined && width > 0 && height > 0 ? '=' + width + 'x' + height : '' ;
if (align === 'left' || align === 'right') attrs += ' align='+align
return '[img' + attrs + ']' + url + '[/img]'; }, html: function (token, attrs, content) { var width, height, match, align = attrs.align, attribs = '';
// handle [img=340x240]url[/img] if (attrs.defaultattr) { match = attrs.defaultattr.split(/x/i);
width = match[0]; height = (match.length === 2 ? match[1] : match[0]);
if (width !== undefined && height !== undefined && width > 0 && height > 0) { attribs += ' width="' + $.sceditor.escapeEntities(width, true) + '"' + ' height="' + $.sceditor.escapeEntities(height, true) + '"'; } }
if (align === 'left' || align === 'right') attribs += ' style="float: ' + align + '" data-scealign="' + align + '"';
return '<img' + attribs + ' src="' + $.sceditor.escapeUriScheme(content) + '" />'; } })
$.sceditor.command.set('image', { _dropDown: function (editor, caller) { var $content;
$content = $( '<div>' + '<div>' + '<label for="image">' + editor._('URL') + ':</label> ' + '<input type="text" id="image" placeholder="https://" />' + '</div>' + '<div>' + '<label for="width">' + editor._('Width (optional)') + ':</label> ' + '<input type="text" id="width" size="2" />' + '</div>' + '<div>' + '<label for="height">' + editor._('Height (optional)') + ':</label> ' + '<input type="text" id="height" size="2" />' + '</div>' + '<div>' + '<input type="button" class="button" value="' + editor._('Insert') + '" />' + '</div>' + '</div>' );
$content.find('.button').on('click', function (e) { var url = $content.find('#image').val(), width = $content.find('#width').val(), height = $content.find('#height').val() ;
var attrs = width !== undefined && height !== undefined && width > 0 && height > 0 ? '=' + width + 'x' + height : '' ;
if (url) editor.insert('[img' + attrs + ']' + url + '[/img]');
editor.closeDropDown(true); e.preventDefault(); });
editor.createDropDown(caller, 'insertimage', $content.get(0));
|
}, exec: function (caller) {
|
}, exec: function (caller) {
|
$.sceditor.command.get('video')._dropDown(this, caller); },
| $.sceditor.command.get('image')._dropDown(this, caller); },
|
txtExec: function (caller) {
|
txtExec: function (caller) {
|
$.sceditor.command.get('video')._dropDown(this, caller);
| $.sceditor.command.get('image')._dropDown(this, caller);
|
},
|
},
|
tooltip: 'Insert a video'
| |
});
// Remove last bits of table, superscript/subscript, youtube and ltr/rtl support
| });
// Remove last bits of table, superscript/subscript, youtube and ltr/rtl support
|
Zeile 513 | Zeile 632 |
---|
if (partialmode) { $.sceditor.formats.bbcode.remove('code').remove('php').remove('quote').remove('video').remove('img'); $.sceditor.command
|
if (partialmode) { $.sceditor.formats.bbcode.remove('code').remove('php').remove('quote').remove('video').remove('img'); $.sceditor.command
|
.set('image', { exec: function (caller) { var editor = this, content = $(this._('<form><div><label for="link">{0}</label> <input type="text" id="image" value="http://" /></div>' + '<div><label for="width">{1}</label> <input type="text" id="width" size="2" /></div>' + '<div><label for="height">{2}</label> <input type="text" id="height" size="2" /></div></form>', this._("URL:"), this._("Width (optional):"), this._("Height (optional):") )) .submit(function () { return false; });
content.append($(this._('<div><input type="button" class="button" value="Insert" /></div>', this._("Insert") )).on('click', function (e) { var $form = $(this).parent('form'), val = $form.find('#image').val(), width = $form.find('#width').val(), height = $form.find('#height').val(), attrs = '';
if (width && height) { attrs = '=' + width + 'x' + height; }
if (val && val !== 'http://') { editor.wysiwygEditorInsertHtml('[img' + attrs + ']' + val + '[/img]'); }
editor.closeDropDown(true); e.preventDefault(); }));
editor.createDropDown(caller, 'insertimage', content.get(0)); } })
| |
.set('quote', { exec: function () { this.insert('[quote]', '[/quote]');
| .set('quote', { exec: function () { this.insert('[quote]', '[/quote]');
|