Jump to content

Dcx Web Control Webchat


Jess

Recommended Posts

So pretty much I been toying with the web control

I am just stuck with the java script on how to add new lines with new text

Tried a few ideas, but I am sure there is a better way then storing all the text to a .txt and loading it all on new txt each time. least I hope so

any help would be great this is the alias I am using atm to write the text (working on it on chatcore)

alias d.write {
  var %w web. $+ $1
  var %time $+($str($chr(160),2),<span style='font-family:Calibri; color:grey;'>,$timestamp ,</span>)
  var %oplvl $str($chr(160),2) $img.path($ulvl($1,$2))
  var %nick $+($str($chr(160),2),<span style='font-family:Calibri; color:#073983;'> ,$2,:</span>)
  if ($regex($3-, /^.*##\*#(.*)#(.*)~(.)~(.)#\*##(.*)/)) {
    var %f $regml(1)
    var %c $regml(2)
    var %b $iif($regml(3),<b>)
    var %i $iif($regml(4),<i>)
    var %m $regml(5)
  }
  var %msg $+(<span style='font-family: $iif(%f,%f,Calibri) ; color: $iif(%c,%c,Black) ;'>,%b,%i,$emote($iif(%m,%m,$3-)),$iif(%b,</b>),$iif(%i,</i>),</span>)
  write $+($chan,.txt) %time %oplvl %nick %msg
  var %z 1, %d $lines($chan $+ .txt)
  xdid -j %w 3 document.open();
  while (%z <= %d) {
    xdid -j %w 3 document.write(" $read($chan $+ .txt,%z) <br>");
    inc %z
  }
  xdid -j %w 3 document.close();
}
Link to comment
Share on other sites

With some help from Bench, I got it working, now to theme it all out and put it t work :P

alias d.write {
  var %w web. $+ $1
  var %time $+($str($chr(160),2),<span style="font-family:Calibri; color:grey;">,$timestamp ,</span>)
  var %oplvl $str($chr(160),2) $img.path($ulvl($1,$2))
  var %nick $+($str($chr(160),2),<span style="font-family:Calibri; color:#073983;"> ,$2,:</span>)
  if ($regex($3-, /^.*##\*#(.*)#(.*)~(.)~(.)#\*##(.*)/)) {
    var %f $regml(1)
    var %c $regml(2)
    var %b $iif($regml(3),<b>)
    var %i $iif($regml(4),<i>)
    var %m $regml(5)
  }
  var %msg $+(<span style="font-family: $iif(%f,%f,Calibri) ; color: $iif(%c,%c,Black) ;">,%b,%i,$emote($iif(%m,%m,$3-)),$iif(%b,</span></i></b><i>),$iif(%i,</i>),)
  xdid -j %w 3 var prefix = document.createElement('span');
  xdid -j %w 3 var message = document.createElement('span');
  xdid -j %w 3 prefix.innerHTML = " %time %oplvl %nick ";
  xdid -j %w 3 message.innerHTML = " %msg <br> ";
  xdid -j %w 3 document.body.appendChild(prefix);
  xdid -j %w 3 document.body.appendChild(message);
  xdid -j %w 3 window.scrollTo(0,document.body.scrollHeight);
}
Edited by Maki
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...