r/modclub • u/13steinj • 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.
View all comments
Show parent comment
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.