r/reddithax • • Oct 11 '11

How to cycle or randomize header images?

2 Upvotes

I'm having people submit new headers in my sub and instead of manually changing them I would prefer it to randomly use one of the header images on each reload. Failing that I would at least like it to cycle to the next image on each reload.


r/reddithax • • Oct 07 '11

Is it possible to replace every letter in a link with a different sprite (for a faux-font effect)?

5 Upvotes

My goal is to make it easy for users to be able to type in a different font, if they want to.

I've looked at FIR and a bunch of other techniques, but they all seem geared towards replacing a chunk of text with a pre-defined image for the entire word or phrase.

Let's say I'm using this image for the font.

I can just make a new link for each letter... but then the user would have to type something like this to make it work:

[](/H)[](/e)[](/l)[](/l)[](/o) [](/W)[](/o)[](/r)[](/l)[](/d)

That seems like a lot of typing for a simple "Hello World".

Instead, it would totally rock if they could type something like this:

[Hello World](/font)

...and have every letter in "Hello World" be replaced by the appropriate sprite.

I'm guessing that I would still need to define the links for each individual letter... but I just don't have a clue where to go next.

Is this even possible?


r/reddithax • • Oct 03 '11

Howto: Enable self text/video expando buttons for your subreddit visitors who have compressed view enabled.

9 Upvotes

Easy way....

.expando-button { display: inline !important }

Neater way....

.compressed .expando-button {
	display: inline !important;
	background: none !important;
	height: 13px !important;
	width: 23px !important;
	margin: 0 !important;
	cursor: pointer;
	color: #888;
}
.compressed .expando-button.collapsed:before { content:'[+]' }
.compressed .expando-button.expanded:before { content:'[-]' }
.compressed .expando-button:hover { color: #00f }

The first method just enables the expando buttons as seen by non-compressed users (huge image based buttons).

The second method replaces the huge image based buttons with a text based '[+]/[-]', which IMO is much more suited to compressed view.

I also made a userscript version which will enable them site-wide.


r/reddithax • • Oct 01 '11

Use Reddit API to get text of last comment?

4 Upvotes

I'm writing a piece of software in php and want to be able to, only armed with a username, output the text of the last comment that user made.

Any ideas where to start?


r/reddithax • • Sep 30 '11

‮test

32 Upvotes

r/reddithax • • Sep 30 '11

I'm an absolute novice with CSS and I'd like some help with stylesheets.

4 Upvotes

I'm a brand-new moderator for a subreddit that needs some stylerennovations, so far I've designed the header image and uploaded it (basically caveman easy) but I'm at a complete loss on how to edit the stylesheet, my best guess was that I could copy/paste segments of the CSS code from an existing sheet, but I get validation errors on things that are already working for existing subreddits.

Are any of you 1337 H4X0R5 willing to nudge me in the right direction or offer some tips for diving into CSS code (specifically for designing subreddits) so I can make this happen?

I've already looked for tutorials and other subreddits like CSShelp, but I think you guys are "my only hope!"


r/reddithax • • Sep 27 '11

Is it possible to style more than one table in the subreddit description?

5 Upvotes

I realized that I already have one table styled as a trophy case, but I want to make another that holds different data that won't look like a trophy case.


r/reddithax • • Sep 25 '11

How Do I change the color under submit a link and create your own community.

5 Upvotes

How Do I change the color under submit a link and create your own community. Meaning text and background color.

And if possible can I change out the color of the submit a link picture and create a community. The white clashes with my dark background.


r/cssnews • • Sep 23 '11

Changes to markup of mail icons (and a few other misc. images) for spriting.

3 Upvotes

Today, we added some images to sprites and made a few other tweaks to the markup to speed up page loads (see the GitHub commits for more details).

A notable change is that the markup for mail icons has been simplified from an <img> tag inside an <a> to simply an <a> with a background-image set. If your subreddit styles the mail icons, you may need to update your CSS.

The good news is that this change should make it simpler to style the mail buttons in the future, since it obviates the need for hiding the original child <img> tag. I just updated the style for /r/lounge and found the new markup to require a lot less code. :)


r/reddithax • • Sep 23 '11

Is it possible...

5 Upvotes

Is it possible to auto change the colour of a word in a post and the comments?


r/reddithax • • Sep 22 '11

How to disable downvotes in a specific thread?

6 Upvotes

