Re: [DOCS] Doc fixes and improvements - Mailing list pgsql-www

From Thom Brown
Subject Re: [DOCS] Doc fixes and improvements
Date
Msg-id AANLkTik2v_rPko1X-P54LjDR+azi--ujLuRNtw+pUMuC@mail.gmail.com
Whole thread Raw
In response to Re: [DOCS] Doc fixes and improvements  (Bruce Momjian <bruce@momjian.us>)
Responses Re: [DOCS] Doc fixes and improvements
List pgsql-www
On 11 September 2010 01:34, Bruce Momjian <bruce@momjian.us> wrote:
> Bruce Momjian wrote:
>> > It wasn't introduced for the existing site, but you can grab it from here:
>> >
>> > http://pgweb.darkixion.com:8081/media/js/monospacefix.js
>> > http://pgweb.darkixion.com:8081/media/css/monospacefixes.css
>>
>> OK, that helps, and I see the issue now.  You basically have no way to
>> push the calculation up into the style sheet.  There are several
>> options:
>>
>> 1.  Use document.styleSheet[] to push changes into the style sheet
>> 2.  Use javascript to set a computed "style" string for every item with
>>     a specific class.
>> 3.  Use a single monospacefixes.css file
>> 4.  Use one of several monospacefixes.css files based on a computed value
>>
>> #1 and #2 are overkill, I think.  #3 is what we have now, and is
>> obviously deficient.  #4 seems good to me;  using
>> http://pgweb.darkixion.com:8081/media/js/monospacefix.js I would add:
>>
>>       if (propSize / monoSize >= 1.8)
>>             document.write('<style type="text/css" media="screen">@import
"/media/css/monospacefixes1_8.css";</style>\n');
>>       else if (propSize / monoSize >= 1.4)
>>             document.write('<style type="text/css" media="screen">@import
"/media/css/monospacefixes1_4.css";</style>\n');
>>       else if (propSize / monoSize >= 1.2)
>>             document.write('<style type="text/css" media="screen">@import
"/media/css/monospacefixes1_2.css";</style>\n');
>>       else if (propSize / monoSize >= 1.1)
>>             document.write('<style type="text/css" media="screen">@import
"/media/css/monospacefixes1_1.css";</style>\n');
>
> Duh, I don't know what I was thinking.  This is the way to do it ---
> create the CSS inline rather than link in a file:
>
>        if (monoSize != propSize)
>        {
>                document.write('
> <style type="text/css">
> #docContainer tt,
> #docContainer pre,
> #docContainer code {
>  font-size: ' + (propSize / monoSize) + 'em;
> }
> </style>        ');
>        }

I came up with something very similar last night but I hadn't finished
playing with it:
http://pgweb.darkixion.com:8081/media/js/monospacefix.js

But yes, I really didn't like the idea of having individual CSS files
for varying differences of font type when it could just be calculated.I'll try to get time to test it properly this
weekend.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935


pgsql-www by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [DOCS] Doc fixes and improvements
Next
From: Bruce Momjian
Date:
Subject: Re: [DOCS] Doc fixes and improvements