Custom CSS Beta Discussion

Micah
Micah
edited July 2012 in Campaign Portal Building
This is a place to discuss any thoughts related to the Custom CSS / Campaign Theming that we're working on. In a nutshell, we're exploring the option of allowing people to define their own campaign-wide CSS rules. We've got a working prototype, but we'd like some more feedback before releasing it to everyone.

If you're not part of the beta, don't worry, we'll be releasing it soon enough.

If you are part of the beta (or have ideas), think about these questions:

* Are there any malicious CSS tricks we need to be especially aware of? We do some sanitizing and sanity checks, but CSS hackery is not something I'm terribly familiar with.
* What changes to the markup are necessary to support maximum flexibility in theming? We're happy to add extra divs, spans, classes, ids, etc, etc. If there's a particular CMS out there that does a good job with this, please point us.
* How can we roll this out (new markup, specifically) without destroying existing campaign theming? Do we need to support both the old and new markup styles? That would be a real pain on our end, but I can understand if it's necessary.
* Is there anything else we should be considering at the same time? What am I missing?

Thanks again for all your help!
«13456725

Comments

  • JustinMason
    JustinMason
    Posts: 36
    I’m not sure on the limitations of the flexibility of control you have over parsing the CSS before outputting, but one thing I would suggest is to limit the value of the z-index to 1 thru[specified value]. Then force a global z-index value with a value greater than that specified value to be loaded after the custom CSS output. This would be to keep the OP header bar, and login component at the top-most layer always. This will prevent anyone from creating any sort of misleading “false logins” or hiding the Obsidian Portal branding. Should probably also do the same for footer/copyright information as well.
  • JustinMason
    JustinMason
    Posts: 36
    ^^ Not sure that came across clear. For instance, by limiting the value of custom z-index to 9999, and then forcing a z-index value of 10000 to the OP header, login box, and footer, you would assure that they are always on top of any custom elements created.
  • Langy
    Langy
    Posts: 364
    Oh hell yes.

    HTGN's got a good point about having a maximum z-index, but you should also allow negative z-indexes (they're used to create the custom backgrounds that we use).

    I honestly can't think of any reason you'd need new markup; I've already utilized a custom CSS style for one of my campaigns (overriding the site's CSS using a Firefox plugin to make some of the default colors a bit darker, fitting in with the rest of the page better). I can't see any reason you'd need anything new for the markup, though - just a place to input the campaign's CSS style rules.

    It's great to hear about new OP functionality like this!
  • Kallak
    Kallak
    Posts: 1,090
    Did some minor experimentation with the custom CSS last night, mostly just copy/paste code from sites see what all properties and such worked. Things that I noted:

    -Easy capability to change core OP elements (wiki item/character slug color, main-column background color, etc..) is monumentally kickass!
    -Style elements associated via class (ie, .classname) worked fine, however, style elements associated via id (ie, #idname) did not work.
    -Sometimes elements being altered by style would appear unchanged in preview mode, but then changed once the page was saved. Other times not. More testing needed.
    -Content property (requiring pseudo element :before or :after) does not appear to work.

    First impressions: Very cool. The capability to make quick site wide changes is awesome, not to mention "hiding" all the styling in the custom CSS makes the page source easier to read for less net savvy players who would still like to make alterations to pages or additions. Campaigns that are "properly" coded with full CSS implementation in mind (start planning now!) can easily be given an entirely new look from the custom CSS area alone. The concept is a huge leap forward for OP.

    That said (and granted this isn't really CSS related per se, but still worth mentioning), I believe people with custom top or side navigation setups (like me) will still desire some sort of "include" feature to get blocks of code onto every page - as CSS isn't really setup to handle this (particuarly with the Content property not working) - but based on what I'm seeing with the custom CSS, such a feature could likely be put into place via a similar format.

    More to come as I keep experimenting with it.
    All the best,
    - Kallak
  • Micah
    Micah
    Posts: 894
    Includes and other templating will have to wait. I'd like to be able to support it, but it's just out of scope at this point and much harder to define than allowing CSS. I'd really rather not try and build a templating engine, although we may have to do something like that at some point

    The z-index points about branding and positioning false links is something I'll have to think about. Catching and sanitizing that kind of thing would require a CSS parser and then some rules to check. That may be doable, but parser writing is up there with templating in my list of things I don't want to do.

    Keep the ideas coming...
  • Kallak
    Kallak
    Posts: 1,090
    Another sidenote, CSS rollover test = successful.

    "rollover test page":http://www.obsidianportal.com/campaign/dangerous-kalamar-4/wikis/ooc
    All the best,
    - Kallak
  • Langy
    Langy
    Posts: 364
    To be honest, the z-index bit is something that someone could mess with even without CSS. CSS only makes it easier, rather than anything else.
  • JustinMason
    JustinMason
    Posts: 36
    ^ Technically, that's correct. z-index can be modified with Inline CSS via the style property of elements even without this upgrade. But I'm assuming any sort of parsing would be done at the pre-output level, and not to the individual data field, thus would solve the issue for both inline and "style sheet" css.
  • JustinMason
    JustinMason
    Posts: 36
    Technically a lot can be done without utilizing the z-index. If it came down to having to loose the flexibility of CSS overall (especially the new global CSS "style sheet"), I would rather loose access to the z-index all together. That would greatly simplify any parsing routine if push comes to shove.
  • JustinMason
    JustinMason
    Posts: 36
    Technically, I use the word "technically" a lot.
  • dlaporte7271
    dlaporte7271
    Posts: 94
    yes...but that's just a technicality...technically speaking.

    dlaporte
    "violent skies":http://www.obsidianportal.com/campaigns/violent-skies
  • Langy
    Langy
    Posts: 364 edited July 2012
    Hell no; the z-index is required in order to do a few things, like the custom background images that are so popular. Breaking that many games all at once is probably not a good idea.

    EDIT: Though the custom CSS would probably allow us to do the custom backgrounds properly, removing the ability to use the z-index property would break a lot of sites all at once until everyone fixes them.

    Also, there's some z-index stuff that I require with a DST I recently created; even if z-indexes would be disallowed on other stuff, not allowing them with custom DSTs could be problematic.
    Post edited by Langy on
  • ChainsawXIV
    ChainsawXIV
    Posts: 530 edited July 2012
    This is a great feature, and after playing with it a bit on my "test campaign":http://www.obsidianportal.com/campaign/chainsawxiv-test-campaign/wikis/alchemical-charms there's honestly not a whole lot more I'd ask for from it, though I'll keep looking for details. At this point, I have only two things to add:

    On the cosmetic end, it would be good to make the OP logo in the top navigation bar a transparent PNG so that it blends against backgrounds better.

    On the more technical end, in addition to users hiding things you just don't want them to as discussed above, there is the danger that they will hide the text area used to edit their own CSS, the button used to submit their changes, or one of their parent elements, rendering it impossible for them to fix their own mistake.

    I've got an easy fix for these issues though:

    Create a second non-user-controlled CSS entry which is applied _after_ the user's, and contains rules for mission-critical elements. Anything you're comfortable with the user overriding you leave where it is, and anything vital you move into the new entry, along with a few new rules which enforce _display_ and _alpha_ values on things which shouldn't ever be hidden. Because CSS entries are processed in order, anything set there will automatically trump what the user may have specified.
    Post edited by ChainsawXIV on
  • ChainsawXIV
    ChainsawXIV
    Posts: 530
    A couple other notes, not so much about this directly as about things it shows up as in need of a bit of love:

    - The drag-handle under text areas ("example":http://www.obsidianportal.com/campaign/chainsawxiv-test-campaign/comments) should probably be converted to transparent PNG.

    - Some buttons are button tags, some are spans, picking one would look better and be easier to style.
  • Micah
    Micah
    Posts: 894
    All good comments, let me hit a few (in no particular order):

    The z-index discussion is good. We may implement something along the lines of limiting the z-index values, but as discussed someone can just inline style what they want. We really don't do a lot of pre-rendering or manipulating. We basically take the HTML and CSS you give us, do some basic sanitizing, and then send that to the browser. We mainly look at structure and don't consider semantics. Trying to determine z-values of particular elements is much more semantic than anything else we do. It's a tough call, as I don't want to leave open known vulnerabilities, but at the same time I hate the idea of spending lots of time fighting a war that's only in my head. So far we've been blessed with non-malicious users (and very awesome users, in fact) so I hate fighting shadows.

    I like the idea of a final, mission critical stylesheet. I was also worried about people making the site unusable for themselves, and this would work well to prevent that.

    Transparent png for the logo is a good idea. Not sure why we haven't done that yet.

    Button vs link/span on "buttons" has been a pain in our ass for a long time. Anyone have a good guide on making button inputs look decent? Or, is there a way to make submit inputs with links and spans? I really hate the default HTML buttons.
  • ChainsawXIV
    ChainsawXIV
    Posts: 530
    For the buttons, simply doing them all the same way, using the same class(s) would be a big help from a CSS standpoint, as we could then re-style them to our hearts content without targeting things individually.

    I don't know of a better canned solution for custom buttons off the top of my head, but its a simple enough concept that I'm sure there are some out there. Personally, I quite like the standard interface elements as presented by browsers these days, but I know that this is more because of their uniform presentation and resolution independence than for aesthetic reasons, and I can understand your distaste. If you bullet point what you consider to be the vital features and qualities you need, and the deficiencies you see in the default inputs, I'd be happy to do some digging though.
  • Langy
    Langy
    Posts: 364
    I have a suggestion, though what I want to do with it would only really work with a few other changes to the site.

    For CSS styling, I'd like to be able to style elements by ID.

    What I'd like to do with this is to restyle the Wiki section of a campaign entirely, moving the 'Create New Page' button all the way up to the top of the OP sidebar right below the User Profile. Then I'd hide the rest of the OP sidebar, and utilize the space freed up to expand the content section of my wiki.

    The only way this would work out well and without removing any nice features is if the 'Previous Versions' and 'Tags' section of the wiki pages are moved to the Edit page, which honestly is probably where they should be anyways. The rest of the stuff in the OP sidebar really doesn't need to appear on every Wiki page; instead, I think they'd be just fine appearing solely on the campaign's Home page.

    Another thing that might be needed would be an overall class being added to all Wiki pages. That way, I'd be able to style the Wiki pages separately from the non-Wiki pages.
  • ChainsawXIV
    ChainsawXIV
    Posts: 530
    You can style by ID already, and most or all of the elements you're talking about have IDs assigned to them. I haven't actually tried it, but you should be able to do everything you want to do _except_ the bit where things show up in edit mode that don't in normal. That, I fully agree, would be a great feature - apply a class to the page in edit mode that's not there in normal, so that we can style differently in one mode than the other.
  • Langy
    Langy
    Posts: 364
    You can style by ID? Kallak earlier indicated that you couldn't. That's excellent.

    Are you sure that there's an overall 'wrapper' class added to Wiki pages, to allow us to style them differently from the other pages? I haven't seen one when looking through the source code. Ideally, different page types would have different wrapper classes.
  • ChainsawXIV
    ChainsawXIV
    Posts: 530 edited July 2012
    You can definitely style by ID, using the normal #id rule setup. That much I've tested.

    You're correct however that the different content types aren't differently classed at the moment. That'd be handy. Most of the individual elements have ID's already however, so you can target them easily enough.
    Post edited by ChainsawXIV on
  • RaseCidraen
    RaseCidraen
    Posts: 890
    I'm only vaguely learned in the ways of CSS, and you guys are testing out some quite awesome code here.

    To be completely honest, I almost wet myself when I read about the rollover. That's something I've been wanting to do for ages. Good lord. You guys have made my year.
  • Kallak
    Kallak
    Posts: 1,090 edited July 2012
    "You can definitely style by ID, using the normal #id rule setup. That much I’ve tested."

    Something is off here, cause this definitely is not working for me..

    EDIT: As a point of clarification, applying style to default OP elements by ID works for me (like the main-column background from my earlier post, etc.) but styling content that I write into the pages by ID is what is not working for me. Have you tested that with success?

    EDIT 2: Hmm, apparently using the id tag under div's and such doesn't work when coding content for pages?
    Post edited by Kallak on
    All the best,
    - Kallak
  • ChainsawXIV
    ChainsawXIV
    Posts: 530 edited July 2012
    Ah, there's the problem. The CSS works fine, but the id parameter is not allowed in your html-based page content (presumably because you could do something invalid like use the same id as a standard element elsewhere on the page, and break things). For content you're creating yourself though, you can just add a unique class for the same results.
    Post edited by ChainsawXIV on
  • Micah
    Micah
    Posts: 894
    It looks like we do strip out the id attribute. It doesn't seem like too much of a security issue to allow user-specified id's, especially considering how much else is allowed, so I could remove that restriction if it's desired.

    _You’re correct however that the different content types aren’t differently classed at the moment._ - What does this mean? I think this may be what I was trying to express when asking if people wanted more semantic markup. If you want us to add more classes and such we can do that, I just need a little guidance on what to add. I suppose I could also just go nuts and add tons of classes to everything.

    In any case, based on the fact that everyone seems generally happy with this feature as-is, I'm planning on rolling it out to everyone in the next couple days. We may do a quiet rollout, make sure it's generally working, and then make a big announcement.

    Thanks again for all the help and ideas, and if you have more ideas, please keep them coming.
  • Langy
    Langy
    Posts: 364
    The different content types that need classes or IDs are the bits on the sidebar - for Wiki pages, the profile section, then the tags, the tag list, the previous versions, tools, latest updates, quick stats, and fans sections.

    Further, different page types should have different IDs to allow us to specify different styles for different page types. For example, all 'Wiki' pages should have a 'wiki' class that covers everything on the page, all 'character' pages should have a 'character' class, the character list should have a 'characterList' class, etc.
  • Micah
    Micah
    Posts: 894
    What if we attached a class to the body element to identify the current page?

    Potential Classes:

    * wiki-page
    * wiki-index
    * adventurelog-index
    * adventurelog-post
    * character-index
    * character-page
    * item-index
    * item-page

    and so forth...

    Would that help?
  • WiseOldOwl
    WiseOldOwl
    Posts: 3
    @Micah:

    A couple suggestions related to your list of potential classes:

    1) Adding a class "edit-page" that is only used as an additional class (i.e., class="wiki-page edit-page") would solve the desire to distinctly style edit and display pages, without having to create a separate edit page class for each page type.

    2) The class "adventurelog-post" breaks the implicit naming convention used in the other classes ("foo-page"). Recommend using "adventurelog-page" instead.

    Walter
  • Langy
    Langy
    Posts: 364
    Yep, that sounds exactly like what I'd like, Micah; I'd also follow MugMug's suggestions. Making it so the various sidebar bits can show up in both the 'edit' page and the 'view' page for each type would be nice, too (though I assume some of them will be hidden by default).

    Anyways, great that you're putting this out there. Definitely looking forward to it, even though it totally means a rework of my campaign again (eventually, anyways). After that, just work on making 'includes' available and you'll make tons of people happy, happy, happy;)
  • GamingMegaverse
    GamingMegaverse
    Posts: 2,998
    I agree with MugMug as well- consistent naming conventions would help!

    Just trying to help out.

  • Micah
    Micah
    Posts: 894
    I'm doing an overhaul of the markup right now, and it actually looks halfway decent. There are a few places that need work, but most pages already have a div with a class explaining the page's purpose. I've added some more divs/spans in places where we just had text hanging undecorated. I've also focused on the display side, not editing, since display seems like a higher priority. Custom styling for the edit forms is less important.

    I hope to launch this to everyone sometime in the next week.
Sign In or Register to comment.

March 2024
Wrath of the Highborn

Read the feature post on the blog
Return to Obsidian Portal

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions