Автор (с) Romych
В html верх

Код:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>

В html низ

<!--Spoiler v.2.2-->
<script type="text/javascript">
$(function(){
$("div.quote-box > cite > input.spoiler-button").click(function(){
$(this).parents("div.quote-box").find("blockquote.quote-box").toggle("normal");
var a = $(this).attr('value');$(this).attr('value',$(this).attr('id'));$(this).attr('id',a);
   });
$('td#button-code').before('<td class="mybutton" style=\'background-image:url("http://img706.imageshack.us/img706/1943/spoiler.gif")\' onclick="tag_spolier()"><img src="/i/blank.gif" alt="Спойлер"></td>');
});
function tag_spolier()
{var FoundErrors = '';
var enterTITLE = prompt("Введите описание скрытого текста", 'Спойлер');
bbcode('[spoiler]',('|'+enterTITLE+'[/spoiler]'));}
elm=document.getElementsByTagName("div")
for(x in elm) if(elm[x].className=="post-content")
{
post = elm[x].innerHTML;
spoilerr = /\[spoiler\]([^]*?)\|(.*?)\[\/spoiler\]/g
elm[x].innerHTML = elm[x].innerHTML.replace(spoilerr, "<div class='quote-box' style='padding:1px;background: none;border: 0;'><cite style='width:100%;margin:0;'><input id='close' class='spoiler-button' style='width:140px;font-size:10px; margin:0; cursor: pointer; font-weight:bold' type='button' value='$2'></cite><blockquote class='quote-box' style='display:none; width:100%;border: 1px solid black;margin:0;'>$1</blockquote></div>")
}
</script>

Отредактировано Erika (2012-01-05 23:01:37)