Техническая поддержка SpyBB

Объявление

Ответы на часто задаваемые вопросы  |  FAQ по администрированию форума  |  FAQ по дизайну форума в CSS  |  Абсолютный помощник по дизайну  |  Навигатор по форуму

Перед регистрацией прочтите правила форума
При поиске ответа на заданный вопрос рекомендуем пользоваться «Поиском».
В случае проблемы с форумом, обязательно указывайте его адрес, иначе мы не сможем Вам помочь!

● 24 марта 2012г. - Закрепление первого сообщения
● 23 марта 2012г.: Изменения в форме ответа - Добавлен стандартный спойлер. Доработан функционал кнопок

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Техническая поддержка SpyBB » Скрипты » Скрипты


Скрипты

Сообщений 21 страница 40 из 50

21

Картинка в "Форме быстрого ответа"
http://forumupload.ru/uploads/0000/14/1c/30685-1.jpg

Код:
<style type="text/css">
.punbb textarea {background: url(http://site.ru/image.gif) top right no-repeat}
</style>

http://site.ru/image.gif заменить на адрес картинки.

0

22

Связь с Администрацией через ICQ
Автор: Duka
Скрипт позволяет выводить в любом месте ссылку со статусом В сети/Не в сети  номера администратора и при клике открывается форма отправки сообщения, после которого в эту же секунду администратор полчаует сообщение на свой номер. В клиенте icq отключите опцию "Не принимать сообщения, содержащие web-ссылки" т.к. сообщение приходит вместе с e-mail'ом отправителя.

Код:
<script language="JavaScript">
function poppict()
{
var msg = new String("")
msg = ""

popup = window.open("http://www.icq.com/people/webmsg.php?to=НОМЕР","popDialog","height=550,width=500")
popup.document.write(msg)
popup.document.close()

return false
}
</script>
<a id="poppict" onclick="return poppict()"><img src=http://status.icq.com/online.gif?icq=НОМЕР&img=5 border=0 width=18 height=18>Написать администратору</a>

В данном скрипте 2 раза в строках 7 и 14 ищите слово НОМЕР и ставите свой номер аси.
Вставлять в то место, куда душе угодно.

0

23

Дополнительные цвета
Дополнительные цвета переделаные
Автор: Duka
Написал небольшой скрипт от нечего делать... кто-то хотел добавить свои цвета, в частности инициатором послужил rps (с форума ЕТП). По его просьбе выкладываю в паблик.
Ранее обсуждение этого скрипта началось тут
Этот код позволяет создать вам свои цвета на форуме и вынести отдельную кнопку в форму ответа.

Код:
<table><tr>
<td onclick="return changeVisibility('mycolor', this)"><img src="http://forum.mybb.ru/i/color_swatch.png" alt="Мои цвета" /></td></tr></table>
<div class="container" id="mycolor" style="display:none; width:200px">
	<table cellspacing="0">
<tr>
<td style="background-color:indigo" onclick="insert_text('[color=indigo]', '[/color]'); return changeVisibility('mycolor', this)"></td>
	<td style="background-color:thistle" Height="15px" onclick="insert_text('[color=thistle]', '[/color]'); return changeVisibility('mycolor', this)"></td>
	<td style="background-color:tomato" onclick="insert_text('[color=tomato]', '[/color]'); return changeVisibility('mycolor', this)"></td>
	<td style="background-color:yellowgreen" onclick="insert_text('[color=yellowgreen]', '[/color]'); return changeVisibility('mycolor', this)"></td>
	<td style="background-color:lightslategray" onclick="insert_text('[color=lightslategray]', '[/color]'); return changeVisibility('mycolor', this)"></td>
	<td style="background-color:lightpink" onclick="insert_text('[color=lightpink]', '[/color]'); return changeVisibility('mycolor', this)"></td>
	<td style="background-color:goldenrod" onclick="insert_text('[color=goldenrod]', '[/color]'); return changeVisibility('mycolor', this)"></td>
           <td style="background-color:blue" onclick="insert_text('[color=blue]', '[/color]'); return changeVisibility('mycolor', this)"></td>
	<td style="background-color:silver" onclick="insert_text('[color=silver]', '[/color]'); return changeVisibility('mycolor', this)"></td>
	<td style="background-color:aquamarine" onclick="insert_text('[color=aquamarine]', '[/color]'); return changeVisibility('mycolor', this)"></td>
</tr>
</table>
</div>

А теперь как работать:
Для добавления своего нового цвета добавьте

Код:
<td style="background-color:ЦВЕТ" onclick="insert_text('[color=ЦВЕТ]', '[/color]'); return changeVisibility('mycolor', this)"></td>

перед

</tr>

Вместо ЦВЕТ добавляете свой цвет: название цвета или номер цвета в RGB формате(решетка перед цветом в RGB обязательна)

Если Вы решили добавить много своих цветов, то не забудьте изменить в "width:200px" размер ширины всплывающего контейнера. изменяете 200 на значение большее или меньшее по Вашему усмотрению.

Скрипт вставлять в HTML в форме ответа. В дальнейших планах - добавить в панель с кнопками, но сейчас на это нет времени...
При желании также можно вместо

<img src="http://forum.mybb.ru/i/color_swatch.png" alt="Мои цвета" />

Написать "Мои цвета" или на ваше усмотрение, просто новую кнопку рисовать на стал и взял отсюда)

Демо: тут
Скрин: http://i003.radikal.ru/0802/7a/1d42836ce89b.jpg

Дополнительные цвета с кнопкой в BB- панели.

Код:
<style>
#custom-mycolor {background-image:url('http://s60.radikal.ru/i168/0903/65/de67e22761d8.jpg'); padding:0; line-height:0; background-position:center; background-repeat:no-repeat; height:26px; width:100%}
</style>
<script type="text/javascript">
if((form=document.getElementById("form-buttons")))
form.getElementsByTagName("tr")[0].insertCell(19).innerHTML="<img src='/i/blank.gif' title='Мои цвета' id='custom-mycolor'  title='Мои цвета' onclick=\"return changeVisibility('mycolor', this);\" />"
</script>
<div class="container" id="mycolor" style="display:none; width:807px">
	<table cellspacing="0">
<tr>
<td style="background-color:#FF6633; height:15px" onclick="bbcode('[color=#FF6633]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#CC3300; height:15px" onclick="bbcode('[color=#CC3300]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#660000; height:15px" onclick="bbcode('[color=#660000]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#990066; height:15px" onclick="bbcode('[color=#990066]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FF3366; height:15px" onclick="bbcode('[color=#FF3366]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#000066; height:15px" onclick="bbcode('[color=#000066]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#003366; height:15px" onclick="bbcode('[color=#003366]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#0033FF; height:15px" onclick="bbcode('[color=#0033FF]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#00CC00; height:15px" onclick="bbcode('[color=#00CC00]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#669966; height:15px" onclick="bbcode('[color=#669966]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#006600; height:15px" onclick="bbcode('[color=#006600]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FF6600; height:15px" onclick="bbcode('[color=#FF6600]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#CC6633; height:15px" onclick="bbcode('[color=#CC6633]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FFD700; height:15px" onclick="bbcode('[color=#FFD700]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#666666; height:15px" onclick="bbcode('[color=#666666]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#00FF66; height:15px" onclick="bbcode('[color=#00FF66]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#00FF00; height:15px" onclick="bbcode('[color=#00FF00]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#00FFFF; height:15px" onclick="bbcode('[color=#00FFFF]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#66FF66; height:15px" onclick="bbcode('[color=#66FF66]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#99FF99; height:15px" onclick="bbcode('[color=#99FF99]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#CCFF00; height:15px" onclick="bbcode('[color=#CCFF00]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#CCFF66; height:15px" onclick="bbcode('[color=#CCFF66]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#CCFFCC; height:15px" onclick="bbcode('[color=#CCFFCC]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FFFF00; height:15px" onclick="bbcode('[color=#FFFF00]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FFFF99; height:15px" onclick="bbcode('[color=#FFFF99]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#00CC66; height:15px" onclick="bbcode('[color=#00CC66]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#339966; height:15px" onclick="bbcode('[color=#339966]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#6699CC; height:15px" onclick="bbcode('[color=#6699CC]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#CCCC66; height:15px" onclick="bbcode('[color=#CCCC66]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#009966; height:15px" onclick="bbcode('[color=#009966]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#9999FF; height:15px" onclick="bbcode('[color=#9999FF]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#CC9933; height:15px" onclick="bbcode('[color=#CC9933]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#CC66CC; height:15px" onclick="bbcode('[color=#CC66CC]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FF6666; height:15px" onclick="bbcode('[color=#FF6666]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#003333; height:15px" onclick="bbcode('[color=#003333]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#333300; height:15px" onclick="bbcode('[color=#333300]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#663399; height:15px" onclick="bbcode('[color=#663399]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#993300; height:15px" onclick="bbcode('[color=#993300]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FF3300; height:15px" onclick="bbcode('[color=#FF3300]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FF66FF; height:15px" onclick="bbcode('[color=#FF66FF]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#0000FF; height:15px" onclick="bbcode('[color=#0000FF]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#660033; height:15px" onclick="bbcode('[color=#660033]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#990000; height:15px" onclick="bbcode('[color=#990000]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FF0000; height:15px" onclick="bbcode('[color=#FF0000]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FF0066; height:15px" onclick="bbcode('[color=#FF0066]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#FFCCCC; height:15px" onclick="bbcode('[color=#FFCCCC]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#ffcc66; height:15px" onclick="bbcode('[color=#ffcc66]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#666633; height:15px" onclick="bbcode('[color=#666633]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#cc6633; height:15px" onclick="bbcode('[color=#cc6633]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#99ff00; height:15px" onclick="bbcode('[color=#99ff00]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#cccccc; height:15px" onclick="bbcode('[color=#cccccc]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#ffcccc; height:15px" onclick="bbcode('[color=#ffcccc]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#336666; height:15px" onclick="bbcode('[color=#336666]', '[/color]'); return changeVisibility('mycolor', this)"></td>
<td style="background-color:#ff9999; height:15px" onclick="bbcode('[color=#ff9999]', '[/color]'); return changeVisibility('mycolor', this)"></td>
</tr>
	</table>
	</div>

Ставить в форму ответа

0

24

Визуальный переход

Код:
<META HTTP-EQUIV="Page-Exit" CONTENT="BlendTrans(Duration=0.3)">
<META HTTP-EQUIV="Page-Enter" CONTENT="BlendTrans(Duration=0.3)">

Цифры 0.3 можно менять остальное как есть в поле ХТМЛ-низ.

0

25

Изменение стиля надписи "Отредактировано"

Код:
<style type="text/css">
.lastedit {color :red;font-family :Comic Sans Ms;}
</style>

Спасибо Lion
font-size:13px;font-style: italic; при добавлении изменится размер и добавится курсив.

0

26

Цвет ссылок не меняя дизайн
(c) karpoff

<style type="text/css">
a:link {
color: #FFFF00;
}
a:visited {
color: #FFFF99;
}
a:hover {
color: #FFFF99;
}
a:active {
color: #FFCC00;
}
</style>

0

27

Загрузка файлов
Автор: Duka

<script language="JavaScript">
function poppict()
{
var msg = new String("")
msg = ""

popup = window.open("http://filestock.ru/","popDialog","height=400,width=600")
popup.document.write(msg)
popup.document.close()

return false
}
</script>
<a id="poppict"  onclick="return poppict()">Загрузка файлов</a>

Демо: тут

Прямая ссылка на тему с запросом скрипта - link

0

28

Загрузка изображения с помощью Imageshack.us
Уже давно наболел вопрос по поводу загрузки изобраения на форум... Этот скрипт позволит на время забыть Вам эту проблему.

<table><tr>
<td align="right" valign='top' width='20%'>
<b>Загрузить картинку на ImageShack.us
Загрузка будет производиться в новом окне</b>
</td>
<td align="left" width='80%'>
<iframe src="http://www.imageshack.us/iframe.php?txtcolor=111111" frameborder="0" height="70" scrolling="no" width="280">
</iframe>
</td>
</tr>
</table>

Вставлять в HTML в форме ответа.
Пример как это будет выглядеть: тут

0

29

Скрипт, запрещающий писать личные сообщения администратору простым пользователям
Автор: karpoffu
Вставлять в html-низ

Код:
<script type="text/javascript">
var a=document.URL
if (a.indexOf("sendmessage")!=-1 && !document.getElementById("navadmin"))
{document.getElementsByName("submit") [0] .onclick=getIt}

function getIt()
{var b=document.getElementsByName("req_username") [0] .value
if (b=="Zebra") //вместо Зебры имя администратора
{
alert ("Вы не можете написать сообщение администратору")
return false}}

</script>

0

30

Запрет на установку аватара и подписи отдельным пользователям
Работает только на запрет для подписи.

<script type="text/javascript">
var a =document.URL
var b=document.getElementById('pun-status').innerHTML
if (b.indexOf("Zebra")!=-1)
{
if ((a.indexOf("signature")!=-1)||(a.indexOf("section=avatar")!=-1))
{document.getElementsByName('update')[0].onclick=noChange}
else if (a.indexOf("upload-avatar")!=-1)
{document.getElementsByName('urload')[0].onclick=noChange}}
function noChange()
{alert ("Пошел нафиг")
return false}
</script>

Zebra - ник юзера, которому запретили менять.

0

31

Запрет перехода по ссылке Активные

Код:
<script type="text/javascript">
function noWatch()
{alert ("Вам запрещено смотреть  эту ссылку")}
var a =document.links
for (x in a)
{if (a[x].innerHTML=="Активны")
{a[x].href="javascript: noWatch();"}}
</script>

Чтобы в скрипте админы могли все же перейти по ссылке.

<script type="text/javascript">
function noWatch()
{alert ("Вам запрещено смотреть  эту ссылку")}
var a =document.links
var b=document.getElementById('pun-status').innerHTML
for (x in a)
{if ((a[x].innerHTML=="Активны")&&(b.indexOf("Zebra")==-1)&&(b.indexOf("Admin")==-1))
{a[x].href="javascript: noWatch();"}}
</script>

Zebra и Admin - ники твоих администраторов.

Просто выкидывает на предыдущую страницу при попытке зайти на Активные:

Код:
<script type="text/javascript">
var a=document.URL
var b=document.referrer
var c=document.getElementById('pun-status').innerHTML
if ((c.indexOf("Zebra")==-1)&&(c.indexOf("Admin")==-1))
{
if (a=="адрес онлайна")
{
window.open (b, "_self")}}
</script>

Можно более элегантный вариант

Код:
<script type="text/javascript">
var a=document.URL
var c=document.getElementById('pun-status').innerHTML
if ((c.indexOf("Zebra")==-1)&&(c.indexOf("Admin")==-1))
{
if (a=="адрес онлайна")
{
document.getElementById('pun-status').innerHTML="Вы не имеете права доступа к этой странице"
document.getElementById('pun-main').style.display="none"
}}
</script>

Пишет в статусе, что вы не можете посмотреть эту страницу и просто скрывает таблицу с тем, кто что делает. Правда ее можно будет посмотреть в HTML, хотя вряд ли кто-либо будет трудиться. Выбирайте.

0

32

Всплывающее окно-раздражалка для незарегестрированных
Само всплывает и появляется через определенные промежутки времени.

Вместо текста Зарегистрируйся блин можно вписать любой текст, в том числе и HTML поддерживается.
Вместо 3000- интервал который окно держится до исчезновения и через скоко появляется снова в миллисекундах

<script type="text/javascript">
var t
var freak
function freakOut()
{freak=window.open("", "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=300, height=300")
freak.document.write ("Зарегистрируйся блин") 
t=setTimeout ("freakIn()", 3000)                       
}
function freakIn()
{freak.close()
t=setTimeout ("freakOut()", 3000)}   
if (document.getElementById('pun-status').innerHTML.indexOf("Гость")!=-1)
{freakOut()}
</script>

Более жесткий вариант скрипта. Не поддается блокировке через ie , надпись перекрывает все и не поддается прокрутке.

ВВерх вставляем

Код:
<div id="annoy" style="position: absolute; left: 20px; top: 30px; display:none; z-index: 150;">
<table><tr><td height=400px width=400px bgcolor=#FFFFFF;>Зарегься</td></tr></table></div>

Вместо:

<table><tr><td height=400px width=400px bgcolor=#FFFFFF;>Зарегься</td></tr></table>

Можем вставить любой Html, в зависимости от того, насколько большим и мерзким будет раздражитель.
Вниз вставляем:

Код:
<script type="text/javascript">
var crossobj=document.all? document.all.annoy : document.getElementById("annoy")
var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
function positionit(){
var dsocleft=document.all? iebody.scrollLeft : pageXOffset
var dsoctop=document.all? iebody.scrollTop : pageYOffset
if (document.all||document.getElementById){
crossobj.style.left=parseInt(dsocleft)+5+"px"
crossobj.style.top=dsoctop+5+"px"
}
}
setInterval("positionit()",10)
</script>

<script type="text/javascript">
var t
var freak
function freakOut()
{document.getElementById("annoy").style.display="block"
t=setTimeout ("freakIn()", 3000)                        
}
function freakIn()
{document.getElementById("annoy").style.display="none"
t=setTimeout ("freakOut()", 3000)}   
if (document.getElementById('pun-status').innerHTML.indexOf("Гость")!=-1)
{freakOut()}
</script>

0

33

Кнопки Вверх и Вниз

Вниз
Надпись, либо картинка, при нажатии которой страница прокручивается до быстрого ответа.

Код:
<script type="text/javascript">
var arr=document.getElementsByTagName("li")
i=0
while(arr[i] ){
if(arr[i].className=="pl-quote"){
name=arr[i].innerHTML
name=name.substring(0)
arr[i].innerHTML=""+name+" &ensp;&ensp; <a href=\"#post-form\">Вниз</a> "
}
i++
}
</script>

Чтобы поставить картинку ставите вместо слова Вниз:

Код:
<img src='ВАША КАРТИНКА' border='0' title='Вниз alt='Вниз''>

Вверх
Надпись, либо картинка, при нажатии которой страница прокручивается до быстрого ответа.

Код:
<script type="text/javascript">
var arr=document.getElementsByTagName("li")
i=0
while(arr[i] ){
if(arr[i].className=="pl-quote"){
name=arr[i].innerHTML
name=name.substring(0)
arr[i].innerHTML=""+name+" &ensp;&ensp; <a href=\"javascript:scroll(0,0);\">Вверх</a> "
}
i++
}
</script>

Чтобы поставить картинку ставите вместо слова Вверх:

Код:
<img src=\'Адрес изображения\' border=\'0\' title=\'Вверх\' alt=\'Вверх\'''>

0

34

Профилактика форума

Вместо форума у всех пользователей, кроме главного администратора вместо форума будет открываться окно с текстом.

Код:
<script type="text/javascript">
if ((document.URL.indexOf("forum.mybb.ru")!=-1)&&(document.title!="Форум технической поддержки - Форум")&&(document.getElementById('pun-status').innerHTML.indexOf('Zebra')==-1))
{window.open ("http://forum.mybb.ru", "_self")}
</script>

Вместо forum.mybb.ru - свой адрес
Вместо Форум технической поддержки - название своего форума
Вместо Zebra - ваш админский ник

0

35

Колонка новостей

Автор: Duka
Скрипт разделит таблицу форума на 2 части. Т.е. вместо списка разделов у вас будет боковая колонка с вашей информацией или новостями, а другая сторона сам форум.

Код:
<script type="text/javascript">
var news = new Array ()
news.push(new Array("Заголовок", "Новость"))
news.push(new Array("Заголовок2", "Новость2"))
var mynews = "";
for (q=0; q<news.length; q++){
mynews += "<div class='container' style='padding:8px'><h2><center>"+news[q][0]+"</center></h2>"+news[q][1]+"</div><br /><br />";
}
var block=mynews;
var arr=document.getElementsByTagName("div")
i=0
str=document.URL
while(arr[i] ){
if((str.substring(str.lastIndexOf('/')+1)=="" || str.substring(str.lastIndexOf('/')+1)=="index.php") && arr[i].className=="main"){
name=arr[i].innerHTML
name=name.substring(0)
arr[i].innerHTML="<table><tr><td width=20% valign=top>"+block+"</td><td width=80%>"+name+"</td></tr></table>"
}
i++
}
</script>

Переработал скрипт. Добавление блоков стало проще, чем раньше.
Просто продублируйте красную строчку необходимое Вам число раз
Главное - нет прямым переносам строк и ковычкам в самом тексте блока.

0

36

Боковая панель

Автор: mkusher

вчера в голову стукнула идея по колонке новостей аля скрипт by Duka, но полностью на html и css. Плюс этой колонки по сравнению со скриптом - возможность пихать в него всего что угодно и как угодно, ограничиваясь только вашими знаниями html и css

Ну теперь о реализации:

а) Простая панель

Код:
<style type="text/css">#sidebar 
{
	display: block;
	background: transparent url(http://i009.radikal.ru/0908/34/c646503d774e.png); 
	width: 200px; 
	height: 500px;
	margin: 1px;
	float: left; 
	border: 1px solid; 
	position: relative; 
	z-index: 0; 
	top: 0px; 
       padding: 0;
}</style>

б) Только на главной странице

Код:
<style type="text/css">
#sidebar 
{
	display: none;
	background: transparent url(http://i009.radikal.ru/0908/34/c646503d774e.png); 
	width: 200px; 
	height: 500px;
	margin: 1px;
	float: left; 
	border: 1px solid; 
	position: relative; 
	z-index: 0; 
	top: 0px; 
       padding: 0;
}
#pun #pun-index #sidebar {display: block;}</style>

в) Только на страницах просмотра тем

Код:
<style type="text/css">
#sidebar 
{
	display: none;
	background: transparent url(http://i009.radikal.ru/0908/34/c646503d774e.png); 
	width: 200px; 
	height: 500px;
	margin: 1px;
	float: left; 
	border: 1px solid; 
	position: relative; 
	z-index: 0; 
	top: 0px; 
       padding: 0;
}
#pun #pun-viewforum #sidebar {display: block;}</style>

г) только на страницах просмотр сообщений

