Youtube in forum

228
.
<script language="javascript">
var msg=document.getElementsByName("dpro");
for(var i=0;i<msg.length;i++){
var txt=document.getElementsByName("dpro")[i].innerHTML;
txt=txt.replace(/\[IMG](.+?)\[\/IMG]/ig, '<a href="$1" title="Click to view original picture" target="_blank"><img src="$1" alt="'+document.title+'" style="max-width:100%;margin-bottom: 10px; margin-top: 10px;"/></a>');
txt=txt.replace(/(^|[\n ])([\w]+?:\/\/[^ ,\"\n\r\t<]*)/ig,'$1<a href="$2" target="_blank">$2</a>');
txt=txt.replace(/\[LEFT\]/ig,'<div align="left">');
txt=txt.replace(/\[\/LEFT\]/ig, "</div>");
txt=txt.replace(/\[CENTER\]/ig,'<center>');
txt=txt.replace(/\[\/CENTER\]/ig, "</center>");
txt=txt.replace(/\[RIGHT\]/ig,'<div align="right">');
txt=txt.replace(/\[\/RIGHT\]/ig, "</div>");
txt=txt.replace(/\[EMAIL\](.+?)\[\/EMAIL\]/ig, '<a href="mailto:$1">$1</a>');
txt=txt.replace(/\[SIZE=(.+?)\]/ig,'<font size="$1">');
txt=txt.replace(/\[\/SIZE\]/ig, "</font>");
txt=txt.replace(/\[TEXT\]/ig,'<textarea rows="5" name="textareacodes">');
txt=txt.replace(/\[\/TEXT\]/ig, "</textarea>");
txt=txt.replace(/\[INDENT\]/ig,'<div style="padding-left:10px">');
txt=txt.replace(/\[\/INDENT\]/ig, "</div>");
txt=txt.replace(/\[YOU\]/ig, '<span style="color: #00dd00">Tite•Kubo</span>');
txt=txt.replace(/\[FONT=(.+?)\]/ig,'<span style="font-family:$1">');
txt=txt.replace(/\[\/FONT\]/ig, '</span>');
txt=txt.replace(/\[COLOR=(.+?)\]/g,'<font color="$1">');
txt=txt.replace(/\[\/COLOR\]/g, '</font>');
txt=txt.replace(/\[LIST\]/ig, '<ol>');
txt=txt.replace(/\[\/LIST\]/ig, '</li></ol>');
txt=txt.replace(/\[\*]/ig, '</li><li>');
txt=txt.replace(/\[RAINBOW](.+?)\[\/RAINBOW]/ig,'<span name="rainbow">$1</span>');
txt=txt.replace(/\[SPOILER]/ig,'[SPOILER]');
txt=txt.replace(/\[\/SPOILER]/ig,'[/SPOILER]');
txt=txt.replace(/\[HIDDEN\]/ig,'<center><div style="border:1px solid red;padding:3px;color:#b0b0b0">Hidden content. Quote to view!</div></center><div style="display:none">');
txt=txt.replace(/\[\/HIDDEN\]/ig, "</div>");
txt=txt.replace(/\[PHP\]/ig,'<div class="wcode">');
txt=txt.replace(/\[\/PHP\]/ig, "</div>");
txt=txt.replace(/\<div class=\"wcode\">/ig,'<div class="hwcode">CODE</div><div class="wcode">');
txt=txt.replace(/\[YOUTUBE](.+?)\[\/YOUTUBE]/ig,'<div name="video"><iframe width="100%" src="https://youtube.com/embed/$1" class="if_youtube" frameborder="0" allowfullscreen="true"></iframe></div>');

document.getElementsByName("dpro")[i].innerHTML=txt;
}
</script>




<script language="javascript">
var msga=document.getElementsByName("rainbow");
for(var i=0;i<msga.length;i++){
ray2=document.getElementsByName('rainbow')[i].innerHTML;
ray3=ray2.split("");
ray4=["#ff00ff","#ff00cc","#ff0099","#ff0066","#ff0033","#ff0000","#ff3300","#ff6600","#ff9900","#ffcc00","#ffff00","#ccff00","#99ff00","#66ff00","#33ff00","#00ff00","#00ff33","#00ff66","#00ff99","#00ffcc","#00ffff","#00ccff","#0099ff","#0066ff","#0033ff","#0000ff","#3300ff","#6600ff","#9900ff","#cc00ff","#9900ff","#6600ff","#3300ff","#0000ff","#0033ff","#0066ff","#0099ff","#00ccff","#00ffff","#00ffcc","#00ff99","#00ff66","#00ff33","#00ff00","#33ff00","#66ff00","#99ff00","#ccff00","#ffff00","#ffcc00","#ff9900","#ff6600","#ff3300","#ff0000","#ff0033","#ff0066","#ff0099","#ff00cc"];
text="";
for (var j=0;j<ray3.length;j++){
text += '<font color="'+ray4[j%58]+'">' + ray3[j] + '</font>';
document.getElementsByName('rainbow')[i].innerHTML=text;}}
</script>



<script language="javascript">
var img=document.getElementsByName("textareacodes");
for(var i=0;i<img.length;i++){
var txt=document.getElementsByName("textareacodes")[i].innerHTML;
txt=txt.replace(/&lt;br&gt;/ig,''); document.getElementsByName("textareacodes")[i].innerHTML=txt;
}
</script>



<script language="javascript">
for(var i=0;i<10000;i++){
var txt=document.getElementsByName("dpro")[i].innerHTML;
for(var j=0;j<10000;j++){
txt=txt.replace('[SPOILER]','<span class="spoiler"><a onclick="show(\'spoinum'+i+j+'\')" style="cursor:pointer">View content</a><div name="spoinum'+i+j+'" style="display:none">');
txt=txt.replace(/\[\/SPOILER]/ig,'</div></span>');
}
document.getElementsByName("dpro")[i].innerHTML=txt;
}
</script>

<script language="javascript">
function show(newItem){
var sspoinum=document.getElementsByName(newItem)[0].style.display; if(sspoinum=="block"){document.getElementsByName(newItem)[0].style.display="none";} else{document.getElementsByName(newItem)[0].style.display="block";}} </script>
.
How to add this is forum write box
.
<div class="wcode">');
txt=txt.replace(/\[YOUTUBE](.+?)\[\/YOUTUBE]/ig,'<div name="video"><iframe width="100%" src="https://youtube.com/embed/$1" class="if_youtube" frameborder="0" allowfullscreen="true"></iframe></div>');
.
(\/)____o_O____(\/)
<script language="javascript">
    var Width = document.getElementById('yut_block').offsetWidth;
    if (!Width)
    {
        Width = document.getElementById('yut_block').parentNode.parentNode.offsetWidth;
        Width = Width - 20;
    }
    Width = Width - 210;
    if (Width > 630)
        Width = 630;
    Height = Width / 16 * 9;
    document.write('<iframe width="' + Width + '" height="' + Height + '" src="https://www.youtube.com/embed/JOU622zS628" frameborder="0" allowfullscreen></iframe>');
</script>
.
Ok how this work
I'm new here
Всего: 5