Если кто не знает, что такое Real Music и с чем его едят, читайте это http://www.realmusic.ru/about/
Скрипт ставится в HTML-низ.
Код:
<script type="text/javascript"> function addSpoiler(str,from,internal){ var pos=0,pos2=0,newpos=0 if((pos=str.indexOf("[music]",from))==-1) return str; if((pos2=str.indexOf("[/music]"),pos+8)==-1) return str; newpos=str.indexOf("[music]",pos+8) if(newpos<pos2 && newpos!=-1) str=addSpoiler(str,pos+8,true) if((pos2=str.indexOf("[/music]",pos+8))==-1) return str; str=str.substring(0,pos)+makeSpoiler(str.substring(pos+7,pos2))+str.substring(pos2+8,str.length) if( str.indexOf("[music]")!=-1 && internal==false) str=addSpoiler(str,0,false) return str } function makeSpoiler(txt){ txt='<br /><embed type="application/x-shockwave-flash" src="http://www.realmusic.ru/system/mplayer/mediaplayer.swf" quality="high" allowscriptaccess="always" flashvars="height=20&width=400&file=http://files.realmusic.ru/files/'+txt+'/'+txt+'.mp3" height="20" width="400">'; 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(post.innerHTML,0,false)}} </script>
А вот кнопка, которая ставится в форму ответа
Код:
<style> #button-music {background-image:url(http://img20.imageshack.us/img20/4541/realmusic2.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(20).innerHTML="<img title='Загрузить музыку с RealMusic.ru' img src='/i/blank.gif' id='button-music' onclick=\"bbcode('[music]', '[/music]');\"/>" </script>
при нажатии кнопки выскакивают теги [music]......[/music]
допустим нужная мне песня имеет адрес http://www.realmusic.ru/songs/584174
из него нам понадобятся только цифры, получится [music]584174[/music]