Commit f2457941 authored by O'Reilly Media, Inc's avatar O'Reilly Media, Inc
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

README.md

0 → 100644
+15 −0
Changes for README.md: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Example files for the title:  
  
# HTML5 for Publishers, by Sanders Kleinfeld
  
[![HTML5 for Publishers, by Sanders Kleinfeld](http://akamaicovers.oreilly.com/images/9781449314606/cat.gif)](https://www.safaribooksonline.com/library/view/title/9781449320065//)
  
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
  
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
  
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
  
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
  
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.
+18 −0

File added.

Preview size limit exceeded, changes collapsed.

+129 −0
Changes for ebook_pop_quiz/pop_quiz.html: 129 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>(e)Book Production Pop Quiz</title>
<script src="pop_quiz.js" type="text/javascript"></script>
<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
<style type="text/css">
li.question {
  font-weight: bold
}

span.filename {
  font-style: italic
}

.interactive {
  display: none
}

#answers_section {
  font-size: 1.5em;
}

ol.answers {
  font-weight: normal;
  margin-bottom: 20px;
  -webkit-user-select: none /* Prevents blue text selection
  highlights in Mobile Safari; see http://stackoverflow.com/questions/923782/disable-the-text-highlighting-magnifier-on-touch-hold-on-mobile-safari-webkit */
}

ol.answers li:hover {
  font-weight: bold
}

ol.answers li.wrong_active:after {
  content: " \2718  Sorry, that\2019s incorrect!";
  color: red;
}

ol.answers li.wrong_active, ol.answers li.correct_active {
  background-color: #C0C0C0;
  -moz-transition: background-color 0.5s;
  -webkit-transition: background-color 0.5s; 
  -o-transition: background-color 0.5s
}

ol.answers li.correct_active:after {
  content: " \2713  Correct!";
  color: green;
}

ol.mc_questions {
  font-size: 1.5em
}

ol.answers {
  list-style: upper-alpha
}
</style>
</head>
<body id="body_element">
<!-- Empty ontouchstart event handler to enable "active" CSS selector -->
<!-- in Mbile Safari; see http://stackoverflow.com/questions/3885018/active-pseudo-class-doesnt-work-in-mobile-safari -->
<h1>(e)Book Production Pop Quiz</h1>
<div class="quiz">
<p class="interactive">Test your knowledge of (e)book production with these
multiple-choice questions. Click/tap the letter next to each answer to see
if you&apos;re correct.</p>
<p class="noninteractive">Test your knowledge of (e)book production
  with these multiple-choice qustions. Check the <a
  href="#answers_section">answers</a> to see if you are correct.</p>
<ol class="mc_questions">
  <li class="question">How many points are there in a pica?
  <ol class="answers">
    <li class="wrong">8 points per pica</li>
    <li class="correct">12 points per pica</li>
    <li class="wrong">16 points per pica</li>
    <li class="wrong">1,024 points per pica</li>
  </ol></li>
  <li class="question">Which of the following files in an EPUB document
contains the ebook&apos;s manifest?
<ol class="answers">
  <li class="wrong"><span class="filename">container.xml</span></li>
  <li class="wrong">NCX TOC</li>
  <li class="correct">OPF package document</li>
  <li class="wrong"><span class="filename">chapter1.html</span></li>
</ol></li>
  <li class="question">Which of the following CSS features is
supported in Amazon&apos;s new KF8 format
<ol class="answers">
  <li class="wrong"><code>@media</code> queries</li>
  <li class="wrong"><code>text-shadow</code></li>
  <li class="wrong"><code>border-color</code></li>
  <li class="correct">All of the above</li>
</ol></li>
<li class="question">Which of the following sentences conforms
grammatically to <a href="http://www.chicagomanualofstyle.org/"><em>Chicago Manual of Style</em></a> recommendations?
<ol class="answers">
  <li class="correct">In her latest article, Serena wrote, &#x201c;I'm really excited
  to start developing ebooks for the new Kobo Box [<em>sic</em>]!&#x201d;</li>
  <li class="wrong">Ronald edited the HTML, added CSS and compiled the files into an
  EPUB archive.</li>
  <li class="wrong">Brian bought his iPad 2 from the pretzel vendor for $18.26--a real bargain!</li>
  <li class="wrong">None of the above</li>
</ol></li>
<li class="question">According to O&apos;Reilly's <a href="http://shop.oreilly.com/product/0636920022954.do"><em>Global eBook
Market</em></a> report, what was the market share of ebooks in the
trade market in 2010?
<ol class="answers">
  <li class="wrong">3.6%</li>
  <li class="correct">6.4%</li>
  <li class="wrong">12.3%</li>
  <li class="wrong">99.9%</li>
</ol></li>
</ol>
</div>
<div class="noninteractive" id="answers_section">
  <h2>Answers</h2>
  <ol>
    <li>B</li>
    <li>C</li>
    <li>D</li>
    <li>A</li>
    <li>B</li>
  </ol>
</div>
</body>
</html>
+51 −0
Changes for ebook_pop_quiz/pop_quiz.js: 51 added lines, 0 removed lines.
Original line number Diff line number Diff line
window.addEventListener('load', eventWindowLoaded, false);
function eventWindowLoaded() {
    toggleInteractiveContent();
    loadEventHandlers();
}

function toggleInteractiveContent() {
    // Select all elements with "noninteractive" @class attributes on them, and hide them
    $(".noninteractive").css("display", "none");
    // Select all elements with "interactive" @class attribute, and delete that @class to make them appear
    $(".interactive").removeClass("interactive");
}

function loadEventHandlers() {
    $(".wrong, .correct, .wrong *, .correct *").bind('mousedown touchstart', function (e) {
	// Prevent default UI behavior in iBooks for iPhone/iPad for <li>s
	e.preventDefault();
	var answerSelected = e.target;
	var answerClass = answerSelected.getAttribute("class");
	// Only change class values on main <li>, not any child elements thereof
	if (answerClass == "wrong" || answerClass == "correct") {
	    var answerNewClass = answerClass + "_active";
	    answerSelected.setAttribute("class", answerNewClass);
	} else {
	    // If we're on a child of the <li>, look for parent <li> and trigger mousedown/touchstart on it
	    $(this).parent('li.correct,li.wrong').trigger('mousedown');
	    $(this).parent('li.correct,li.wrong').trigger('mouseup');
	}
    });
    $(".wrong, .correct, .wrong *, .correct *").bind('mouseup touchend', function (e) {
	// Prevent default UI behavior in iBooks for iPhone/iPad for <li>s
	e.preventDefault();
	var answerSelected = e.target;
	var answerClass = answerSelected.getAttribute("class");
	// Only change class values on main <li>, not any child elements thereof
	if (answerClass == "wrong_active" || answerClass == "correct_active") {
	    var answerNewClass = answerClass.replace(/_active/, "");
	    answerSelected.setAttribute("class", answerNewClass);
	} else {
	    // If we're on a child of the <li>, look for parent <li> and trigger mouseup/touchend on it
	    $(this).parent('li.correct_active,li.wrong_active').trigger('mouseup');
	    $(this).parent('li.correct_active,li.wrong_active').trigger('touchend');
	}
    });
}

        

  

+34 −0
Changes for finger_painting/finger_painting.html: 34 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Finger Painting</title>
<script src="modernizr-1.6.min.js"></script>
<script src="finger_painting.js"></script>
</head>
<body>
<div>
<canvas id="canvas" width="500" height="500">
 Your browser does not support the HTML 5 Canvas. 
</canvas>
</div>
<div>
<h1>Finger Painting</h1>
<p>Click/tap a color below to select a color, and then drag/swipe on the
  canvas above to draw a picture.</p>
<p>Color selected: <span id="color_chosen">Black</span></p>
<p>
<input type="button" id="Red" style="background-color: red; width: 25px; height: 25px;"/>
<input type="button" id="Orange" style="background-color: orange; width: 25px; height: 25px;"/>
<input type="button" id="Yellow" style="background-color: yellow; width: 25px; height: 25px;"/>
<input type="button" id="Green" style="background-color: green; width: 25px; height: 25px;"/>
<input type="button" id="Blue" style="background-color: blue; width: 25px; height: 25px;"/>
<input type="button" id="Purple" style="background-color: purple; width: 25px; height: 25px;"/>
<input type="button" id="Brown" style="background-color: brown; width: 25px; height: 25px;"/>
<input type="button" id="Black" style="background-color: black; width: 25px; height: 25px;"/>
<input type="button" id="White" style="background-color: white; width: 25px; height: 25px;"/>
</p>  
<p><input type="button" id="reset_image" value="Reset Drawing"/></p>
</div>
</body>
</html>
Loading