Commit cc5ca742 authored by Stephen Sawchuk's avatar Stephen Sawchuk

homepage: fix quote links.

parent 4f76731f
...@@ -43,16 +43,16 @@ ...@@ -43,16 +43,16 @@
var Quotes = {}; var Quotes = {};
Quotes.build = function (quotes, template) { Quotes.build = function (quotes, template) {
var quoteContainer = document.createElement('q'), var quoteContainer = document.createElement('q');
quoteElemCount = 0, var quoteElemCount = 0;
quoteCount = quotes.length; var quoteCount = quotes.length;
var createQuoteElems = function () { var createQuoteElems = function () {
var quote = quotes[quoteElemCount], var quote = quotes[quoteElemCount];
el = $(template).hide(); var el = $(template).hide();
el.children('p').text(quote.quote); el.children('p').text(quote.quote);
el.find('a').text(quote.person.name).attr('href', quote.link); el.find('a').text(quote.person.name).attr('href', quote.person.link);
el.find('img').attr('src', quote.person.gravatar); el.find('img').attr('src', quote.person.gravatar);
quoteContainer.appendChild(el[0]); quoteContainer.appendChild(el[0]);
...@@ -67,8 +67,8 @@ ...@@ -67,8 +67,8 @@
}; };
Quotes.random = function (quotes) { Quotes.random = function (quotes) {
var quoteCount = quotes.length, var quoteCount = quotes.length;
randomQuotes = []; var randomQuotes = [];
var randomQuote = function () { var randomQuote = function () {
var randomQuoteIndex = Math.floor(Math.random() * quoteCount); var randomQuoteIndex = Math.floor(Math.random() * quoteCount);
...@@ -101,11 +101,11 @@ ...@@ -101,11 +101,11 @@
fadeOut.fadeOut(500, fadeOutCallback); fadeOut.fadeOut(500, fadeOutCallback);
}; };
var quotes = container.children(), var quotes = container.children();
selectRandomQuoteIndex = Quotes.random(quotes), var selectRandomQuoteIndex = Quotes.random(quotes);
quoteElems = {}, var quoteElems = {};
activeQuoteIndex = selectRandomQuoteIndex(), var activeQuoteIndex = selectRandomQuoteIndex();
prevQuoteElem = $(quotes[activeQuoteIndex]); var prevQuoteElem = $(quotes[activeQuoteIndex]);
var swap = function () { var swap = function () {
if (!quoteElems[activeQuoteIndex]) { if (!quoteElems[activeQuoteIndex]) {
...@@ -123,9 +123,9 @@ ...@@ -123,9 +123,9 @@
}; };
Quotes.init = function (quotes) { Quotes.init = function (quotes) {
var container = $(this), var container = $(this);
template = $(this).html(), var template = $(this).html();
quotesHTML = Quotes.build(quotes, template); var quotesHTML = Quotes.build(quotes, template);
container.html(quotesHTML); container.html(quotesHTML);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment