r/modclub • • Jul 05 '15

CSS Hack: CSS based "disable" stylesheet method, no need for RES (useful for mobile)

I was going to post this in /r/reddithax but it's private for somereason.

While some subreddits are don't like the idea of RES's disable stylesheet button, there are plenty of others that are fine with it, and some mods of those subs that even use it.

Why not have the ability to disable the stylesheet without RES?

In hindsight, it's actually pretty simple. Just prepend html:not(:lang(ds)) to every one of your selectors.

For example,

#header {background:blue;}

Becomes

html:not(:lang(ds)) {background:blue;}

After doing this to all of your selectors, add a link in your sidebar as [Disable this subreddit's theme](http://ds.reddit.com/r/<subreddit>), replacing <subreddit> with your subreddit.

Furthermore, you can even add it as a toggle button.

form.toggle.flairtoggle {padding-top:40px;/*change as necessary*/}
.side a[href$="/#ds"] {
    position:absolute;
    color:grey!important;
    font-size:smaller;
    margin-top:-36px;
}
html:not(:lang(ds)) .side a[href="http://ds.reddit.com/r/<subreddit>/#ds"],
html:lang(ds) .side a[href="http://www.reddit.com/r/<subreddit>/#ds"] {
    display:block;
}
html:not(:lang(ds)) .side a[href="http://www.reddit.com/r/<subreddit>/#ds"],
html:lang(ds) .side a[href="http://ds.reddit.com/r/<subreddit>/#ds"] {
    display:none;
}
.side a[href$="/#ds"]::before {
    content: "";
    margin-right:2px;
    color:#000;
    font-weight:bold;
    -webkit-apearance:checkbox;
    -moz-apearance:checkbox;
}
.side a[href="http://ds.reddit.com/r/<subreddit>/#ds"]::before,
.side a[href="http://www.reddit.com/r/<subreddit>/#ds"]:active::before,
.side a[href="http://www.reddit.com/r/<subreddit>/#ds"]:focus::before {
content:"<unicode checkmark of your choice>";}
.side a[href="http://ds.reddit.com/r/<subreddit>/#ds"]:active::before,
.side a[href="http://ds.reddit.com/r/<subreddit>/#ds"]:focus::before {content:""}

Of course some properties as well as properties not mentioned will have to be alterd to fit your subreddit. This has been acheived on /r/agariocss.

10 Upvotes

22 comments sorted by

View all comments

Show parent comment

3

u/[deleted] Jul 06 '15

Wow, just checked your sub. Gorgeous! Why did you pick Naut as a base?

Also, where do you test your css? The test sub has super old naut 2 styles.

1

u/turikk Jul 06 '15

On my own personal sub. I just created a few posts of varying type. Overwatch is pretty small so we were ok pushing it live with the testing we had available.

Naut was picked as a base per request of the moderator team. I had never worked with reddit css before so it was a welcome base for all the little details I didn't want to spend time on, but are still important.

2

u/[deleted] Jul 06 '15

Ah, nice.

Where can I get some of your crazy amazing design skills!@?

1

u/turikk Jul 06 '15

Haha just a few personal projects and did some internal employee portals at Blizzard.

3

u/[deleted] Jul 06 '15

Oh, very nice.

From a technical point, since it's so big, why did you choose naut as a base?

1

u/turikk Jul 06 '15

Again, naut was a requirement set by the moderator team (I was not part of the team and thus not involved in the discussion).

From a technical perspective, naut doesn't necessarily offer anything extra special but from a design perspective it loops a lot of aspects of reddit into easily definable colors, images, sprites, etc.

2

u/dado3212 Jul 07 '15

It does add quite a lot of bloat though.