ФОТОГАЛЕРЕЯ
html-верх ставим:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://itforweb.com/articles/jquery_lightbox/js/jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="http://itforweb.com/articles/jquery_lightbox/js/jquery.lightbox.packed.js"></script>
<style type="text/css">
.postmyimg { width:130px; top:2px; margin:5px; padding:0; list-style-type:none; }
.postmyimg { border:1px solid #999; margin-left:5px; }
.postmyimg {cursor: pointer;}
</style>
html-низ ставим:
<script type="text/javascript">
$(document).ready(function(){
$('.postmyimg').lightbox();
});
</script><script type="text/javascript">
function addSpoiler_img(str,from,internal){
var pos=0,pos2=0,newpos=0
if((pos=str.indexOf("[myimg]",from))==-1) return str;
if((pos2=str.indexOf("[/myimg]"),pos+8)==-1) return str;
newpos=str.indexOf("[myimg]",pos+8)
if(newpos<pos2 && newpos!=-1) str=addSpoiler(str,pos+8,true)
if((pos2=str.indexOf("[/myimg]",pos+8))==-1) return str;
txt = str.substring(pos+7,pos2);
if((sepPos=txt.indexOf("|",0))==-1) return str;
str=str.substring(0,pos)+makeSpoilerr_img(txt.substring(0,sepPos),txt.substring(sepPos+1,txt.length))+str.substring(pos2+8,str.length)
if( str.indexOf("[myimg]")!=-1 && internal==false) str=addSpoiler_img(str,0,false)
return str
}function makeSpoilerr_img(txt1,txt2){
txt='<img class="postmyimg lightbox-enabled" src="'+txt1+'" alt="'+txt2+'">';
return txt;
}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_img(post.innerHTML,0,false)}}
</script>
HTML в форме ответа:
<style type="text/css">
#button-gallery {background-image:url('http://img502.imageshack.us/img502/9378/cameraromych.png'); padding:0; line-height:0; background-position:center; background-repeat:no-repeat; height:26px; width:100%}
</style>
<script type="text/javascript">
function tag_urlg()
{var FoundErrors = '';
var enterURL = prompt("Введите ссылку на изображение", "http://");
var enterTITLE = prompt("Введите описание", "Моё фото");
if (!enterURL)
{FoundErrors += " " + error_no_url;}
if (FoundErrors)
{alert("Ошибка!" + FoundErrors);
return;}
insert("[myimg]" + enterURL + "|" + enterTITLE + "[/myimg]");}
if(form=document.getElementById("form-buttons"))
form.getElementsByTagName("tr")[0].insertCell(22).innerHTML="<img src='/i/blank.gif' title='фотогалерея' id='button-gallery' onclick=\"tag_urlg()\">"
</script>