A little refactoring

This commit is contained in:
Travis Chase 2015-01-21 12:09:39 -06:00
parent 2185801eb0
commit 2ef7cb4322

View File

@ -1,23 +1,13 @@
$(function() { $(function() {
var quotes = new Array( var ads = [
"Take your icon game to the next level.", { quote: "Take your icon game to the next level.", url_string: "ad_1_next_level"},
"Subset your icons, add your own, and serve up from a CDN.", { quote: "Subset your icons, add your own, and serve up from a CDN.", url_string: "ad_2_all_value_add"},
"Make your icons load 10x faster!", { quote: "Make your icons load 10x faster!", url_string: "ad_3_faster_loading"},
"Looking for other great icon sets?", { quote: "Looking for other great icon sets?", url_string: "ad_4_more_icons"},
"Need a custom icon in Font Awesome?" { quote: "Need a custom icon in Font Awesome?", url_string: "ad_5_custom_icons"}
); ];
var url_strings = new Array(
"ad_1_next_level", selectFonticonsAd();
"ad_2_all_value_add",
"ad_3_faster_loading",
"ad_4_more_icons",
"ad_5_custom_icons"
);
random_number = Math.floor( Math.random() * quotes.length );
random_quote = quotes[random_number];
random_url_string = url_strings[random_number];
$('#rotating-message').html(random_quote);
$('#rotating-url').attr("href", "https://fonticons.com/?utm_source=font_awesome_homepage&utm_medium=display&utm_content=" + random_url_string + "&utm_campaign=promo_4.3_update");
// start the icon carousel // start the icon carousel
$('#icon-carousel').carousel({ $('#icon-carousel').carousel({
@ -102,5 +92,11 @@ $(function() {
$clear.addClass('hide'); // Hide clear button $clear.addClass('hide'); // Hide clear button
} }
function selectFonticonsAd() {
random_number = Math.floor( Math.random() * ads.length );
random_ad = ads[random_number];
$('#rotating-message').html(random_ad.quote);
$('#rotating-url').attr("href", "https://fonticons.com/?utm_source=font_awesome_homepage&utm_medium=display&utm_content=" + random_ad._url_string + "&utm_campaign=promo_4.3_update");
}
}); });