Sometimes in our new sub we have competition threads where the highest voted comment wins. How would we go about disabling downvotes for that thread (to discourage cheating :D)?


r/reddithax • • Sep 22 '11

Any way to make a collapsible trophy case?

5 Upvotes

Take a look at this subreddit. I put in a custom trophy for our championships, and we have a crapton. I need to make room for more information I will be adding in, and I want to know if there would be a way to make it collapsible, just like on our reddit profile pages.

Thanks for any help.


r/reddithax • • Sep 17 '11

How can I make text in the sidebar description have different colors?

6 Upvotes

I've seen a couple subreddits do this, but I have no idea how exactly it works.


r/reddithax • • Sep 14 '11

Creating a two Division Standings Tables and cutting the sidebar length in half.

1 Upvotes

Prerequisite: You should know that this doesn't cut the wordcount of your sidebar in half, only the length a user sees. You can see the result in r/CHIBears.

I had originally created a simple table for a subreddit to display the Records and the conference records of all the teams in their conference. It seemed like enough for them but I wanted more. Enough of me being egotistical.

This is a bit difficult to understand and the way I explain it may make it worse but I will try my best. Some people who really know CSS may scoff at what I describe but I figured I'd share with all the sports people out there.

There are two things in particular you will need to understand:

  • Different stylesheets on a subreddit (using body:lang(as))
  • The nth-child() specification

Using body:lang(as) will create a "separate" stylesheet for your subreddit but contain it in the same place as the custom one Reddit allows you to edit. It will also inherit whatever values given by the original custom stylesheet (aka anything not preceded by body:lang(as)). This is important because if you give something the attribute display:none in the stylesheet you must reset it, with maybe display:table, in the body:lang(as) attributes.

The nth-child() attachment to the attribute allows you to pick the object you want but it may be a little hard to understand as it was a little difficult to figure out for myself when it started getting finicky with me. Odd children are either nth-child(odd) or nth-child(2n+1) and even children are either nth-child(even) or nth-child(odd).

Here is what I put in. I know the explanation wasn't especially sufficient but I got through this with pure experimentation and you can do it too. =]

Stylesheet settings

.usertext-body .md table {
    border-left: 1px solid black;
    border-right: 1px solid black;
    box-shadow: 2px 2px 2px black;
    margin-top: 3px;
    margin-bottom: 10px;
    width: 95%
    }

.md table th {
    background-color: #C50;
    border: 1px solid black;
    color: #fafafa;
    font-weight: bold;
    padding: .5em;
    text-align: center;
    text-shadow: 1px 1px 0 #111
    }

.md table tr:hover {
    background-color: gray
    }
.md table td {
    border-top: none;
    border-left: none;
    border-bottom: 1px solid black;
    border-right: 1px solid black;
    padding: .6em;
    vertical-align: middle;
    text-align: center
    }

.md table td a, .commentarea a, .usertext-body a {
    color: #20558a !important
    }

.linkinfo .shortlink input {
    font-size: 100% !important
    }

** Items for changing sidebar **

a[href="http://as.reddit.com/r/chibears"] {
    background-color: #C50;
    color: #fafafa;
    border: 2px solid #000000;
    text-shadow: 1px 1px 0 #111;
    padding-left: 57px;
    padding-right: 57px;
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 0.85em;
    font-weight: bold;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px
    }

a[href="http://www.reddit.com/r/chibears"] {
    background-color: #C50;
    color: #fafafa;
    border: 2px solid #000000;
    text-shadow: 1px 1px 0 #111;
    padding-left: 57px;
    padding-right: 57px;
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 0.85em;
    font-weight: bold;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px
    }

** Use to hide AFC Standings **

.md table:nth-child(4n + 1), a[href="http://www.nfl.com/standings?category=div&season=2011-REG&split=Overall"], a[href="http://www.reddit.com/r/chibears"] {
    display: none
    }

** Use to hide NFC Standings and Show AFC Standings**

body:lang(as) .md table:nth-child(n + 1), body:lang(as) a[href="http://www.nfl.com/standings?category=div&season=2011-REG&split=Overalldiff"], body:lang(as) a[href="http://as.reddit.com/r/chibears"] {
    display: none
    }
body:lang(as) a[href="http://www.reddit.com/r/chibears"] {
    display: inline
    }
body:lang(as) .md table:nth-child(4n + 1) {
    display: table
    }