Код:
<style type="text/css">
#sidebar 
{
	display: none;
	background: transparent url(http://i009.radikal.ru/0908/34/c646503d774e.png); 
	width: 200px; 
	height: 500px;
	margin: 1px;
	float: left; 
	border: 1px solid; 
	position: relative; 
	z-index: 0; 
	top: 0px; 
       padding: 0;
}
#pun #pun-viewtopic #sidebar {display: block;}</style>

это ставим в html-верх, редактируйте как хотите.

Код:
</div></div></div><table width="100%" ><tr><td id="sidebar">
здесь можно попробовать сделать нечто подобное на блок крутой
</td><td style="padding: 0px;"><div><div><div>

это ставим в самый низ объявления. Текст- наполнение блока, ставьте туда что хотите.

Код:
</div></div></div></td></tr></table><div><div>

это ставьте в самый конец html-низа.

http://s58.radikal.ru/i161/1001/af/dcd5a84838fc.png

0

37

Быстрое выделение кода

Вместо надписи Код: в блоках кода появляется надпись, при нажатии оной код выделяется полностью.

Код:
<script type="text/javascript">
function select_text(elem) {
	if(window.getSelection) {   
var s=window.getSelection();   
if(s.setBaseAndExtent){   
	s.setBaseAndExtent(elem,0,elem,elem.innerText.length-1);   
}
else {   
	var r=document.createRange();   
	r.selectNodeContents(elem);   
	s.removeAllRanges();   
	s.addRange(r);
}   
	}
	else if(document.getSelection){   
var s=document.getSelection();   
var r=document.createRange();   
r.selectNodeContents(elem);   
s.removeAllRanges();   
s.addRange(r);   
	}
	else if(document.selection){   
var r=document.body.createTextRange();   
r.moveToElementText(elem);   
r.select();
	}   
}
</script>

<script type="text/javascript">
var div = document.getElementById('pun-main').getElementsByTagName('div');
for(x in div){
	if(div[x].className=='code-box'){
div[x].getElementsByTagName('strong')[0].innerHTML = '<a href="#" onclick="select_text(this.parentNode.parentNode.childNodes[1].getElementsByTagName(\'pre\')[0]); return false;">Выделить</a>';
	}
}
</script>

Вместо слова Выделить пишем, что хотим.

0

38

Спойлеры (бб)

Нужный вам текст скрывается в блоке под кнопкой.

Из кода убираем звездочки в тегах spoiler

Стандартный спойлер кнопкой

Код:
<script>
function addSpoiler(str,from,internal){
var pos=0,pos2=0,newpos=0
if((pos=str.indexOf("[*spoiler]",from))==-1) return str;
if((pos2=str.indexOf("[*/spoiler]"),pos+9)==-1) return str;
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+9,pos2))+str.substring(pos2+10,str.length)
if( str.indexOf("[*spoiler]")!=-1 && internal==false) str=addSpoiler(str,0,false)
return str}
function makeSpoiler(txt){
txt="<div class=quote-box style='padding:1px'><cite style='width:100%'>Ваш код<input style='width:60px;margin-left:70%;font-size:10px;' type='button' value='Показать' onclick='hideSpoiler(this)'></cite><blockquote style='display:none'>"+txt+"</blockquote></div>"
return txt}
function hideSpoiler(sp){
spoiler=sp.parentNode.parentNode.getElementsByTagName("blockquote")[0]
if(spoiler.style.display=='none'){
spoiler.style.display='inline'
sp.value='Скрыть'}
else{
spoiler.style.display='none'
sp.value='Получить код'}}
if(document.URL.indexOf("viewtopic.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(14).innerHTML="<img onclick=\"bbcode('[*spoiler]', '[*/spoiler]')\" src='http://s42.radikal.ru/i097/0904/57/878b008cc49f.jpg' alt='' />"
</script>
<script type="text/javascript">
var theme=document.getElementById('pun-main').getElementsByTagName("h1")[0].innerHTML
if (theme.indexOf("&gt;&gt;")!=-1)
{if (theme.indexOf("Редактирование")!=-1)
{document.getElementById('pun-main').getElementsByTagName("h1")[0].innerHTML=theme.substring(0, theme.indexOf("&gt;&gt;"))+" - Редактирование сообщения</span>"}
else
{document.getElementById('pun-main').getElementsByTagName("h1")[0].innerHTML=theme.substring(0, theme.indexOf("&gt;&gt;"))+"</span>"}}
</script>

Ваш код; Получить код - текст на кнопке.
Ссылка - ссылка на картинку кнопки.

Новый разворачивающийся спойлер с кнопкой

Ставим в html-низ или форма ответа (только, если гости не могут просматривать форумы)

Код:
<style type="text/css">
#button-spoiler {background-image:url('http://forumupload.ru/uploads/0000/12/13/488-1.gif'); padding:0; line-height:0; background-position:center; background-repeat:no-repeat}
</style>
Код:
<script>
function addSpoiler(str,from,internal){
var pos=0,pos2=0,newpos=0
if((pos=str.indexOf("[*spoiler]",from))==-1) return str;
if((pos2=str.indexOf("[*/spoiler]"),pos+9)==-1) return str;
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+9,pos2))+str.substring(pos2+10,str.length)
if( str.indexOf("[*spoiler]")!=-1 && internal==false) str=addSpoiler(str,0,false)
return str}
function makeSpoiler(txt){
txt='<div class="quote-box" style="padding:1px;background: none;"><cite style="width:100%;margin:0;"><input class="spoiler-button" style="width:140px;font-size:10px; margin:0;" type="button" value="Показать cпойлер" onclick="hideSpoiler(this)"></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(){
spoiler = $(this).parents("div.quote-box").find("blockquote.quote-box").toggle("normal");
});
});
function hideSpoiler(sp){
if(sp.value=='Показать cпойлер'){
sp.value='Скрыть cпойлер'}
else{
sp.value='Показать cпойлер'}
}
if(document.URL.indexOf("viewtopic.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(19).innerHTML="<img  id=\"button-spoiler\" title=\"Спойлер\" onclick=\"bbcode('[*spoiler]','[*/spoiler]')\" src=\"/i/blank.gif\" />"
</script>

Новый разворачивающийся спойлер с ссылкой

Ставим это в html-низ

Код:
<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;"><a id="' + open + '" class="spoiler" style="width:100%;font-size:10px; margin:0;border:none;cursor:pointer;text-align:left;">'+close+'</a></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 > a.spoiler").click(function(){
        $(this).parents("div.quote-box:first").find("blockquote.quote-box:first").toggle("slow");
        var a = this.innerHTML;
        this.innerHTML= $(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(19).innerHTML="<img  id=\"spoiler\" title=\"Спойлер\" onclick=\"tag_spoiler();\" src=\"http://forumupload.ru/uploads/0000/12/13/488-1.gif\" />"
    </script>

Показать спойлер; Скрыть спойлер - стандартные заголовки открытого и закрытого спойлера.

0

39

Спойлеры (html)

Убирает под картинную кнопочку любые html-элементы.

Html-спойлер

Ставим в Html-низ

Код:
<!--Скрипт хтмл-спойлера-->
    <script language="JavaScript" type="text/javascript">
    function openClose(id)
    {
    var obj = "";

    // Check browser compatibility
    if(document.getElementById)
    obj = document.getElementById(id).style;
    else if(document.all)
    obj = document.all[id];
    else if(document.layers)
    obj = document.layers[id];
    else
    return 1;

    // Do the magic :)
    if(obj.display == "")
    obj.display = "none";
    else if(obj.display != "none")
    obj.display = "none";
    else
    obj.display = "block";
    }
    </script>
    <!--/Скрипт хтмл-спойлера-->

Ставим туда, где требуется спойлер.

Код:
<!--Шапка спойлера-->
    <div class="spoilertop" onClick="openClose('1')">
    сюда то, что будет отображаться когда спойлер закрыт (можно картинку в обычном хтмл-е)
    </div>
    <!--Содержание спойлера-->
    <div class="spoilerbox" id="1" style="display:none;">
    сюда то, что под спойлером
    </div>

Если ставите несколько спойлеров и хотите, чтобы они открывались по отдельности, то в последующих спойлерах циферку "1" меняете на 2, 3 и т.д.

Чтобы при наведении курсора на заголовок спойлера, курсор становился "лапкой", то ставите это, можно в хтмл-верх

Код:
<style>
    .spoilertop {cursor:pointer;}
    </style>

Html-спойлер кнопкой для формы ответа

Код:
<table><tr>
    <td onclick="return changeVisibility('mycolor', this)"><img src="Фоновая картинка (кнопка)" alt="Название_содержимого" /></td></tr></table>
    <div class="container" id="mycolor" style="display:none; width:ширина кнопкиpx">
    <table cellspacing="0">
    <tr>
    <td>
    СОДЕРЖИМОЕ
    </td>
    </tr>
    </table>
    </div>

0

40

Скрипты для таблицы

Полоса прокрутки

Код:
<div style="overflow-y: scroll; width: 300px; height: 300px;">Тут какой-то текст или ещё что-то</div>

Меняем значения ширины и высоты, а также текст, как захотите.

Бегущая строка

marquee - бегущая строка текста
bgcolor - цвет фона бегущей строки
height - высота строки
width - ширина строки
behavior="scroll" обычная прокрутка
behavior="slide" - строка пробегает до края и останавливается
behavior="alternate" - строка будет двигаться от края к краю
scrollamount="1" (1-10) - скорость движения строки
direction="left" (right, up, down) - движение влево (вправо, вверх, вниз)

Пример строки:

Код:
<marquee><font size="14"><font color="red">ИГРОВОЙ ФОРУМ</font></font></marquee>

0


Вы здесь » Техническая поддержка SpyBB » Скрипты » Скрипты