Returning the CSS styles for a given class

I’m working on a huge Action and the interface is already pretty complex. I need to apply a set of CSS styles to an object I’m creating but would rather not have to add a set of UI controls for font, size, alignment, color etc but rather just ask the user for the existing class name of the style. This I can do but I need to get the CSS styles associated with that class name.
So for example:
.myclass
would return;
color:#fff; font-family:Arial,Helvetica,sans-serif; font-size:16px; text-align:center

Is there any way of doing this without trawling through the document (or external style sheets) looking for this style?
Regards,
Tim.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’m afraid you would have to go trawling. Have a look at my getAllStyles() function: style_accessors.fwaction.library.js · GitHub for an approach. (Note – this will absolutely not work as it is, it only reads class-based styles out of the override stylesheet. It doesn’t go searching through Freeway’s page style sheet or global style sheet.)

Now, you are asking the user for the name of the style they want to use, why do you need the specifics of that style? (Just curious.)

Walter

On Nov 5, 2013, at 9:26 AM, Tim Plumb wrote:

I’m working on a huge Action and the interface is already pretty complex. I need to apply a set of CSS styles to an object I’m creating but would rather not have to add a set of UI controls for font, size, alignment, color etc but rather just ask the user for the existing class name of the style. This I can do but I need to get the CSS styles associated with that class name.
So for example:
.myclass
would return;
color:#fff; font-family:Arial,Helvetica,sans-serif; font-size:16px; text-align:center

Is there any way of doing this without trawling through the document (or external style sheets) looking for this style?
Regards,
Tim.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for the clarification Walter.

I’m setting some CSS override styles on an element (adding a new font style to a div for example) and rather than add all of the interface elements from the Edit > Styles dialog into the Action I was hoping I could ask the user for the class name that they had already defined.

The final CSS output needs to be written in the format;
#myelement .mysubelement { --copy of css styles-- }

as I can’t just attach the original class to the original object.
Regards,
Tim.

On 5 Nov 2013, at 14:55, Walter Lee Davis wrote:

Now, you are asking the user for the name of the style they want to use, why do you need the specifics of that style? (Just curious.)


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

BTW, I realise that my last answer was completely vague and I apologise for that. When I get a second I’ll explain further.
Regards,
Tim.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options