Skip to content
General IRCX

Dcx Web Control Webchat

A TG007 community discussion started by Jess.

Discussion 2 posts
Page 1 of 1
Open
Topic #15442 · 2 published posts · 2,328 views

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();
}

 

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 Feb 16, 2012 10:24 AM by Maki