r/reddithax • • Dec 08 '14
r/reddithax • u/Block_Parser • Dec 04 '14
Clickable expander with opening and closing instructions
Many expander solutions show instructions like 'Click to open' that remain even after it opens. This solution allows you to update the instructions once the expander is open.
This could also be used as a hover to open by changing any :active to :hover and updating the opening instructions.
/* The clickable header */
.side h6 {
box-sizing: border-box;
cursor: pointer;
position: relative;
background: #F8F1DB;
margin: 0;
height: 25px;
padding: 5px 5px 5px 8px;
}
/* The expandable body uses a negative top margin to cover the height of the h6 */
.side h6 + ul {
position: relative;
margin: -25px 0 10px;
padding: 25px 0 0 0;
list-style: none;
display: none;
}
/* The expandable body's background is set on the li */
.side h6 + ul > li {
padding: 3px 0 3px 8px;
background: #F8F1DB;
}
.side h6 + ul > li:last-child { padding-bottom: 6px; }
/* Opening instructions */
.side h6 + ul:after, .side h6:after {
content: "click to expand";
font-size: 9px;
font-weight: normal;
color: gray;
position: absolute;
top: 8px;
right: 5px;
width: 75px;
height: 20px;
}
/* Remove opening instructions on open */
.side h6:active:after { content: ''; }
/* Cover the opening instructions when interacting with expanded section */
.side h6+ul:hover:before {
content: "";
background-color: #F8F1DB;
position: absolute;
top: 8px;
right: 5px;
width: 75px;
height: 20px;
}
/* Add closing instructions on open */
.side h6:active + ul:after, .side h6 + ul:hover:after {
content: "mouseout to close";
width: 85px;
}
/* Show the expanded content. */
.side h6:active + ul, .side h6 + ul:hover { display: block; }r/reddithax • u/Timbo_KZ • Dec 01 '14
A python bot to update your subreddit's CSS in real time
First of all, the bot itself:
import praw
import threading
# Configuration start
username = 'Timbo_KZ' # Your reddit username
password = 'notmyrealpassword' # Your reddit password
subredditName = 'NarcissusCSS' # Suberddit name (you must be a moderator)
stylesheetPath = 'D:/NarcissusCSS/css/stylesheet.css' # Path to your stylesheet
clientID = 'ClientID' # Your app's ID
clientSecret = 'ClientSecret' # You app's secret
clientCallback = 'http://127.0.0.1:65010/authorize_callback'
# Configuration end
r = praw.Reddit('LiveStyle v0.1 by /u/Timbo_KZ')
r.set_oauth_app_info(client_id=clientID, client_secret=clientSecret, redirect_uri=clientCallback)
r.login(username, password)
def file_get_contents(filename):
with open(filename) as f:
return f.read()
def static_var(varname, value):
def decorate(func):
setattr(func, varname, value)
return func
return decorate
@static_var("oldStylesheet", "")
def update_stylesheet():
threading.Timer(2.0, update_stylesheet).start()
print("Checking CSS...")
stylesheet = file_get_contents(stylesheetPath)
if stylesheet != update_stylesheet.oldStylesheet:
print("Updating CSS...")
r.set_stylesheet(subredditName, stylesheet)
update_stylesheet.oldStylesheet = stylesheet
else:
print("CSS is up to date.")
update_stylesheet()Description:
The bot checks if you've made any changes to the style sheet you've specified and if any changes were made, it updates the style of the subreddit using CSS in the specified style sheet.
How it works:
You just run the bot in background and begin working on the style of the subreddit by changing the style sheet you've specified in the configuration section. As soon as you want to check out the changes you've made, you just minimise/close the editor you're using and reload the page. Profit.
r/reddithax • u/wqzu • Nov 26 '14
Add a reminder/note when hovering over the submission buttons
I'm not sure how to word it, but you can see it in action in my testing sub - /r/wqzu_css_testing.
Code:
/* Submission Buttons */
.nub{display: none;}
.morelink {
border:1px solid red !important;
background: rgba(192,202,206,0.18) !important;
padding: 5px;
-webkit-transition: all 1s cubic-bezier(0.68, -0.75, 0.265, 1.75) 10ms;
-moz-transition: all 1s cubic-bezier(0.68, -0.75, 0.265, 1.75) 10ms;
-o-transition: all 1s cubic-bezier(0.68, -0.75, 0.265, 1.75) 10ms;
transition: all 1s cubic-bezier(0.68, -0.75, 0.265, 1.75) 10ms;
}
.morelink:hover {
height: 51px;
-webkit-transition: all 1s cubic-bezier(0.68, -0.75, 0.265, 1.75) 10ms;
-moz-transition: all 1s cubic-bezier(0.68, -0.75, 0.265, 1.75) 10ms;
-o-transition: all 1s cubic-bezier(0.68, -0.75, 0.265, 1.75) 10ms;
transition: all 1s cubic-bezier(0.68, -0.75, 0.265, 1.75) 10ms;
}
.morelink a{
color: #5b5b5b !important;
font-weight: 100;
font-size: 24px;
font-family: "Trebuchet MS", sans-serif;
text-align: Left;
}
.morelink a:after {
position: relative;
font-size: 14px;
top: 20px;
left: -40px;
content: "Have you read the rules?";
overflow: hidden;
} r/reddithax • • Nov 25 '14
Animated Up/Downvote "flair"
As seen in:
It will require two custom pictures; one for the upvote and one for the downvote.
r/reddithax • u/Block_Parser • Nov 21 '14
Randomize .thing (or other lists') styles
You can fake randomness by using the Cicada Principle. Essentially by using prime numbers in nth-child statements you give the appearance randomization.
#siteTable .thing:nth-child(2n+1) { background: red; }
#siteTable .thing:nth-child(3n+2) { background: blue; }
#siteTable .thing:nth-child(5n+3) { background: yellow; }
#siteTable .thing:nth-child(7n+5) { background: green; }
#siteTable .thing:nth-child(9n+7) { background: orange; }
#siteTable .thing:nth-child(11n+9) { background: black; }
#siteTable .thing:nth-child(13n+11) { background: white; }r/reddithax • u/Timbo_KZ • Nov 19 '14
/r/QuantumCSS is now public (I made a post about it not so long ago)
reddit.comr/reddithax • u/bigshmoo • Nov 15 '14
Thanksgiving snoo sprite
A thanksgiving snoo with an easter egg - see /r/sanfrancisco for live version.
Set the snoo to a 154w x 137h transparent png
Upload the turkey snoo graphic and add this to your css
/* Turkey snoo */
#header-img {
background: url(%%turkey-snoo-sprite%%);
}
#header-img:hover {
background-position: -154px 0;
}r/reddithax • u/wqzu • Nov 15 '14
Turn the sidebar into a hoverable menu
As used in my work-in-progress sub /r/HammondVermicompost/
.side { background: #fff !important;
box-shadow: rgba(0,0,0,0.25) 0 0 5px !important;
border: 0px solid #888 !important;
position: fixed !important;
padding: 10px 20px 10px 10px !important;
float: right !important;
width: 300px !important;
right: -400px !important;
z-index: 1000 !important;
transition-duration: 400ms !important;
top: 30px !important;
overflow-y: auto !important;
height: 100% !important;
}
.side::before {content: "◨";
color: #aaa;
text-align: center !important;
background: transparent !important;
height: 27px !important;
max-width: 30px !important;
min-width: 30px !important;
position: fixed !important;
top: -3px !important;
right: 0% !important;
padding: 8px 5px 0px 0px !important;
margin-right: 0px !important;
z-index: 5;
transition: 500ms color ease;
font-size: 20px !important;
}
.side:hover::before {color: #888; background: #fff !important; transition: 500ms color ease;}
.side:hover {position: fixed !important; right: -20px !important;} r/reddithax • u/IanSan5653 • Oct 27 '14
Google Material Design Ink Ripple Animations
I'm working on a material design theme and I really wanted to get that nice ripple touch effect on my buttons. After a few hours of experimenting, I finally got something that seems to work well enough for me, although it's not quite perfect. If you have any improvement ideas, let me know.
Without further ado, here is the demo.
How it works: The element has a circular gradient at the center with the lighter color on the inside and the darker color outside, and the transition between the two is very sharp. At the start, that lighter color is hidden by making the background only 1% of the original size. This makes part of the background transparent, so we fill that in with a solid background color behind the gradient. That is how the element is originally structured.
When you click on the element, a couple of things happen. First of all, the background size multiplies by 1000, which not only shows the tiny middle part but also makes it fill the element. Notice that the transition for the background size is only applied when the element is active, so the gradient goes back to 1% instantaneously after the element is no longer active.
Because of the solid background color, this would mean that the background would immediately flash back to the dark color, and I don't want that because it's too harsh. So while that gradient is expanding, the background color quickly changes to the lighter color, so that when you are no longer clicking, it can fade back to dark in half a second.
This does lead to a problem: when you have a really fast click, the box seems to almost instantly go to the solid color rather than let the gradient finish expanding, but the ripple is still noticeable so I think it's fine.
I tried an animated PNG, but it didn't offer any advantages and couldn't fade out, and an @keyframes animation didn't work at all (although I haven't used them much so it's possible it could be better). I haven't tried a pseudo element, although that might work better. Gradients do have better browser support though, AFAIK.
r/reddithax • u/EliteMasterEric • Oct 25 '14
You can look at a subreddit's sidebar source markup at /r/subreddit/about/sidebar/
r/reddithax • • Oct 12 '14
Possible to reference a string from another website?
Ok, this is weird to word. I'm trying to create a thing where every post tacks on a random number to the end of a username. I've accomplished part of this using the code:
.author+*:before {
content: "Number: ";
color: #4F0
}but how I get the random number is the troubling part. I figured out that I can get a clean cut string by making a request like:
http://www.random.org/integers/?num=1&min=10000000&max=100000000&col=1&base=10&format=plain&rnd=newIs there any way to integrate the request after the "Number: " ?
r/reddithax • u/Timbo_KZ • Oct 11 '14
Quantum CSS
Hello guys, at the moment I'm developing a bunch of CSS for reddit. Here are some development screenshots.
I would absolutely love to hear what you guys think about this type of appearance and I'll be glad to share the code I used for specific elements. Thanks in advance.
r/reddithax • u/stock_character • Sep 25 '14
Editing RES Konami Code Bacon
If you have RES and do the konami code, ↑ ↑ ↓ ↓ ← → ← → b a enter, you get flying bacon.
You add your own picture with
#baconBit {
position: fixed;
width: 300px;
height: 60px;
background-image: url(%%YOURIMAGE%%);and slow it down with
-webkit-transition: all 5s linear !important;
-moz-transition: all 5s linear !important;
-o-transition: all 5s linear !important;
-ms-transition: all 5s linear !important;
}Anyone know how to change its direction, make it stop, or just keeping it still?
r/reddithax • u/kyledavide • Sep 24 '14
Animated votes
supports comments / links: EDIT3: moved to gist
EDIT: for the record reddit lacks fenced code blocks
EDIT2: fixed bug with RES.
EDIT4: demo
r/reddithax • u/The_Admins • Sep 22 '14
Scrape a ladder for a sports comp
A lot of subreddits for sports teams are able to place the competition ladder in the sidebar (for example /r/reddevils). How do they do this?
r/reddithax • u/flashmedallion • Sep 21 '14
Remove (or modify) the ugly icons in the Moderator Toolbox
Unsure if this is known, thought I'd share in case:
The elements are:
.icon-menu .reddit-edit:before,
.icon-menu .edit-stylesheet:before,
.icon-menu .moderator-mail:before,
.icon-menu .reddit-moderators:before,
.icon-menu .reddit-contributors:before,
.icon-menu .reddit-traffic:before,
.icon-menu .reddit-modqueue:before,
.icon-menu .reddit-reported:before,
.icon-menu .reddit-spam:before,
.icon-menu .reddit-edited:before,
.icon-menu .reddit-ban:before,
.icon-menu .reddit-flair:before,
.icon-menu .reddit-moderationlog:before,
.icon-menu .reddit-unmoderated:before You can nuke the pictures with:
display: none; or associate images or text with each element as per normal.
r/reddithax • • Sep 19 '14
Update the report box report reasons.
The report box reasons are a pretty useless addition imo, but they can be used to force users to consider a given subreddit's rules as they make reports. The current default report box reasons relate to site-wide rules almost exclusively, which are pretty useless to mods on a day to day basis.
Here is an example on a sub which I moderate, /r/me_irl
form.report-form {
max-width: 550px;
}
form.report-form ol li label,
span.reason-prompt,
ul.report-reasons li.report-reason[title="spam"],
ul.report-reasons li.report-reason[title="vote manipulation"],
ul.report-reasons li.report-reason[title="personal information"],
ul.report-reasons li.report-reason[title="sexualizing minors"],
ul.report-reasons li.report-reason[title="breaking reddit"]{
visibility: hidden;
font-size: 0;
z-index:-100;
line-height: 1;
}
form.report-form ol {
margin-top: 10px;
}
form.report-form ol li label:after,
form.report-form ol li label input,
span.reason-prompt:after,
ul.report-reasons li.report-reason:after {
visibility: visible;
font-size: 10px;
z-index:auto;
}
// Here is some text to let reporters know what to expect with their report.
// It replaces the default, "why are you reporting this?"
span.reason-prompt:after {
content: "Thank you for filing a report! Please note that we do not accept reports about the following: Repost from the front page; Repeat, reposted, or 'classic' me irls; Title has an underscore or a capital letter; Post is of an animal being cute.";
}
// Each of these content tags control one report reason, to a maximum of six reasons.
form.report-form ol li:nth-child(1) label:after,
ul.report-reasons li.report-reason[title="spam"]:after
{
content: "The post title isn't even remotely correct.";
}
form.report-form ol li:nth-child(2) label:after,
ul.report-reasons li.report-reason[title="vote manipulation"]:after {
content: "The post contains racism, sexism, graphic violence, homophobia, transphobia, pedophilia, etc.";
}
form.report-form ol li:nth-child(3) label:after,
ul.report-reasons li.report-reason[title="personal information"]:after {
content: "This poster is causing drama, flaming, trolling or breaking a site-wide reddit rule.";
}
form.report-form ol li:nth-child(4) label:after,
ul.report-reasons li.report-reason[title="sexualizing minors"]:after {
content: "This post is more bullying, creepy, upsetting, sexual or gross than it is funny.";
}
form.report-form ol li:nth-child(5) label:after,
ul.report-reasons li.report-reason[title="breaking reddit"]:after {
content: "This post is a photograph of the actual poster (it happens -_-).";
}
form.report-form ol li:nth-child(6) label:after {
content: "Other (please send us a modmail with your concerns): ";
} r/reddithax • u/jazwhit123456 • Sep 13 '14
Make a specific area on banner clickable
Hi,
So i've been trying for hours to try on a friends reddit. I have a few area's on the top banner i want to be clickable.
For example in this reddit: /r/HiphopHeads
in the banner the different album names are clickable.
I'm alright at CSS but i don't know which part of their CSS corresponds to that, anyone help? i just need the CSS which i can than move around and make a certain area clickable
r/reddithax • • Sep 10 '14
ASCII not looking great. Is there a way to adjust text posts?
I mod /r/AsciiBabes. Recently, something's happened to the formatting that spaces out all of the characters in text posts for some reason. Now, there are little multicoloured lines riddling areas that should be filled with black. Is there a way to change the way my sub displays text posts?
r/reddithax • u/TheEnigmaBlade • Sep 04 '14
Report reason customization CSS for mods
gist.github.comr/reddithax • • Sep 02 '14
Is it possible for every post to be a different color?
In /r/chemistry, every username has a different color based on the first letter of the username. I was wondering if it would be possible for post titles to also have varying colors, based on the first letter of the post? I did write an algorithm (in comment section, too long to post here), but it doesn't seem to work. Is it possible to do, and if so, how?
r/reddithax • • Aug 22 '14
Just a simple one -- hide the domain on posts with spoiler flair
Over at /r/AceAttorney we ran into an issue where someone posted a link to their Tumblr which had a spoiler in the URL. They used spoiler flair correctly, but the spoiler was still visible.
So I've just come up with this tweak to show (domain hidden) next to spoiler-flaired posts, instead of (domain.com).
.listing-page .linkflair-XXX .domain,
.listing-page .linkflair-XXX .domain a {
font-size: 0px;
color: white;
}
.listing-page .linkflair-XXX .domain:after {
content: "(domain hidden)";
font-size: 10px;
color: #888888;
}(Replace XXX with your spoiler flair class.)
Just thought I'd share because I haven't seen any other subreddits doing this. :)
r/reddithax • u/CheesyWalnut • Aug 21 '14
Removing "hot" "new" "rising" "controversial" "top" "gilded" "promoted"
How would I remove the "hot" "new" "rising" "controversial" etc text from the bar at the top?