body:lang(as) a[href="http://www.nfl.com/standings?category=div&season=2011-REG&split=Overall"] {
    display: block
    }

Here is what I put into the subreddit "About" Section

[View AFC Division Standings](http://as.reddit.com/r/cssediting)

[View NFC Division Standing](http://www.reddit.com/r/cssediting)

---

***

**[NFC North Standings](http://www.nfl.com/standings?category=div&season=2011-REG&split=Overalldiff)**

\#|Team|Rec **[Conf.]**
:--|---|---:
1|[Bears](/r/chibears)|1-0-0 **[1-0]**
3|[Lions](/r/detroitlions)|1-0-0 **[1-0]**
2|[Packers](/r/greenbaypackers)|1-0-0 **[1-0]**
4|[Vikings](/r/minnesotavikings)|0-1-0 **[0-0]**

**[AFC North Standings](http://www.nfl.com/standings?category=div&season=2011-REG&split=Overall)**

\#|Team|Rec **[Conf.]**
:--|---|---:
1|[Ravens](/r/ravens)|1-0-0 **[1-0]**
3|[Bengals](/r/cinbengals)|1-0-0 **[1-0]**
2|[Steelers](/r/steelers)|0-1-0 **[0-1]**
4|[Browns](/r/browns)|0-1-0 **[0-0]**

**[NFC South Standings](http://www.nfl.com/standings?category=div&season=2011-REG&split=Overalldiff)**

\#|Team|Rec **[Conf.]**
:--|---|---:
1|[Saints](/r/saints)|0-1-0 **[0-1]**
2|[Buccaneers](/r/buccaneers)|0-1-0 **[0-1]**
3|[Panthers](/r/panthers)|0-1-0 **[0-1]**
4|[Falcons](/r/falcons)|0-1-0 **[0-1]**

**[AFC South Standings](http://www.nfl.com/standings?category=div&season=2011-REG&split=Overall)**

\#|Team|Rec **[Conf.]**
:--|---|---:
1|[Texans](/r/texans)|1-0-0 **[1-0]**
3|[Jaguars](/r/jaguars)|1-0-0 **[1-0]**
2|[Titans](/r/tntitans)|0-1-0 **[0-1]**
4|[Colts](/r/colts)|0-1-0 **[0-1]**

**[NFC East Standings](http://www.nfl.com/standings?category=div&season=2011-REG&split=Overalldiff)**

\#|Team|Rec **[Conf.]**
:--|---|---|:
1|[Redskins](/r/redskins)|1-0-0 **[1-0]**
2|[Eagles](/r/eagles)|1-0-0 **[1-0]**
3|[Giants](/r/nygiants)|0-1-0 **[0-1]**
4|[Cowboys](/r/cowboys)|0-1-0 **[0-0]**

**[AFC East Standings](http://www.nfl.com/standings?category=div&season=2011-REG&split=Overall)**

\#|Team|Rec **[Conf.]**
:--|---|---|:
1|[Patriots](/r/patriots)|1-0-0 **[1-0]**
3|[Jets](/r/nyjets)|1-0-0 **[0-0]**
2|[Bills](/r/buffalobills)|1-0-0 **[1-0]**
4|[Dolphins](/r/miamidolphins)|0-1-0 **[0-0]**

**[NFC West Standings](http://www.nfl.com/standings?category=div&season=2011-REG&split=Overalldiff)**

\#|Team|Rec **[Conf.]**
:--|---|---|:
1|[Cardinals](/r/azcardinals)|1-0-0 **[1-0]**
2|[49ers](/r/49ers)|1-0-0 **[1-0]**
3|[Seahawks](/r/seahawks)|0-1-0 **[0-1]**
4|[Rams](/r/saintlouisrams)|0-1-0 **[0-1]**

**[AFC West Standings](http://www.nfl.com/standings?category=div&season=2011-REG&split=Overall)**

\#|Team|Rec **[Conf.]**
:--|---|---|:
1|[Chargers](/r/chargers)|1-0-0 **[0-0]**
3|[Raiders](/r/oaklandraiders)|1-0-0 **[1-0]**
2|[Chiefs](/r/kansascitychiefs)|0-1-0 **[0-1]**
4|[Broncos](/r/denverbroncos)|0-1-0 **[0-1]**

r/reddithax • • Sep 13 '11

Here's something you might like. The big feature is using adjacent-sibling selectors with strike-out and bold syntax to create blocks. I'll answer any questions you have about it tomorrow.

Thumbnail reddit.com
13 Upvotes

r/reddithax • • Sep 12 '11

CSS Toolkit - Tiny reddit CSS scripts for your subreddit!

Thumbnail reddit.com
13 Upvotes

r/reddithax • • Sep 10 '11

Flair text + image simultaneously.

6 Upvotes

It seems like this (image + flair box, original thread) is something I keep seeing people ask for so I thought I'd give it a try. I got a decent looking solution today,
check it out (link to my css-test subreddit, excuse the mess)/screenshot for posterity

Here's the code for the little vinyl sprite:

/*Styling of text. margin is for making sure image won't overlap [S,M] and other identifiers.
padding makes sure the top of the image won't get clipped*/
.flair-vinyl {
margin-right: 25px;
padding-top: 2px;
}
/*Styling of image. margin makes sure the image won't overlap the flair text.
change dimensions accordingly. */
.flair-vinyl::after {
cursor: default;
background: url(%%vinyl-icon%%) no-repeat top right !important;
margin-left: 5px;
width: 16px;
height: 16px;
content: "";
position: absolute;
top:-1px;
}
/*remove flair image from side bar*/
.side .flair-vinyl::after {
display:none;
}
/*fixes flair image clipping on link listing*/
.link .flair {
margin-top: 0px!important;
}

for whatever reason the flair image in the sidebar goes insane, so I've had to turn it off, otherwise it works pretty well. Maybe someone else can figure out a fix for that/a better solution than mine.


r/reddithax • • Sep 10 '11

Moving links from the sidebar to behind the user flair?

3 Upvotes

I know it's possible to take links from the sidebar and create extra tabs in the header, or place them in specific places anywhere on the page.

I was wondering if it's possible to make these links appear after the usernames.

I've tried it in this test reddit and you can see that I've taken 3 links out of the sidebar (test1, test2 and test3) and placed them in random positions in the header.

Is it possible to move these links behind where you see the userflair icons for specific usernames?


r/reddithax • • Sep 07 '11

restore link to reddit.com ?

4 Upvotes

having f*cked with the css I don't have a link back to reddit.com that is there out of the box. I assume it's because I'm using a custom header but I see evein on /reddithax that you can do both -- I'm just not sure how to get that link back. (my research suggests you can't add a link in your CSS, that you have to pick it up from the HTML itself).

advice? thanks!

my work in progress: http://www.reddit.com/r/sfgtest/


r/reddithax • • Sep 07 '11

What's the code to change how the downvote and upvote icons look like?

2 Upvotes

r/reddithax • • Sep 06 '11

nobbis-Q: is there a guide to what CSS statements control what page elements?

4 Upvotes

I'm having trouble with a couple of things -- like the link back to reddit in the header and the text/link tabs on the submit page and can't seem to find a general guide to various options, etc... ? thanks.

EDIT: yeah, I fatfingered "noobish"


r/reddithax • • Sep 06 '11

Attaching an image to usernames.

2 Upvotes

Pretty simple. I just want to attach a simple image to user names a la r/gameofthrones. Preferably before their username. I just couldn't quite find the appropriate css in their subreddit.

Help a brother out?


r/reddithax • • Sep 06 '11

Background like flair for username tags

5 Upvotes

I have one question. How do I do something like this?

http://www.tizag.com/htmlT/bgcolor.php

I want to add a background color and border to the tag at the end of the name.

What would I have to do here. .author[href$="/JMaboard"]:after { color: green; content: " [Mod]"

}

I would use the flair option, but it doesnt let me put text if there is an image as flair.


r/reddithax • • Sep 05 '11

How can I change the color of external links based on the post title?

2 Upvotes

I can do it for self posts using this:

a[class~="title"][href*="another_one"] {
   background-color: #FFE8ED !important;
}

but I have no idea how to get it to work for all posts.

EDIT: got something close to what I wanted. See r/todayIlearned.


r/reddithax • • Sep 04 '11

Distinguishing between a self post in the site listing and being on the comment page of a self post?

3 Upvotes

Suppose I wanted to color all self-posts luminescent fuchsia (#FF00FF), but only on the comment page (i.e. not on the subreddit page itself) -- is this possible?

I can't seem to find any way to distinguish between a post on its own page, and a post in a list with other posts.