Gamer`s Club

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

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


Вы здесь » Gamer`s Club » Скрипты. » HTML в форме ответа.


HTML в форме ответа.

Сообщений 1 страница 7 из 7

1

Скрипт "Радикал не выходя с форума!".
Когда Вы поставите этот скрипт, то Вы сможете загружать фото через радикал не выходя с форума.
Это очень удобно особенно для дизайнеров, скриптёров.
Сам код состоит из двух частей.
Это в ХТМЛ-ВВЕРХ

Код:
<style type="text/css">
#spo_all {width: 95%; margin: 0 auto 0 auto;}
#spo_top {border: 0px solid; color: #000; font-weight: bold; font-family: "Courier New", Courier, monospace; font-size: 12px; margin: 8px auto 0 auto;
padding: 0px; height: 28px; cursor: pointer;}
#spoiler4 { background: #FAFCFE; border: 1px dotted #000; border-top: 0; padding: 4px; margin: 0 auto 8px auto; display:none;}
#spo_option { font-weight:bold; cursor:pointer; float:left;}
#spo_desc { float:right;}
</style>

А это в ХТМЛ-ФОРМУ ОТВЕТА

Код:
<div class="main" id="spo_all"><input class="category" type="button" value="Радикал" id="spo_top" onclick="obj=this.parentNode.childNodes[1].style; tmp=(obj.display!='block') ? 'block' : 'none'; obj.display=tmp; return false;"><div id="spoiler4"><iframe id="radikal" src="http://www.radikal.ru/" width=690 height=500 frameborder=1></iframe><br /></div></div><br><Br>

И перед Вами удобный инструмент для загрузки картинок и т.д.
http://i033.radikal.ru/1101/c5/26006d80761c.jpghttp://s016.radikal.ru/i334/1101/15/16187e34480d.jpg

0

2

Спойлер (работу данного скрипта как и скрипта из предыдущего поста можно наблюдать на нашем форуме  :)  ).

html-верх

Код:
<script type="text/javascript" src="http://i.wesky.ru/f/ru/wesky/jquery.js"></script>

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

Код:
<style>
#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; 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='',

max_length=19;

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 = 'Скрыть спойлер';
}
open = (open.length > max_length) ? open.substring(0, max_length) : open;
close = (close.length > max_length) ? close.substring(0, max_length) : close;
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>

http://forumupload.ru/uploads/0000/12/13/488-1.gif-

Код:
http://forumupload.ru/uploads/0000/12/13/488-1.gif

- ссылка на изображение для кнопки тегов спойлера (в форме ответа)
max_length=19* максимальное количество символов на кнопке

0

3

Цитирование с BB-кодами (Ответить автору)

Скрипт позволит процитировать сообщение вместе с исходными BB-кодами. После клика на Ответить, произойдет редирект на страницу написания нового сообщения с полной цитатой выбранного Вами сообщения. Позволяет прокомментировать одного автора. Скрипт ставить в HTML-в форме ответа.

Код:
<script type="text/javascript">
var a=document.getElementsByTagName("a")
for (i = 0; i<a.length; i++){
   if(a[i].href.indexOf("post.php?tid=") != -1){
      t = a[i].href.substring(a[i].href.indexOf('=')+1)
   }
}
var m = new Array();
var z = new Array();
for (w = 0; w<a.length; w++){
   if(a[w].href.indexOf("#p") != -1){
        m[w] = a[w].href.substring(a[w].href.indexOf('#p')+2)
           for (e=0; e<w; e++){
              m.shift()
           }
z.push(m[0])
   }
}
var c = new Array();
q=0
var arr=document.getElementsByTagName("li")
while(q<arr.length){
   if(arr[q].className=="pl-quote"){
        c.push(q)
   }
   q++
}
var cv = new Array ();
  for(y=0;y<c.length;y++){
    cv.push(y)
}
for(w=0; w<cv.length; w++){
name=arr[c[w]].innerHTML
arr[c[w]].innerHTML=name+" <a href='/post.php?tid="+t+"&qid="+z[w]+"' title='Ответить на сообщение'>Ответить</a> "; 
}
</script>

0

4

Дополнительные символы в форме ответа
ставить в HTML-в форм ответа

Код:
<input type="button" value="●" name="H" title="●" onclick="bbcode('●','')" />
<input type="button" value="◄" name="H" title="◄" onclick="bbcode('◄','')" />
<input type="button" value="▼" name="H" title="▼" onclick="bbcode('▼','')" />
<input type="button" value="►" name="H" title="►" onclick="bbcode('►','')" />
<input type="button" value="▲" name="H" title="▲" onclick="bbcode('▲','')" />
<input type="button" value="■" name="H" title="■" onclick="bbcode('■','')" />
<input type="button" value="▪" name="H" title="▪" onclick="bbcode('▪','')" />
<input type="button" value="▫" name="H" title="▫" onclick="bbcode('▫','')" />
<input type="button" value="♀" name="H" title="♀" onclick="bbcode('♀','')" />
<input type="button" value="♂" name="H" title="♂" onclick="bbcode('♂','')" />
<input type="button" value="™" name="H" title="™" onclick="bbcode('™','')" />
<input type="button" value="≤" name="H" title="≤" onclick="bbcode('≤','')" />
<input type="button" value="≥" name="H" title="≥" onclick="bbcode('≥','')" />
<input type="button" value="≈ " name="H" title="≈" onclick="bbcode('≈','')" />
<input type="button" value="≠" name="H" title="≠" onclick="bbcode('≠','')" />
<input type="button" value="≡" name="H" title="≡" onclick="bbcode('≡','')" />
<input type="button" value="±" name="H" title="±" onclick="bbcode('±','')" />
<input type="button" value="²" name="H" title="²" onclick="bbcode('²','')" />
<input type="button" value="³" name="H" title="³" onclick="bbcode('³','')" />
<input type="button" value="∀" name="H" title="∀" onclick="bbcode('∀','')" />
<input type="button" value="∃" name="H" title="∃" onclick="bbcode('∃','')" />
<input type="button" value="∅" name="H" title="∅" onclick="bbcode('∅','')" />
<input type="button" value="∴" name="H" title="∴" onclick="bbcode('∴','')" />
<input type="button" value="≅" name="H" title="≅" onclick="bbcode('≅','')" />
<input type="button" value="⊕" name="H" title="⊕" onclick="bbcode('⊕','')" />
<input type="button" value="⊗" name="H" title="⊗" onclick="bbcode('⊗','')" />
<input type="button" value="�" name="H" title="�" onclick="bbcode('�','')" />
<br /></div></div>
<br><Br>

0

5

Недокументированые возможности: дополнительные кнопки в BB-панель, предупреждаю у меня возникали проблемы с ним, кто будет ставить будьте внимательны  :O .

Скрипт добавит в вашу панель кнопки 2х категорий:
1) Работа с таблицей - т.е. кнопку Таблицы, ячейки, строки
2) BB-коды - Добавлено [add*][/add*]
предварительно форматированый текст [pre*][/pre*]
желтый фон [h*][/h*]
горизонтальная линия [hr*]

Вставлять в HTML верх или форму ответа.

Код:
<script type="text/javascript">
var name2="'[/add]')\" /></fieldset></td><td style=\"border: 0;\"><fieldset style=\"padding: 3px;\"><legend>Таблица</legend><input type=\"button\" value=\" Таблица \" title=\"Создать скелет таблицы\" name=\"TABLE\" onclick=\"bbcode('[table]','[/table]')\" /><input type=\"button\" value=\" Строка \" name=\"TR\" title=\"Добавить строку в вашу таблицу\"  onclick=\"bbcode('[tr]','[/tr]')\" /><input type=\"button\" value=\"Ячейка\" name=\"TD\" onclick=\"bbcode('[td]','[/td]')\" title=\"Добавит ячейку в строку\"  /></fieldset></td></table></div>"
var arr=document.getElementsByTagName("div")
i=0
str=document.URL
while(arr[i] ){
if(arr[i].className=="fs-box hashelp"){
name=arr[i].innerHTML
name=name.substring(0)
arr[i].innerHTML="<div class=\"inform\" id=\"q1Span\" ><table style=\"border: 0;\"><tr><td style=\"border: 0;\"><fieldset style=\"padding: 3px;\"><legend>Текст</legend><input type=\"button\" value=\"Желтый фон\" name=\"H\" title=\"Добавит желтый фон к вашему тексту\" onclick=\"bbcode('[h]','[/h]')\" /><input type=\"button\" value=\" PRE \" name=\"PRE\" title=\"Предварительно отформатированый текст\" onclick=\"bbcode('[pre]','[/pre]')\" /><input type=\"button\" value=\"Линия\" name=\"H\" title=\"Добавит горизонтальную линию к вашему тексту\" onclick=\"bbcode('[hr]',' ')\" /><input type=\"button\" value=\"Добавлено\" name=\"add\" title=\"Если вы хотите добавить комментарий к вашему же сообщению, отредактируйте свое сообщение и внесите свой текст. После этого выделите и нажмите на эту кнопку.\" onclick=\"bbcode('[add]',"+name2+""+name+""
}
i++
}
</script>

0

6

Еще один спойлер. Кнопка на панели bb-кодов отображается при редактировании.

Код:
<!--Спойлер-->
<style type="text/css">
#button-spoiler {background-image:url('http://forumupload.ru/uploads/000a/45/08/94-4.png'); 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'><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) || (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=\"button-spoiler\" title=\"Спойлер\" onclick=\"bbcode('[spoiler]','[/spoiler]')\" src=\"/i/blank.gif\" />"
</script>

http://forumupload.ru/uploads/000a/45/08/94-4.png

Код:
http://forumupload.ru/uploads/000a/45/08/94-4.png

- картинку кнопки можете менять соблюдая размеры рисунка.

0

7

Спойлер. Можно вкладывать один в другой.

html-НИЗ

Код:
<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=\"insert_text('[spoiler]', '[/spoiler]')\" src='http://karpoff.5bb.ru/uploads/karpoff/2_spoiler.gif' alt='Спойлер' />"
</script>

0


Вы здесь » Gamer`s Club » Скрипты. » HTML в форме ответа.