[1.3.b69] CSS and Chat

If you have an idea for a new feature, please discuss it in the main MapTool forum first, then post a summary of the discussion here. Use the first Sticky as a template.

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

User avatar
Ghiolekk
Giant
Posts: 118
Joined: Wed Dec 09, 2009 4:44 pm
Contact:

Re: [1.3.b69] CSS and Chat

Post by Ghiolekk »

Nice looking stuff, maybe I'll create some automated macros for my treasure.

User avatar
biodude
Dragon
Posts: 444
Joined: Sun Jun 15, 2008 2:40 pm
Location: Montréal, QC

Re: [1.3.b69] CSS and Chat

Post by biodude »

Azhrei wrote: The first element that appears in the chat panel which is NOT valid inside the <head> is probably what triggers the Java code to switch from the head to the body. And once switched, you can't get back. :(
Not from what I can tell, although macro output does get ... altered ... considerably on the way to chat. For example, a macro containing this:

Code: Select all

<link rel="stylesheet" type="text/css" href="styles.css@[R: getMacroLocation()]"> <!-- Custom stylesheet.  "@this" will not work -->

<!-----===== OnCampaignLoad =====----->
<b>HTML START</b>
<p>paragraph <em>of text</em>.</p>
Produces chat output like this in html (even if it is the first thing that runs):
Chat output

Code: Select all

<html>
  <head>
    <style type="text/css">
      <!--
        body { font-family: sans-serif; font-size: 12pt }
        div { margin-bottom: 5px }
        span.roll { background-color: #efefef; background-attachment: scroll; background-repeat: repeat }
        span.trustedprefix { background-color: #D8E9F6; background-repeat: repeat; background-attachment: scroll; color: #000000 }
      -->
    </style>
    
  </head>
  <body id="body">
    

    <div>
      <table cellpadding="0">
        <tr>
          <td style="padding-right: 5px" valign="top" width="40">
            <img src="asset://1f5ffdc593cfe553ae7ade46afd1174c-40">
            
          </td>
          <td style="margin-right: 5px" valign="top">
            Lib:style:
          </td>
          <td valign="top">
            
          </td>
        </tr>
        <!-- Custom stylesheet.  "@this" will not work -->
        <!-----===== OnCampaignLoad =====------>
        

        <tr>
          <td>
            HTML START

            <p rel="stylesheet" type="text/css" href="styles.css@Lib:style">
              paragraph <em>of text</em>.
            </p>
          </td>
        </tr>
      </table>
    </div>
  </body>
</html>
From what I can tell, when 'onCampaignLoad' macros are loaded, there is absolutely no output to chat. The output above was generated by clicking on the 'onCampaignLoad' macro manually.

Next, notice in the html how the macro output was not simply 'dumped' to the chat?
  • The <b> tags around the first line of actual text are missing
  • The <link> tag is missing, but the comments are still there (between rows of the formatting in chat?) :?
  • the attributes of the link tag in the first line have been added to the <p> tag later on. :shock:
So, no go on the "sneak a stylesheet in during chat load" idea :(
Azhrei wrote:Some day we'll have an entry in the Campaign Properties where the GM can provide a URI to a global stylesheet. But don't hold your breath.
I would actually consider this an accessibility issue. The current preferences allow you to change the size of the font, but not the font face, or colours. Or all other manner of things CSS is designed for.
What about a text box in the "Accessibility" tab of the application preferences where a user could write/paste a personal stylesheet, which is loaded in the header of the chat html?

I don't know anything about the technicalities of how the chat is rendered, I'm just thinking from a user perspective. But, I can see it being a choice between loading all the CSS once at the beginning, or trying to re-draw the entire chat panel () with new CSS rules.
What about a compromise whereby the chat html & CSS is re-loaded when it is cleared (/clr), including a custom statsheet?
"The trouble with communicating is believing you have achieved it"
[ d20 StatBlock Importer ] [ Batch Edit Macros ] [ Canned Speech UI ] [ Lib: Math ]

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [1.3.b69] CSS and Chat

Post by Azhrei »

biodude wrote:I don't know anything about the technicalities of how the chat is rendered,
Well, I'm no expert but I know a little about it. And from what I've seen, the Stylesheet object would need to be applied to each Document object after it's created. That means anywhere in the code that pops up an HTMLPane (and hence instantiates a Document object), anywhere that has HTML inside a label or button or checkbox or dropdown list, or anywhere else that HTML is rendered would need to have the Stylesheet object assigned to it. And that's a whole boatload of code we're talking about changing!
I'm just thinking from a user perspective.
The UI is not a problem. There are lots of ways to answer the question of how to get the CSS into the program in the first place -- that's a piece of cake. It's what has to be done with it once it's in there that's a problem. :(

We really need a better HTML rendering engine, but that's been discussed before as well. I weighed in on that discussion as did Craig, jfrazierjr, and Phergus (IIRC). It's a pretty old thread now; perhaps 8 months or so...?

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: [1.3.b69] CSS and Chat

Post by jfrazierjr »

Azhrei wrote:We really need a better HTML rendering engine, but that's been discussed before as well. I weighed in on that discussion as did Craig, jfrazierjr, and Phergus (IIRC). It's a pretty old thread now; perhaps 8 months or so...?
Yea, and as noted in that thread, "better" still does not mean compliant with the current html/css standards by any stretch, so it's not a be all, end all solution. Plain and simple java is just behind the times in ways to support current html standards... which is probably why browsers are not written in java very often.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: [1.3.b69] CSS and Chat

Post by jfrazierjr »

I just noticed JRex in a search. It is based on the Mozilla renderer.... The page had no specific information about HTML/CSS support, but I would expect that it would work fairly well since it's based on the Mozilla renderer(which I can't remember the name of now and don't have the time to look up ATM).

They have not tested on Mac, so that might be an issue... perhaps someone with a Mac can run their webstart demo???
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [1.3.b69] CSS and Chat

Post by Azhrei »

You're thinking of Gecko?

Apple has done a lot of work on WebKit but it's written in C++, IIRC. Still, might be interesting to add a JNI that provides access to it from Java. It's super fast, very standards compliant, and open source (although I don't know what the license details look like).

If I get a chance I'll take a look at that demo at some point...

User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: [1.3.b69] CSS and Chat

Post by Irrlicht »

This thread is ancient, but I feel like renewing the request for using stylesheets inside macros' output to chat.
It would be very helpful and pleasant.

Also, a general upgrade of HTML and CSS wouldn't be bad, since certain tags/options still can't be used in MapTool, and they'd help much into formatting output.
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [1.3.b69] CSS and Chat

Post by JamzTheMan »

Moving to JavaFX should open that up for us. It's a plan, just a, "ug, ok who's redoing all the UI for us?" thing. It's usually an all or nothing thing (although you can mix swing and FX components, they operate on different threads so you have to mind your p's and q's...)

We should then be able to use HTML5 and all that... And of course, while updating the UI there may be a lot of new components we can toss in to add functionality, add in multiple chats, separate logs from chats, etc...

Only thing we need is time. Anyone have some surplus to throw at us? :)
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

Post Reply

Return to “Feature Requests”