View Single Post
 
BB coding help! - JavaScript as well included
Reply
Posted 2007-08-28, 04:43 PM
I need some help setting up these bb codes
This is for more Advanced JavaScript users

I'm using phpBB3, that is a heads up.

TAG:
Code:
[FText]{TEXT}[/FText]
HTML Replacement:
Code:
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var message="{TEXT}"
var spc=10;
var speedisplay=50;
var times=2;
var rows=5;
var cols=40;
var stopbutton="yes"; // yes or no
var stopbuttonvalue=" STOP ";
var startvalue=" START ";
var len=spc*2;
var text=message;
var i;
var stop=false;
var stoppedisplay;
for (i=0;i<spc;i++) {
text=text+" ";
}
function array(n) {
this.length = n
for (i=1; i <= n; i++) {
this[i] ="";
}
return this;
}
document.writeln('<form name="F">')
document.writeln('<textarea rows='+rows+' cols='+cols+' name="display" wrap=soft></textarea>')
if (stopbutton == "yes") {
document.writeln('<br><input type=button value="'+stopbuttonvalue+'" onClick="stopstart()" name=stopit>');
}
document.writeln('</form>')
var l=text.length;
var ll=message.length;
var lb=new array(l)
var lr=new array(spc*2+1)
var lg=new array(ll)
var lk=new array(ll)
lb[0]=text;lb[l]=text;lr[0]=message;lg[0]=message;
for (j=1;j<l;j++) {
lb[j]=lb[j-1].substring(1, l)+lb[j-1].charAt(0);
}
lr[spc*2]=message;
for (i=1;i<=spc;i++) {
lr[i]=" "+lr[i-1]
}
for (i=spc*2-1;i>=spc+1;i--) {
lr[i]=" "+lr[i+1]
}
var ll=message.length;
for (j=1;j<ll;j++) {
for (i=lg[j-1].length-2;i>=0;i--) {
lg[j]=lg[j-1].charAt(i)+lg[j];
}
}
lk[ll]=message;
for (j=ll-1;j>=0;j--) {
lk[j]=lk[j+1].substring(1, l);
}
var lge="";
var lbe="";
var rle="";
for (i=0;i<rows;i++) {
lge=lge+lg[i]+unescape('%0D%0A');
}
for (i=0;i<rows;i++) {
lbe=lbe+lb[l-i]+unescape('%0D%0A');
}
for (i=1;i<=rows;i++) {
rle=rle+lr[spc*2-i]+unescape('%0D%0A');
}
var c=1;
var i=ll;
var j=0;
var f=0;
function lgf() {
if(stop==false) {
if(i>ll) {
j=0;
i=i-2;
}
if(i==0&&j==0) {
c++;
j=1;
}
if(j!=0) {
document.F.display.value=lg[i]+unescape('%0D%0A')+document.F.display.value;
i++;
}
if(j==0) {
document.F.display.value=lg[i]+unescape('%0D%0A')+document.F.display.value;
i--;
}
if(c<=times) {
setTimeout("lgf()",speedisplay);
}
else {
document.F.display.value=lge;
i=0;
j=0;
c=0;
t();
}
}
}
function t() {
if(stop==false) {
if(i>l) {i=1};
document.F.display.value=lb[i]+unescape('%0D%0A')+document.F.display.value;
i++;
j++;
if(j<=l*times) {
setTimeout("t()",speedisplay)}else{document.F.display.value=lbe;
i=0;
j=0;
rl();
}
}
}
function rl() {
if (stop==false) {
if(i>=spc*2) {i=0};
document.F.display.value=lr[i]+unescape('%0D%0A')+document.F.display.value;
i++;
j++;
if(j<len*times) {setTimeout("rl()",speedisplay)}else{document.F.display.value=rle;i=ll-1;j=0;trans()}
}
}
function trans() {
if(stop==false) {
document.F.display.value=lk[i]+unescape('%0D%0A')+document.F.display.value;
i--;
if(i!=1) {
setTimeout("trans()",speedisplay)
}
else {
i=ll;
lgf();
}
}
}
function stopstart() {
stoppedisplay=stop;
if(stoppedisplay==false) {
stop=true;document.F.stopit.value=startvalue;
}
if(stoppedisplay==true) {
stop=false;document.F.stopit.value=stopbuttonvalue;
document.F.display.value="";
i=11;
j=0;
c=0;
lgf();
}
}
if (rows>spc||rows>ll) {
alert("ERROR!\nrows can NOT be more that spaces or message length!!!!")
}
if (spc+ll>cols) {
alert("ERROR!\ncols(coloums) can NOT be less that the message length + spacing length")
}
if (rows<=spc&&rows<=ll&&spc+ll<=cols) {
lgf();
}
// End -->
</script>
</body>
Tell Me how Can I make it so that The message they write will appear in this.




------------------------------------------------------------
BA, HA HA HA HA HA HA HA HA! Dang, I sucked back then! I know how to do that, and I'm not an advanced javascript user. Not to mention, that was for phpBB. I now create my own stuff using things like: <?php preg_replace = ($find, $replace, $string); ?> - 8/15/08
HA, HA HA HA HA, AGAIN! Geez, how did I happen to look upon this again so quickly. I now really understand it. I've been under extensive and rigorous learning exercises so that I could learn JavaScript.
PHP Code:
<?php
class fart {
 function 
__construct($s) {
  
// Not going to go any further with this
 
}
 function 
__deconstruct() {
  
// Not going to go any further with this
 
}
}
/* You get the idea, I'm pretty damn good at php */
?>
- 11/12/08
 
Work List
疲れていますから 寝むってありますね。 むずかしいです。 また、ケーキ屋で ケーキを食べていました。

I've considered being a translator, but I dunno. It feels like a lot of work. If someone gets angry then I have to deal with it, you know? I'd rather just relax.

 
Speed Test
 
Favorite Anime/Manga
#01 Clannad ~After Story~
#02 Trigun {Maximum}
#03 Koi Kaze
#04 Berserk
#05 Outlaw Star
#06 Slayers
#07 Desert Punk
#08 Spirited Away
#09 Fullmetal Alchemist
#10 Shakugan no Shana
#11 Death Note
#12 FLCL
#13 Tokyo Magnitude 8.0
#14 Toradora
#15 Gunslinger Girl

 
Anime List

Last edited by Goodlookinguy; 2008-11-12 at 11:56 PM.
Old
Profile PM WWW Search
Goodlookinguy seldom sees opportunities until they cease to beGoodlookinguy seldom sees opportunities until they cease to beGoodlookinguy seldom sees opportunities until they cease to beGoodlookinguy seldom sees opportunities until they cease to be
 
 
Goodlookinguy