Last active
December 16, 2015 16:40
-
-
Save say2joe/5464912 to your computer and use it in GitHub Desktop.
JS.LA Presentation Template. Utilizes Google (Docs) Spreadsheet for presentation items.Use http://jsbin.com/gist/5464912 (JS Bin) for presentation visual. Used for my presentation on JavaScript Made Simple: Object Orientation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<meta name="description" content="JS.LA - JavaScript Made Simple: Object Orientation" /> | |
<title>JS.la Presents JavaScript Made Simple: Obect Orientation</title> | |
<style> | |
h4 pre { | |
border: 1px solid #ccc; | |
padding: 3px; | |
} | |
</style> | |
</head> | |
<body> | |
<button onclick="doExample();">Next Example</button> | |
<button onclick="$notes.toggle()">Show/Hide Results with Notes</button> | |
<h2></h2><pre></pre><h4><pre></pre></h4> | |
<script> | |
// The following is a Google Spreadsheet which is used for the actual presentation content (including sample code). | |
// The script uses a published RSS feed from the spreadsheet. The spreadsheet is available at: http://goo.gl/5huw5 | |
var urlData = "https://spreadsheets.google.com/feeds/list/0AoJTkgcOmnk5dEJXcGFhRzlFMnFhcG1aUEE4TmJjQWc/od6/public/basic"; | |
var rssData, $title, $code, $notes, example = 0, rawData = {}; | |
function getData(url) { | |
return $.get(url, function(xml) { | |
rssData = xml; | |
var $xml = $.parseXML(xml); | |
var $rows = $(xml).find("entry"); | |
$rows.each(function(i) { | |
var $row = $(this), | |
content = $.text($row.find("content")).split(", resultsexamples:"); | |
rawData["row"+(i+1)] = { | |
title: $.text($row.find("title")) | |
.replace(" (","<br/><small>(") + "</small>", | |
code: content[0].replace(/^expression:\s+/,''), | |
notes: content[1].replace(/, notes:\s+/,"<hr/>") | |
}; | |
}); | |
}); | |
} | |
function doExample() { | |
if (++example > 4) example = 1; | |
$title.html(rawData["row"+example].title); | |
$code.html(rawData["row"+example].code); | |
$notes.html(rawData["row"+example].notes); | |
} | |
$(function(){ | |
$title = $("h2"), $code = $("h2+pre"), $notes = $("h4>pre").hide(); | |
$.when(getData(urlData)).done(doExample); | |
}); | |
window.open(urlData); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function runtimeConsoleDisplay() { // Panel | |
console.log("Click: Run with JS (to begin)"); | |
// Copy and paste code here (during presentation) | |
console.log("Select: Auto-run JS (for live edits)"); | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The presentation: http://jsbin.com/gist/5464912
The video demo: https://vimeo.com/65035082