Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Author-based Stylin'

by idsfa (Vicar)
on Mar 18, 2006 at 21:17 UTC ( #537694=monkdiscuss: print w/replies, xml ) Need Help??

About a week ago, there was discussion in the CB about how to modify the appearance of all content on PerlMonks authored by a given monk. For example, turning all of bart's posts pink or hiding all anonymonk content (both actual suggestions from that discussion).

While several people pointed out that those could be done with various CSS tricks, it was also noticed that there are at least six different classes in use within the Monastery used to identify an author by their user number (####):

node-from-#### Newest Nodes nnt-auth-#### R.A.T.s pmnote-#### Replies chatfrom_#### Chatterbox auth-#### Best/Worst Nodes user-#### Online Users (not strictly "authoring")

It would be nice (IMO) if these could be unified into a single class name, but not being devilish and therefore not having a clue how much effort (or side-effects) that would cause, I'll settle for a quick example. This won't let you flag everything (for instance, results in Super Search are not tagged for per-author styling, nor are the section summary pages like The Monastery Gates), but it covers a large fraction of the content a user can post. Place the following CSS in your Display Settings (scroll down to the textbox labelled "On-Site CSS Markup") to turn all of NodeReaper's content (that you can) bold:

.node-from-52855 {font-weight:bold;} .nnt-auth-52855 {font-weight:bold;} .pmnote-52855 {font-weight:bold;} .chatfrom_52855 {font-weight:bold;} .auth-52855 {font-weight:bold;}

Update: ambrus notes that this can be contracted still further.

Update: duelafn golfs it down more (but also gets signatures in the process).

The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Replies are listed 'Best First'.
Re: Author-based Stylin'
by ambrus (Abbot) on Mar 19, 2006 at 00:10 UTC

    Just let me note that your example CSS can also be written with commas, like this:

    .node-from-52855, .nnt-auth-52855, .pmnote-52855, .chatfrom_52855, .au +th-52855 {font-weight:bold;}
Re: Author-based Stylin'
by duelafn (Vicar) on Mar 19, 2006 at 16:13 UTC
Re: Author-based Stylin'
by eric256 (Parson) on Mar 18, 2006 at 21:56 UTC

    Instead of replacing those, since sometimes you might want that kind of control, we could just wrap all those things in one extra layer of div or span tags.

    Eric Hodges
      we could just wrap all those things in one extra layer of div or span tags
      IMO, the markup here at the monestary is already pretty heavy. I'm also not a CSS expert, but is there any way to write a rule such that it applies to elements with a set of specified classes? For instance, if I had
      <div class="node-from 57755">Look ma, a div from thor!<div>
      that there'd be a way to specify "apply these rules only to elements that have both class node-from and class 57755"? If so, that's what I'd suggest. That way, if you want to ignore me, you can just put:
      .57755 { display: none; }
      in your CSS and be done with it.


      The only easy day was yesterday

        I beleive that the reason that wasn't heavily used the last time we revamped the CSS was that not all browsers supported it (and i believe the offender was IE but i could be very very wrong. ;) )

        Eric Hodges

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://537694]
Approved by Old_Gray_Bear
Front-paged by Arunbear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2017-09-19 14:39 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (222 votes). Check out past polls.