Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Update gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
sklise committed Sep 4, 2012
1 parent a3e3803 commit 1bf36fc
Show file tree
Hide file tree
Showing 22 changed files with 1,166 additions and 0 deletions.
Binary file added css/images/ui-bg_diagonals-thick_18_b81900_40x40.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-bg_diagonals-thick_20_666666_40x40.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-bg_flat_10_000000_40x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-bg_glass_100_f6f6f6_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-bg_glass_100_fdf5ce_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-bg_glass_65_ffffff_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-bg_gloss-wave_35_f6a828_500x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-icons_222222_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-icons_228ef1_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-icons_ef8c08_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-icons_ffd27a_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/ui-icons_ffffff_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
636 changes: 636 additions & 0 deletions css/natureofcode.css

Large diffs are not rendered by default.

310 changes: 310 additions & 0 deletions css/ui-lightness/jquery-ui-1.8.23.custom.css

Large diffs are not rendered by default.

Empty file added favicon.ico
Empty file.
113 changes: 113 additions & 0 deletions js/index.js
@@ -0,0 +1,113 @@
(function() {
var cleanDollarInput, defaultPrice, dollarToSliderPos, sliderPosToDollar, updateAmountFromSlider, updatePercentFromInput, updatePercentFromSlider, updateSliderFromAmount;

defaultPrice = 20.00;

dollarToSliderPos = function(dollar) {
return dollar * 2;
};

sliderPosToDollar = function(sliderPos) {
return sliderPos * .5;
};

cleanDollarInput = function(dollarInput) {
var dollarFloat, noDollar;
noDollar = dollarInput.replace('$', '');
dollarFloat = parseFloat(noDollar).toFixed(2) || defaultPrice;
if (dollarFloat < 0) {
return defaultPrice.toFixed(2);
} else {
return dollarFloat;
}
};

updateAmountFromSlider = function(sliderPos) {
var amount, displayAmount, sliderAmount;
amount = document.getElementById('amount');
displayAmount = document.getElementById('display-amount');
sliderAmount = sliderPosToDollar(sliderPos).toFixed(2);
displayAmount.setAttribute('value', "$" + sliderAmount);
return amount.setAttribute('value', sliderAmount);
};

updateSliderFromAmount = function(newAmount) {
$('#amount').val(newAmount);
$('#slider').slider('value', dollarToSliderPos(newAmount));
return false;
};

updatePercentFromInput = function(percentString) {
var percent;
percent = parseInt(percentString.replace('%', '')) || 5;
if (percent < 0) {
percent = 0;
} else if (percent > 100) {
percent = 100;
}
$('#percent-slider').slider('value', percent);
$('#percent').val(percent);
$('#display-percent').val(percent + '%');
return false;
};

updatePercentFromSlider = function(sliderPos) {
var percentDisplay, percentInput;
percentInput = document.getElementById('percent');
percentInput.setAttribute('value', sliderPos);
percentDisplay = document.getElementById('display-percent');
percentDisplay.setAttribute('value', sliderPos + '%');
return this;
};

jQuery(function() {
$('#display-percent').blur(function() {
var raw;
raw = $(this).val() || 5;
return updatePercentFromInput(raw);
});
$('#display-percent').change(function() {
var raw;
raw = $(this).val() || 5;
return updatePercentFromInput(raw);
});
$('#display-amount').blur(function() {
var newDollar, raw;
raw = $(this).val() || defaultPrice;
newDollar = cleanDollarInput(raw);
updateSliderFromAmount(newDollar);
return $(this).val('$' + newDollar);
});
$('#display-amount').change(function(event) {
var newDollar, raw;
raw = $(this).val() || defaultPrice + '';
newDollar = cleanDollarInput(raw);
updateSliderFromAmount(newDollar);
return $(this).val('$' + newDollar);
});
$('#percent-slider').slider({
value: 5,
animate: true,
slide: function(e, ui) {
return updatePercentFromSlider(ui.value);
},
stop: function(e, ui) {
return updatePercentFromSlider(ui.value);
}
});
return $('#slider').slider({
value: dollarToSliderPos(defaultPrice),
animate: true,
create: function() {
return updateAmountFromSlider(dollarToSliderPos(defaultPrice));
},
slide: function(e, ui) {
return updateAmountFromSlider(ui.value);
},
stop: function(e, ui) {
return updateAmountFromSlider(ui.value);
}
});
});

}).call(this);
2 changes: 2 additions & 0 deletions js/jquery-1.8.0.min.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions js/jquery-ui-1.8.23.custom.min.js

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions public/index.html
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<title>Nature Of Code</title>
<link rel="stylesheet" href="/css/natureofcode.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/js/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>
<script src="/js/index.js"></script>
</head>
<body>
<div id="top">
<div id="header">
<h1><a href="/">The <strong>Nature</strong> of Code</a></h1>
<h2>Daniel Shiffman</h2>
</div>
</div>

<div id="middle">
<div id="content">
A book about applying topics from mathematics, physics, and generative algorithms to computational systems. With Processing!

<div id="purchase-options">
<div id="purchase-pdf">
<h3>Buy <strong>The Nature of Code</strong> PDF</h3>

<p>Download the entire book directly from the author.</p>

<ul class="description">
<li>DRM-free</li>
<li>Delivered by email, no login necessary</li>
<li>Receive book updates for free</li>
</ul>

<form method="POST" action="/order" id="slider-form">
<p>Name Your Price:</p>
<fieldset>
<div class="slider-holder">
<div id="slider"></div>
</div>
<input id="amount" type="hidden" name="amount" value="11.00">
<input type="text" id="display-amount" value="$11.00">
</fieldset>

<p>Donate a </p>
<fieldset>
<div class="slider-holder">
<div id="percent-slider"></div>
</div>
<input type="hidden" id="percent" name="donation" value="5">
<input type="text" id="display-percent" name="percent" value="5%">
</fieldset>
<input type="submit" id="buy-now" value="Buy Now">
</form>
</div>

<div id="purchase-print">
<h3>Also available in print!</h3>
<img src="http://farm9.staticflickr.com/8448/7749029626_04c08b4bed.jpg" style="max-width:100%;">
<a class="block-link" href="#">Buy from Amazon.com</a>
</div>
</div>

<div id="read">
<h3>Read the Entire Book Online for Free</h3>

<p>The complete book is available as HTML with interactive Processing.js examples.</p>

<a class="block-link" href="/book">Read Now</a>

<p></p>
</div>
</div>
</div>

<div id="bottom">
<div id="footer">

<p>&copy;2012 Daniel Shiffman.</p>
</div>
</div>
</body>

</html>
5 changes: 5 additions & 0 deletions robots.txt
@@ -0,0 +1,5 @@
# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-Agent: *
# Disallow: /

0 comments on commit 1bf36fc

Please sign in to comment.