blueshiftlabs

Post icons

Feb 7th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 5.63 KB | None | 0 0
  1. /*
  2.  * Thread icons by Yusuki Kamiyamane (p.yusukekaminamane.com).
  3.  * All rights reserved. Licensed under Creative Commons Attribution 3.0.
  4.  */
  5.  
  6. /*
  7.  * All  submitted links have the class "title".
  8.  * In order to make the green "other" links work, we'll change *all* links to green.
  9.  * Others (trade and PSA links) will be overridden later.
  10.  */
  11.  
  12. a.title:link {
  13.     color: ForestGreen !important;
  14. }
  15.  
  16. a.title:visited {
  17.     color: #004000 !important;
  18. }
  19.  
  20. a.title::before {
  21.     position: relative;
  22.     top: 2px;
  23.     margin-right: 2px;
  24.     display: inline-block;
  25.     height: 16px;
  26.     width: 16px;
  27.     content: "";
  28.     /*
  29.      * thread-icons is a spritesheet containing the four thread icons I use.
  30.      */
  31.     background-image: url(%%thread-icons%%);
  32.     background-repeat: no-repeat;
  33. }
  34.  
  35. /*
  36.  * Use CSS attribute selectors to change the appearance of certain links.
  37.  *
  38.  * In this case, we want to change trade links, which all follow the title format:
  39.  * [H] Stuff [W] Other stuff
  40.  *
  41.  * The resulting URL looks something like this:
  42.  * http://reddit.com/r/SteamGameSwap/comments/.../h_stuff_w_other_stuff/
  43.  * We'll focus on the "/h_" part, which trade threads should all contain, and
  44.  * non-trade threads should *not* contain.
  45.  *
  46.  * We'll use the *= operator to specify that the href attribute can contain "/h_"
  47.  * as any part of the string, rather than forcing it to be the whole string (=),
  48.  * the beginning of the string (^=), or the end of the string ($=).
  49.  */
  50.  
  51. a[href*="/h_"].title:link {
  52.     /* The default link colors are #0000ff link, #551a8b visited. */
  53.     color: blue !important;
  54. }
  55.  
  56. a[href*="/h_"].title:visited {
  57.     color: #551a8b !important;
  58. }
  59.  
  60. a[href*="/h_"].title::before {
  61.     /* Shift the spritesheet to show the blue-arrow icon. */
  62.     background-position: -16px 0px;
  63. }
  64.  
  65. /*
  66.  * Now we'll do closed trade threads.
  67.  * Thread closing is handled by marking something NSFW. (Trades really can't be
  68.  * NSFW, so we're not using that for its intended purpose anyway.)
  69.  *
  70.  * NSFW links are contained in a div with class "over18". We'll focus on trade
  71.  * links inside of an over18-classed element.
  72.  */
  73.  
  74. .over18 a[href*="/h_"].title:link {
  75.     color: FireBrick !important;
  76. }
  77.  
  78. .over18 a[href*="/h_"].title:visited {
  79.     color: #600000 !important;
  80. }
  81.  
  82. .over18 a[href*="/h_"].title::before {
  83.     background-position: 0px -16px;
  84. }
  85.  
  86. /*
  87.  * Now, we need to make it so that closed threads appear as "closed" and not NSFW.
  88.  * There are a few things we need to do for this.
  89.  *
  90.  * First, hide the "NSFW" text.
  91.  */
  92.  
  93. .over18 li.nsfw-stamp {
  94.     display: none;
  95. }
  96.  
  97. /*
  98.  * Second, insert different text where the NSFW text was.
  99.  */
  100. .over18 ul.flat-list.buttons::before {
  101.     content: "Thread Closed";
  102.     border: 1px solid #d27979 !important;
  103.     color: #AC3939;
  104.     font-size: x-small;
  105.     text-decoration: none;
  106.     padding: 0px 2px;
  107.     -moz-border-radius: 3px;
  108.     -webkit-border-radius: 3px;
  109.     border-radius: 3px;
  110. }
  111.  
  112. /*
  113.  * Now, change the "nsfw" / "un-nsfw" options to read
  114.  * "close thread" and "reopen thread".
  115.  *
  116.  * Step 1: Hide the "nsfw" / "un-nsfw".
  117.  * We can't use display: none here, because that would hide the link entirely.
  118.  * We need to replace the contents of the link, not the link itself.
  119.  * There's no way to display: none the text inside a link, so we cheat and
  120.  * set the font size to 0.
  121.  *
  122.  * The color: white is needed to work around a browser glitch on Webkit (Chrome / Safari)
  123.  * where text-size: 0 is displayed, but with all of the characters smashed on top
  124.  * of one another in a very ugly fashion.
  125.  */
  126. .link .marknsfw-button .option.active a[href="#"],
  127. .link .unmarknsfw-button .option.active a[href="#"] {
  128.     font-size: 0;
  129.     color: white;
  130. }
  131.  
  132. /*
  133.  * Step 2: Add new text of our own devising.
  134.  */
  135. .link .marknsfw-button .option.active a[href="#"]::before {
  136.     content: "close thread";
  137.     font-size: x-small !important;
  138.     color: FireBrick !important;
  139. }
  140.  
  141. .link .unmarknsfw-button .option.active a[href="#"]::before {
  142.     content: "reopen thread";
  143.     font-size: x-small !important;
  144.     color: ForestGreen !important;
  145. }
  146.  
  147. /*
  148.  * More highlighting, but this time for threads that have [PSA] or [ANNOUNCEMENT].
  149.  */
  150.  
  151. a[href*="/psa_"].title:link, a[href*="/announcement_"].title:link {
  152.     color: DarkGoldenRod !important;
  153. }
  154.  
  155. a[href*="/psa_"].title:visited, a[href*="/announcement_"].title:visited {
  156.     color: Sienna !important;
  157. }
  158.  
  159. a[href*="/psa_"].title::before, a[href*="/announcement_"].title::before {
  160.     background-position: -16px -16px;
  161. }
  162.  
  163. /*
  164.  * Finally, fiddle with colors to get it to all play nicely with Reddit
  165.  * Enhancement Suite's night mode.
  166.  */
  167.  
  168. .res-nightmode .link a.title:link {
  169.     color: SpringGreen !important;
  170. }
  171.  
  172. .res-nightmode .link a.title:visited {
  173.     color: LimeGreen !important;
  174. }
  175.  
  176. .res-nightmode .link a[href*="/h_"].title:link {
  177.     color: SkyBlue !important;
  178. }
  179.  
  180. .res-nightmode .link a[href*="/h_"].title:visited {
  181.     color: CornflowerBlue !important;
  182. }
  183.  
  184. .res-nightmode .link.over18 a[href*="/h_"].title:link {
  185.     color: LightPink !important;
  186. }
  187.  
  188. .res-nightmode .link.over18 a[href*="/h_"].title:visited {
  189.     color: IndianRed !important;
  190. }
  191.  
  192. .res-nightmode .link a[href*="/psa_"].title:link,
  193. .res-nightmode .link a[href*="/announcement_"].title:link {
  194.     color: Gold !important;
  195. }
  196.  
  197. .res-nightmode .link a[href*="/psa_"].title:visited,
  198. .res-nightmode .link a[href*="/announcement_"].title:visited {
  199.     color: GoldenRod !important;
  200. }
  201.  
  202. .res-nightmode .link .marknsfw-button .option.active a[href="#"]::before {
  203.     color: LightPink !important;
  204. }
  205.  
  206. .res-nightmode .link .unmarknsfw-button .option.active a[href="#"]::before {
  207.     color: SpringGreen !important;
  208. }
Add Comment
Please, Sign In to add comment