Skip to content

Instantly share code, notes, and snippets.

@SamWhited
Created August 18, 2012 22:04
Show Gist options
  • Save SamWhited/3390114 to your computer and use it in GitHub Desktop.
Save SamWhited/3390114 to your computer and use it in GitHub Desktop.
Scripts and styles for Project Anteater
$page-width: 996px;
$column-width: 425px;
$grid-bottom: 59px;
$header-height: 150px;
$screen-border: 1em;
$background-color: #000;
$text-color: #ddd;
$social-icon-size: 50px;
$header-fonts: "raleway", sans-serif;
$body-fonts: "adobe-garamond-pro", Calluna, Georgia, serif;
// Solarized (http://ethanschoonover.com/solarized)
$base03: #002b36;
$base02: #073642;
$base01: #586e75;
$base00: #657b83;
$base0: #839496;
$base1: #93a1a1;
$base2: #eee8d5;
$base3: #fdf6e3;
$yellow: #b58900;
$orange: #cb4b16;
$red: #dc322f;
$magenta: #d33682;
$violet: #6c71c4;
$blue: #268bd2;
$cyan: #2aa198;
$green: #859900;
@mixin rebase($rebase03,$rebase02,$rebase01,$rebase00,$rebase0,$rebase1,$rebase2,$rebase3) {
background-color: $rebase03;
color: $rebase0;
* { color: $rebase0; }
h1,h2,h3,h4,h5,h6 { color: $rebase1; border-color: $rebase0; }
a, a:active, a:visited { color: $rebase1; }
}
@mixin accentize($accent) {
a, a:active, a:visited, code.url { color: $accent; }
h1,h2,h3,h4,h5,h6 {color:$accent}
}
.light { @include rebase($base3,$base2,$base1,$base0,$base00,$base01,$base02,$base03); }
.dark { @include rebase($base03,$base02,$base01,$base00,$base0,$base1,$base2,$base3); }
// End solarized
$accent-color: $red;
$base03-green: desaturate(adjust-hue($base03, -79), 25);
@mixin hide-link {
a {
text-decoration: none;
&:hover { text-decoration: underline; }
}
}
@mixin background-link($width, $height, $url) {
background: {
image: unquote($url);
repeat: no-repeat;
size: 100%;
}
display: block;
height: $height;
overflow: hidden;
text-indent: 110%;
white-space: nowrap;
width: $width;
}
@mixin prefix($selector, $value) {
-webkit-#{$selector}: $value;
-moz-#{$selector}: $value;
-ms-#{$selector}: $value;
-o-#{$selector}: $value;
#{$selector}: $value;
}
@mixin tint($color) {
&:before {
content: "";
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: transparentize($color, 0.5);
}
}
@mixin foutfixer($selectors, $fonts) {
.wf-loading {
#{$selectors} {
font-family: $fonts;
visibility: hidden;
}
}
.wf-active {
#{$selectors} {
font-family: $fonts;
visibility: visible;
}
}
}
#breadcrumbs {
text-align: right;
}
.has-pullquote:before {
color: $accent-color;
// Reset metrics.
padding: 0;
border: none;
// Content
content: "« " attr(data-pullquote) " »";
// Pull out to the right, modular scale based margins.
float: right;
width: 320px;
margin: 12px -140px 24px 36px;
// Baseline correction
position: relative;
top: 5px;
// Typography (30px line-height equals 25% incremental leading)
font: {
family: $header-fonts;
size: 23px;
}
line-height: 30px;
}
.pullquote-left:before {
float: left;
margin: 12px 31px 24px -102px;
width: 251px;
}
.green-pullquote:before {
color: $green;
}
body {
background: $background-color url('<r:asset:url name="floor.png" />') repeat-y center;
color: $text-color;
font-family: $body-fonts;
line-height: 1.5em;
margin: 0;
}
@include foutfixer("h1, h2, h3, h4, h5, h6", $header-fonts);
a {
color: $accent-color;
img {
border: none;
}
}
#grid {
@include prefix(box-shadow, 0px 10px 50px 10px rgba(0, 0, 0, 1));
background: {
color: #000;
image: url('<r:asset:url name="grid_right.png" />'), url('<r:asset:url name="grid_left.png" />'), url('<r:asset:url name="grid_middle.png" />');
position: right top, left top, left top;
repeat: no-repeat, no-repeat, repeat-x;
}
height: $header-height;
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: -1;
}
#wrapper {
width: 100%;
max-width: $page-width;
margin: 0 auto;
}
@include foutfixer("header nav a", $header-fonts);
header {
margin: 0 auto;
height: $header-height;
position: relative;
nav {
@include hide-link;
float: right;
position: absolute;
bottom: $grid-bottom;
right: 0;
a {
border-left: 0.4em solid $accent-color;
color: $text-color;
font: {
size: 1.5em;
weight: bold;
}
margin-left: 1em;
padding-left: 5px;
}
}
}
#logo {
@include background-link(40%, 100px, url('<r:asset:url name="logotext.png" />'));
background-position: 0 15px;
position: relative;
margin-top: 0;
a {
position: absolute;
bottom: 0;
left: 0;
right: 0;
top: 0;
}
}
@mixin hero($color) {
background-color: $color;
padding: 0 0.7em;
border: 3px solid scale-color($color, $lightness: 10%) {
radius: 2em;
}
section {
float: left;
text-align: justify;
width: 30%;
h1 {
font-variant: small-caps;
margin-top: 0.5em;
}
}
section:nth-child(-n+2) {
margin-right: 1em;
}
}
.hero {
@include hero($base03);
}
.greenroom-hero {
@include hero($base03-green);
}
@mixin section($color) {
background-color: $color;
border-radius: 1.5em;
float: left;
margin: 6px;
padding: 0 6px 0 6px;
width: $page-width / 2 - 24px;
}
.clear {
clear: both;
}
.section {
@include section($base03);
}
.greenroom-section {
@include section($base03-green);
}
#now-playing {
height: 350px;
overflow: hidden;
position: relative;
text-align: center;
}
#poster {
@include background-link(100%, 350px, url('<r:asset:url name="NighthawkAnteater.png" />'));
}
#content {
.home-section {
width: $column-width;
h1 {
border-bottom: 1px solid $text-color;
padding-bottom: 0.1em;
a:hover {
text-decoration: none;
}
}
}
h1 {
@include hide-link;
font: {
size: 2em;
}
a {
color: $text-color;
}
}
h2 {
@include hide-link;
font: {
size: 1.5em;
variant: small-caps;
}
margin: 1em 0 0.5em 0;
}
dl {
margin: 0;
}
}
.primary {
float: left;
}
.secondary {
float: right;
}
.tertiary {
float: right;
}
#events-list {
display: none;
float: left;
list-style-type: none;
max-width: 50%;
padding: 0;
}
#toaster {
display: none;
float: left;
margin-left: 1em;
}
footer {
clear: both;
position: relative;
top: 2em;
h1 {
@include hide-link;
font-size: 1.5em;
a {
color: $text-color;
}
}
a {
// You can't specify both an HSL and an RGB value at the same time,
// so call `scale-color' twice.
color: scale-color(scale-color($text-color, $lightness: -40%), $blue: 25%);
}
ul {
list-style-type: none;
padding: 0;
}
section {
float: left;
width: 30%;
}
}
.social-icon {
float: left;
img {
vertical-align: middle;
width: $social-icon-size;
}
}
.facebook {
@extend .social-icon;
color: #fff;
font: {
family: "Arial Black", "Arial", sans-serif;
size: 33px;
weight: 700;
}
line-height: $social-icon-size;
text-decoration: none;
}
@media (min-width: 900px) and (max-width: 1024px) {
#now-playing {
float: left;
width: $column-width;
}
#poster {
background-image: url('<r:asset:url name="NighthawkAnteaterSmall.png" />');
width: $column-width;
}
.secondary {
float: left;
clear: both;
}
.primary, .tertiary {
margin-left: 1em;
float: left;
}
}
@media (max-width: 900px) {
#content {
width: $column-width;
margin: 0 auto;
}
#poster {
background-image: url('<r:asset:url name="NighthawkAnteaterSmall.png" />');
width: $column-width;
}
#now-playing {
width: $column-width;
}
.tertiary {
float: none;
}
.primary {
float: none;
}
.secondary {
float: none;
}
#content h1 {
font: {
size: 1.2em;
}
}
}
@media (min-width: 700px) and (max-width: 850px) {
#logo {
background-image: url('<r:asset:url name="logo.png" />');
background-size: 221px;
margin-left: 1em;
width: 221px;
}
}
@media (min-width: 600px) and (max-width: 700px) {
#logo {
background-image: url('<r:asset:url name="logo_toaster.png" />');
background-size: 90px 90px;
margin-left: 2em;
width: 100px;
}
}
@media (max-width: 600px) {
#logo {
display: none;
}
#supporters {
display: none;
}
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><r:site:title /> &mdash; <r:title /></title>
<meta charset="UTF-8"/>
<link rel="alternate" type="application/rss+xml" title="DramaTech Club News Feed (RSS)" href="http://dramatech.org/greenroom/feeds/rss/"/>
<link rel="alternate" type="application/rss+xml" title="DramaTech News Feed (RSS)" href="http://dramatech.org/feeds/rss/"/>
<link rel="alternate" type="application/atom+xml" title="DramaTech Club News Feed (atom)" href="http://dramatech.org/greenroom/feeds/atom/"/>
<link rel="alternate" type="application/atom+xml" title="DramaTech News Feed (atom)" href="http://dramatech.org/feeds/atom/"/>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/>
<link rel="icon" type="image/png" href="/favicon.png"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<r:javascript name="typekit.js" as="link" />
<r:stylesheet slug="projectanteater.css" as="link" media="all"/>
<r:if_content part="head"><r:content part="head"/></r:if_content>
<r:if_field name="Keywords"><meta name="keywords" content="<r:field name="Keywords" />"/></r:if_field>
<r:unless_field name="Keywords"><r:find url="/"><r:if_field name="Keywords"><meta name="keywords" content="<r:field name="Keywords" />"/></r:if_field></r:find></r:unless_field>
<r:if_field name="Description"><meta name="description" content="<r:field name="Description" />"/></r:if_field>
</head>
<body>
<div id="grid"></div>
<div id="wrapper">
<r:snippet name="anteater-header" />
<div id="content">
<r:snippet name="if-news">
<h1><r:title /></h1>
<p><r:date for="published_at" /></p>
</r:snippet>
<r:if_content part="now-playing"><r:snippet name="now-playing"><r:content part="now-playing"/></r:snippet></r:if_content>
<r:if_content part="hero"><r:snippet name="anteater-hero"><r:content part="hero"/></r:snippet></r:if_content>
<r:unless_content part="hero">
<r:if_content part="hero1, hero2, hero3">
<r:snippet name="anteater-hero">
<section><r:content part="hero1"/></section>
<section><r:content part="hero2"/></section>
<section><r:content part="hero3"/></section>
</r:snippet>
</r:if_content>
</r:unless_content>
<r:if_content part="body"><r:content part="body"/></r:if_content>
<r:if_content part="extended"><r:content part="extended"/></r:if_content>
</div>
<footer>
<r:if_content part="footer"><r:content part="footer" /></r:if_content>
<r:snippet name="anteater-footer" />
</footer>
</div>
</body>
</html>
// Google Calendar Event Loader
// Fill me out:
calendarId = ''
apiKey = ''
maxEvents = 3
$(() ->
$.ajax(
url: "https://www.googleapis.com/calendar/v3/calendars/#{calendarId}/events?maxResults=#{maxEvents}&timeMin=#{new Date().toISOString()}&key=#{apiKey}&orderBy=startTime&singleEvents=true"
dataType: 'jsonp'
success: (data, textStatus, jqXHR) ->
data = $.parseJSON(data) if (typeof window.test == 'string')
$('#events-list').empty() if (data.items.length > 0)
(
start = new Date(item.start.dateTime || item.start.date + 'T00:00:00-04:00')
$("<dt><a href=\"#{item.htmlLink}\">#{item.summary}</a></dt>").appendTo '#events-list'
$("<dd>#{start.getMonth()+1}/#{start.getDate()}/#{start.getFullYear()}</dd>").appendTo '#events-list' if (start.valueOf() == start.valueOf())
) for item, i in data.items
return
complete: (jqXHR, textStatus) ->
$('#events').children().fadeIn()
return
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment