June 2007
Intermediate to advanced
294 pages
8h 6m
English
In many ways, this script is just a glorified hack of stylesheet.rcss. I separated it mainly to allow for comparison. The major difference between the two files is that stylesheet2.rcss generalizes the width values into a single function.
/* This file outputs CSS data customized by user_agent using eruby. */ <% # define functions ❶ def width(type, user_agent) ❷ small = { 'alpha' => 11.8, 'beta' => 15.8, } ❸ large = { 'alpha' => 14, 'beta' => 18, } ❹ palm = { 'alpha' => 5, 'beta' => 7, } ❺ width = if (user_agent =~ /Windows/) small[type] if (user_agent =~ /Opera/) small[type] if (user_agent =~ /MSIE 6/) large[type] if (user_agent =~ /MSIE/) small[type] elsif (user_agent =~ /Palm/) palm[type] ...Read now
Unlock full access