Algaza

BBCode Javascript

Dec 13th, 2017
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var msg=document.getElementsByName("bbcode");for(var i=0;i<msg.length;i++)
  2. {
  3.     var txt=document.getElementsByName("bbcode")[i].innerHTML;
  4. txt=txt.replace(/\[youtube=(.+?)\]/ig,'<div name="video"><embed type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="400px" src="$1&amp;vq=large"/></div>');
  5. txt=txt.replace(/\[PHP\]/ig,'<pre class="quote1">PHP:<hr/><code name="codes" class="code">');
  6. txt=txt.replace(/\[\/PHP\]/ig, "</code></pre>");
  7. txt=txt.replace(/\[left\]/ig,'<div align="left">');
  8. txt=txt.replace(/\[\/left\]/ig, "</div>");
  9. txt=txt.replace(/\[br\]/ig,'<br/>');
  10.  
  11. txt=txt.replace(/\[url=(.+?)\]/ig,'<a href="$1">');
  12. txt=txt.replace(/\[\/url\]/ig, "</a>");
  13. txt=txt.replace(/\[link=(.+?)\]/ig,'<a href="$1">');
  14. txt=txt.replace(/\[\/link\]/ig, "</a>");
  15.  
  16. txt=txt.replace(/\[u\]/ig,'<u>');
  17. txt=txt.replace(/\[\/u\]/ig, "</u>");
  18.  
  19. txt=txt.replace(/\[img=(.+?)\]/ig,'<img src="$1" alt="*" title="*"/>');
  20.  
  21. //Download
  22. txt=txt.replace(/\[download\](.+?)\[\/download\]/ig, '<div style="text-align: center;"><span style="background-color: red; font-size: large;">Silahkan Unduh File</span></div><div style="text-align: center;"><b><span style="background-color: #ffd966; font-size: large;"><a href="http://wap4dollar.com/ad/nonadult/serve.php?id=kqepg9ub4i"><span style="color: blue;">Download</span> </a>- <span style="color: red;"><a href="http://$1">Download</a></span></span></b></div></div>');
  23.  
  24.  
  25.  
  26. txt=txt.replace(/\[b\]/ig,'<b>');
  27. txt=txt.replace(/\[\/b\]/ig, "</b>");
  28. txt=txt.replace(/\[s\]/ig,'<s>');
  29. txt=txt.replace(/\[\/s\]/ig, "</s>");
  30. txt=txt.replace(/\[center\]/ig,'<center>');
  31. txt=txt.replace(/\[\/center\]/ig, "</center>");
  32. txt=txt.replace(/\[right\]/ig,'<div align="right">');
  33. txt=txt.replace(/\[\/right\]/ig, "</div>");
  34. txt=txt.replace(/\[justify\]/ig,'<div align="justify">');
  35. txt=txt.replace(/\[\/justify\]/ig, "</div>");
  36. txt=txt.replace(/\[input=(.+?)\]/ig,'<span name="codes"><input type="$1" value="');
  37. txt=txt.replace(/\[\/input\]/ig,'"></input></span>');
  38. txt=txt.replace(/\[div=(.+?)\]/ig,'<div class="$1">');
  39. txt=txt.replace(/\[\/div\]/ig,'</div>');
  40. txt=txt.replace(/\[text\]/ig,'<textarea class="show" rows="3">');
  41. txt=txt.replace(/\[youtube\](.+?)\[\/youtube\]/ig,'<embed type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="400px" src="http://youtube.com/v/$1&amp;vq=large"/>');
  42. txt=txt.replace(/\[\/text\]/ig, "</textarea>");
  43. txt=txt.replace(/\[form\]/ig,'<form method="get" action="site_0.xhtml">');
  44. txt=txt.replace(/\[\/form\]/ig, "</form>");
  45. txt=txt.replace(/\[option\]/ig, "<option>");
  46. txt=txt.replace(/\[\/option\]/ig, "</option>");
  47. txt=txt.replace(/\[select\]/ig, "<select>");
  48. txt=txt.replace(/\[\/select\]/ig, "</select>");
  49. txt=txt.replace(/\[indent\]/ig,'<div style="margin-left:12px">');
  50. txt=txt.replace(/\[\/indent\]/ig, "</div>");
  51. txt=txt.replace(/\[xt\]/ig,'<span style="display:scroll;position:relative;top:-10px">');
  52. txt=txt.replace(/\[xb\]/ig,'<span style="display:scroll;position:relative;bottom:-6px">');
  53. txt=txt.replace(/\[\/x\]/ig, "</span>");
  54. txt=txt.replace(/\[OL\]/ig,'<div id="mf_content" style="padding:0px 10px 0px"><ol>');
  55. txt=txt.replace(/\[\/OL\]/ig, "</ol></div>");
  56. txt=txt.replace(/\[UL\]/ig,'<div id="mf_content" style="padding:0px 10px 0px"><ul>');
  57. txt=txt.replace(/\[\/UL\]/ig, "</ul></div>");
  58. txt=txt.replace(/\[LI\]/ig, "<li>");
  59. txt=txt.replace(/\[\/LI\]/ig, "</li>");
  60. txt=txt.replace(/\[xp\]/ig,'<div style="padding-top:8px;padding-bottom:8px"><hr style="border-top:1px solid #aaaaaa"/></div>');
  61. txt=txt.replace(/\[cb\]/ig, '<span class="cb">');
  62. txt=txt.replace(/\[\/cb\]/ig, '</span>');
  63. txt=txt.replace(/\[TD\]/ig, '<td class="td" style="padding:2px">');
  64. txt=txt.replace(/\[\/TD\]/ig, '</td>');
  65. txt=txt.replace(/\[table\]/ig, '<table width="100%">');
  66. txt=txt.replace(/\[\/table\]/ig, '</table>');
  67. txt=txt.replace(/\[TR\]/ig, '<tr>');
  68. txt=txt.replace(/\[\/TR\]/ig, '</tr>');
  69. txt=txt.replace(/\[CAPTION\]/ig, '<caption>');
  70. txt=txt.replace(/\[\/CAPTION\]/ig, '</caption>');
  71. txt=txt.replace(/\[TD=(.+?)\]/ig,'<td width="$1" class="td" style="padding:2px">');
  72. txt=txt.replace(/\[FLASH\](.+?)\[\/FLASH\]/ig, '<object width="100%" height="400"><param name="movie" value="$1" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed width="100%" height="400" src="$1" quality="high" wmode="transparent" type="application/x-shockwave-flash"></embed></object>');
  73. txt=txt.replace(/\[MENU\]/ig, '<div class="hidden">');
  74. txt=txt.replace(/\[\/MENU\]/ig, '</div>');
  75. txt=txt.replace(/\[penting\]/ig,'<div class="important"><div class="head">Penting:</div><div class="body">');
  76. txt=txt.replace(/\[\/penting\]/ig,'</div></div>');document.getElementsByName("bbcode")[i].innerHTML=txt;}
Advertisement
Add Comment
Please, Sign In to add comment