Есть ли специальный код для создания спойлеров на mybbовских форумах.
Спойлер
Сообщений 1 страница 9 из 9
Поделиться32012-02-05 21:01:44
Не совсем понял что нужно делать
Поделиться42012-02-05 21:23:30
Дождь
перейти по ссылке и выбрать желаемый код.
Поделиться52012-02-08 21:53:32
Спасибо, всё получилось.
Но нельзя ли сделать кнопку пошире?
Поделиться62012-02-08 22:12:01
Дождь,
мы не знаем, код какого спойлера вы себе поставили.
Поэтому - хоть это уточните?
Поделиться72012-02-08 22:34:23
мы не знаем, код какого спойлера вы себе поставили
Прошу прошения.
<!-- Spoiler --> <style> #button-spoiler {background-image:url('http://forumstatic.ru/files/000d/8d/df/32058.jpg'); padding:0; line-height:0; background-position:center; background-repeat:no-repeat; height:26px; width:100%} </style> <script type="text/javascript"> function tag_spoiler(){ var y = prompt("Введите описание закрытой подсказки",''); if(y!='null' && y!='' && typeof(y)!='object' && typeof(y)!='undefined'){ var x = prompt("Введите описание открытой подсказки",''); if(x=='null' || x=='' || typeof(x)=='object' || typeof(x)=='undefined') bbcode('[spoiler='+y+']','[/spoiler]'); else bbcode('[spoiler='+y+'|'+x+']','[/spoiler]');} else bbcode('[spoiler]','[/spoiler]') } function addSpoiler(str,from,internal){ var pos=0,pos2=0,pos_c=0,pos_l=0,newpos=0,string='',close='',open=''; if((pos=str.indexOf("[spoiler",from))==-1) return str; if((pos2=str.indexOf("[/spoiler]"),pos+9)==-1) return str; if(((pos_c=str.indexOf("]",pos+8))!=-1) && ((pos_c!=pos+8)&&(pos_c!=pos+9))){ string = str.substring(pos+9,pos_c); if((pos_l = string.indexOf("|"))!=-1){ close = string.substring(0,pos_l); open = string.substring(pos_l+1,string.length); } else{ close = string; open = string; } } else{ close = 'Показать'; open = 'Скрыть'; } newpos=str.indexOf("[spoiler",pos+9) if(newpos<pos2 && newpos!=-1) str=addSpoiler(str,pos+9,true) if((pos2=str.indexOf("[/spoiler]",pos+9))==-1) return str; str=str.substring(0,pos)+makeSpoiler(str.substring(pos_c+1,pos2),open,close)+str.substring(pos2+10,str.length) if( str.indexOf("[spoiler")!=-1 && internal==false) str=addSpoiler(str,0,false) return str; } function makeSpoiler(txt,open,close){ txt='<div class="quote-box" style="padding:1px;background: none; border: 0;"><cite style="width:100%;margin:0;"><input id="'+open+'" class="spoiler-button" style="width:140px;font-size:10px; margin:0;" type="button" value="'+close+'"></cite><blockquote class="quote-box" style="display:none; width: 80%;border: 1px solid black;margin:0;">'+txt+'</blockquote></div>' return txt; } $(document).ready(function(){ $("div.quote-box > cite > input.spoiler-button").click(function(){ $(this).parents("div.quote-box:first").find("blockquote.quote-box:first").toggle("slow"); var a = $(this).attr('value');$(this).attr('value',$(this).attr('id'));$(this).attr('id',a); }); }); if((document.URL.indexOf("viewtopic.php")!=-1) || (document.URL.indexOf("post.php")!=-1)){ elm=document.getElementById("pun-main").getElementsByTagName("div") for(x in elm) if(elm[x].className=="post-content"){ var post=elm[x] post.innerHTML=addSpoiler(post.innerHTML,0,false) } } if(form=document.getElementById("form-buttons")) form.getElementsByTagName("tr")[0].insertCell(16).innerHTML="<img id=\"button-spoiler\" title=\"Спойлер\" onclick=\"tag_spoiler('[spoiler]','[/spoiler]')\" src=\"/i/blank.gif\" />" </script>
Поделиться82012-02-09 02:40:55
Дождь, найдите в коде:
function makeSpoiler(txt,open,close){
txt='<div class="quote-box" style="padding:1px;background: none; border: 0;"><cite style="width:100%;margin:0;"><input id="'+open+'" class="spoiler-button" style="width:140px;font-size:10px; margin:0;" type="button" value="'+close+'"></cite><blockquote class="quote-box" style="display:none; width: 80%;border: 1px solid black;margin:0;">'+txt+'</blockquote></div>'
return txt;
}
140 - на свой размер в большую сторону
Поделиться92012-02-09 19:46:56
Leonheart, спасибо огромное
Похожие темы
Помогите разобраться со скриптом спойлера | Вопросы по скриптам | 2011-07-19 |
Цитата и спойлер. | Архив тем | 2011-10-01 |
Спойлер(новый) | Архив тем | 2008-10-21 |
Spoiler. Спрятать информацию под спойлер | Галерея скриптов | 2012-03-16 |
HTML-спойлер. (на данный момент оптимально для ФОРМЫ ОТВЕТА) | Галерея скриптов | 2012-03-16 |