2014-07-06, 06:36 AM
Removed for security reasons.
If you want to continue using this, keep in mind that you will have to make modifications to make it safe as Mybb did in the 1.8.24 update https://github.com/mybb/mybb/commit/37ad...dd0823e3c5 .
(2014-07-06, 09:36 AM)OMID_HXC Wrote: [ -> ]thanks. nice.
Edit:
i think there is a small problem:
if we use spoiler for styled text that return to HTML code:
see picture:
And can you offer a code for non description please.
(2014-07-06, 10:11 PM)martec Wrote: [ -> ]return HTML code?
but why?
you using xhtml plugin?
if ($(element[0]).hasClass('spoiler')) {
var desc = '';
if($cite.length === 1 || $elm.data('desc')) {
desc = $cite.text() || $elm.data('desc');
$elm.data('desc', desc);
$cite.remove();
content = this.elementToBbcode($(element));
desc = '=' + desc;
$elm.prepend($cite);
}
return '[spoiler' + desc + ']' + content + '[/spoiler]';
}
/***********************
* Add Spoiler command *
***********************/
$.sceditor.plugins.bbcode.bbcode.set("spoiler", {
allowsEmpty: true,
isInline: false,
format: function(element, content) {
var desc = '',
$elm = $(element),
$cite = $elm.children('cite').first();
if($cite.length === 1 || $elm.data('desc')) {
desc = $cite.text() || $elm.data('desc');
$elm.data('desc', desc);
$cite.remove();
content = this.elementToBbcode($(element));
desc = '=' + desc;
$elm.prepend($cite);
}
return '[spoiler' + desc + ']' + content + '[/spoiler]';
},
html: function (token, attrs, content) {
if (attrs.defaultattr) {
content = '<cite>' + attrs.defaultattr + '</cite>' + content;
}
return '<blockquote class="spoiler">' + content + '</blockquote>';
},
breakStart: true,
breakEnd: true
});
$.sceditor.command.set("spoiler", {
_dropDown: function (editor, caller) {
var $content;
$content = $(
'<div>' +
'<label for="des">' + editor._('Description (optional):') + '</label> ' +
'<input type="text" id="des" />' +
'</div>' +
'<div><input type="button" class="button" value="' + editor._('Insert') + '" /></div>'
);
$content.find('.button').click(function (e) {
var html = editor.getRangeHelper().selectedHtml(),
description = $content.find('#des').val(),
descriptionAttr = '',
before = '[spoiler]',
end = '[/spoiler]';
if (description) {
descriptionAttr = '=' + description + '';
before = '[spoiler'+ descriptionAttr +']';
}
if (html) {
before = before + html + end;
end = null;
}
editor.insert(before, end);
editor.closeDropDown(true);
e.preventDefault();
});
editor.createDropDown(caller, 'insertspoiler', $content);
},
exec: function (caller) {
$.sceditor.command.get('spoiler')._dropDown(this, caller);
},
txtExec: function (caller) {
$.sceditor.command.get('spoiler')._dropDown(this, caller);
},
tooltip: 'Insert a spoiler'
});
(2014-07-07, 11:12 AM)martec Wrote: [ -> ]@OMID_HXCthanks.
thanks fixed...
you need replace 4.2 and 4.4
(2014-07-07, 01:18 PM)OMID_HXC Wrote: [ -> ]but in chrome after use spoiler tag on styled text, all styles just removed from text.
(2014-07-07, 01:18 PM)OMID_HXC Wrote: [ -> ]and can you offer a code without description for anyone that are use spoiler MYCode?
blockquote cite {
font-weight: bold;
font-style: normal;
display: block;
font-size: 1em;
border-bottom: 1px solid #ccc;
margin-bottom: 10px;
padding-bottom: 3px;
}
blockquote.spoiler:before {
position: absolute;
content: 'SPOILER:';
top: -1.35em;
left: 0;
font-size: 0.8em;
display: block;
text-align: left;
font-weight: bold;
}
blockquote.spoiler {
margin-top: 1.5em;
background-color: #F5F5F5;
}
.sceditor-button-spoiler div {
background-image:url(s.png);
}
/********************************************
* Update quote to support pid and dateline *
********************************************/
$.sceditor.plugins.bbcode.bbcode.set('quote', {
format: function(element, content) {
var author = '',
$elm = $(element),
$cite = $elm.children('cite').first();
if ($(element[0]).hasClass('spoiler')) {
return '[spoiler]' + content + '[/spoiler]';
}
tooltip: 'Insert a video'
});
/***********************
* Add Spoiler command *
***********************/
$.sceditor.plugins.bbcode.bbcode.set("spoiler", {
allowsEmpty: true,
isInline: false,
format: '[spoiler]{0}[/spoiler]'
html: '<blockquote class="spoiler">{0}</blockquote>',
breakStart: true,
breakEnd: true
});
$.sceditor.command.set("spoiler", {
exec: function () {
this.wysiwygEditorInsertHtml('<blockquote class="spoiler">', '</blockquote>');
},
txtExec: ['[spoiler]', '[/spoiler]'],
tooltip: 'Insert a spoiler'
});
$.sceditor.plugins.bbcode.bbcode.remove('code').remove('php').remove('quote').remove('video').remove('img');
$.sceditor.plugins.bbcode.bbcode.remove('code').remove('php').remove('quote').remove('video').remove('img').remove('spoiler');
{$code}quote|
{$code}quote,spoiler|