Commit 19bb0986790bebd8cf78e07f37449b7ba2d1ddb6

Lea Verou 2012-07-29T02:08:09

Added test drive page

diff --git a/templates/footer.html b/templates/footer.html
index 2187a46..1ab8d0c 100644
--- a/templates/footer.html
+++ b/templates/footer.html
@@ -7,6 +7,7 @@ and <a href="https://github.com/LeaVerou/prism/contributors" target="_blank">all
 		<li><a href="index.html">Home</a></li>
 		<li><a href="download.html">Download</a></li>
 		<li><a href="faq.html">FAQ</a></li>
+		<li><a href="test.html">Test drive</a></li>
 		<li><a href="extending.html">Extending Prism</a></li>
 		<li><a href="https://github.com/LeaVerou/prism/">Fork Prism on Github</a></li>
 	</ul>
diff --git a/test.html b/test.html
new file mode 100644
index 0000000..e68e51b
--- /dev/null
+++ b/test.html
@@ -0,0 +1,122 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+
+<meta charset="utf-8" />
+<title>Test drive ▲ Prism</title>
+<link rel="stylesheet" href="style.css" />
+<link rel="stylesheet" href="prism.css" data-noprefix />
+<style>
+#theme {
+	margin-right: -9em;
+}
+textarea {
+	width: 100%;
+	height: 10em;
+	padding: 1em;
+	box-sizing: border-box;
+	margin: .5em 0;
+	background: #f5f2f0;
+	color: black;
+	text-shadow: 0 1px white;
+	tab-size: 4;
+	font: 100% Consolas, Monaco, monospace;
+	white-space: pre;
+	word-wrap: normal;
+}
+
+#language label {
+	display: inline-block;
+	padding: .5em;
+}
+
+	#language input {
+		margin-right: .3em;
+	}
+
+</style>
+<script src="../prefixfree/prefixfree.min.js"></script>
+
+</head>
+<body>
+
+<header>
+	<div class="intro" data-src="templates/header-main.html" data-type="text/html"></div>
+	
+	<h2>Test drive</h2>
+	<p>Take Prism for a spin!</p>
+</header>
+
+<section>
+	<form>
+		<p>
+			<textarea>&lt;p class="hey">Type some code here&lt;/p></textarea>
+		</p>
+		
+		<p id="language">Language:
+		</p>
+		
+		<p>
+			<label>
+				<input type="checkbox" name="async" value="1" />
+				Asynchronously
+			</label>
+		</p>
+		
+		<p>Result:</p>
+		<pre><code></code></pre>
+	</form>
+</section>
+
+<footer data-src="templates/footer.html" data-type="text/html"></footer>
+
+<script src="prism.js"></script>
+<script src="utopia.js"></script>
+<script src="code.js"></script>
+<script>
+(function() {
+var form = $('form'), code = $('code', form),
+    languages = components.languages;
+
+for (var id in languages) {
+	if (id == 'meta') {
+		continue;
+	}
+	
+	var name = languages[id];
+	
+	$u.element.create('label', {
+		contents: [
+			{
+				tag: 'input',
+				properties: {
+					type: 'radio',
+					name: 'language',
+					value: id,
+					onclick: function () {
+						code.className = 'language-' + this.value;
+						Prism.highlightElement(code, form.elements.async.checked);
+					}
+				}
+			}, name
+		],
+		inside: '#language'
+	});
+}
+
+var radios = $$('input[name=language]');
+radios[0].checked = true;
+radios[0].onclick();
+
+var textarea = $('textarea', form);
+(textarea.oninput = function() {
+	code.textContent = this.value || '';
+	Prism.highlightElement(code, form.elements.async.checked);
+}).call(textarea);
+
+})();
+
+</script>
+
+</body>
+</html>
\ No newline at end of file