sadhaka
И еще: возможно ли изменить положение кнопки в панели инструментов? Т.е. сделать ее не последней, а после "смайла".
Спойлер - сокрытие информации под кнопку (обновл. доработанный) (Mybb)
Сообщений 11 страница 20 из 39
Поделиться1108.08.11 23:01
Поделиться1208.08.11 23:18
faiko
Да, конечно.
<script type="text/javascript">
if(form=document.getElementById("form-buttons"))
form.getElementsByTagName("tr")[0].insertCell(20).innerHTML='<img onclick="tag_spoiler();" title="Спойлер" src="http://forumupload.ru/uploads/0009/42/8c/1501-1.gif" style="width:20px;height:22px;padding-left:6px;">'
</script>
Красным - это номер по счету после которого будет стоять Ваша кнопка. Можно менять на любой (но не больше, чем у Вас реально существует кнопок).
Поделиться1309.08.11 00:10
faiko
<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 type="button" id="' + open + '" class="spoiler" value="'+close+'"></cite><blockquote class="quote-box" style="display:none; width: 95%;border: 1px solid black;margin:0;">' + txt + '</blockquote></div>'
return txt;
}$(document).ready(function(){
$("div.quote-box > cite > input.spoiler").click(function(){
$(this).parents("div.quote-box:first").find("blockquote.quote-box:first").toggle("slow");
var a = this.value;
this.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)
}
}
</script>
Все то же самое, только вместо ссылки - кнопка. Проверьте (в смысле - потестируйте) только по-хорошему прежде чем пользоваться. Поздно у меня уже - могла поневнимательности что-то пропустить и/или перепутать.
Поделиться1409.08.11 04:19
sadhaka
Потестила - работает.
А возможно ли стиль кнопки сделать подстраивающимся под тему в винде? Т.е. таким же, как, допустим, кнопки "ОК", "Отмена"...
Поделиться1509.08.11 13:43
faiko
Кнопка будет такой же, как и все кнопки на сайте (т.е. как и "отправить", "просмотреть" и т.п.)
Поделиться1609.08.11 14:01
sadhaka
Мм, точно, сообразила.
Спасибо
Поделиться1726.09.11 17:19
а я вот поинтересоваться хочу, можно ли как то подчеркивание убрать, а то оно нервирует
Поделиться1826.09.11 17:32
Ikkin
находите:
border: 1px solid black;
и убираете.
Поделиться1910.02.12 12:25
не отображается кнопка спойлера(
Поделиться2010.02.12 13:27
Ненависть
Адрес и пояснения, что куда ставили.