all da files
This commit is contained in:
29
node_modules/tabletop/examples/simple/simple.html
generated
vendored
Executable file
29
node_modules/tabletop/examples/simple/simple.html
generated
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<p id="food"></p>
|
||||
|
||||
<script type="text/javascript" src="../../src/tabletop.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.onload = function() { init() };
|
||||
|
||||
var public_spreadsheet_url = 'https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AmYzu_s7QHsmdDNZUzRlYldnWTZCLXdrMXlYQzVxSFE&output=html';
|
||||
|
||||
function init() {
|
||||
Tabletop.init( { key: public_spreadsheet_url,
|
||||
callback: showInfo,
|
||||
simpleSheet: true } );
|
||||
}
|
||||
|
||||
function showInfo(data) {
|
||||
// data comes through as a simple array since simpleSheet is turned on
|
||||
alert("Successfully processed " + data.length + " rows!")
|
||||
document.getElementById("food").innerHTML = "<strong>Foods:</strong> " + [ data[0].name, data[1].name, data[2].name ].join(", ");
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
document.write("The published spreadsheet is located at <a target='_new' href='" + public_spreadsheet_url + "'>" + public_spreadsheet_url + "</a>");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
52
node_modules/tabletop/examples/simple/standard.html
generated
vendored
Executable file
52
node_modules/tabletop/examples/simple/standard.html
generated
vendored
Executable file
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div id="table_info"></div>
|
||||
|
||||
<div id="explanation"></div>
|
||||
|
||||
<h2>Let's talk about cats</h2>
|
||||
<ul id="cats"></ul>
|
||||
|
||||
<h2>Let's learn a thing or two</h2>
|
||||
<ul id="courses"></ul>
|
||||
|
||||
<!-- Don't need jQuery for Tabletop, but using it for this example -->
|
||||
<script type="text/javascript" src="../common/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../src/tabletop.js"></script>
|
||||
<script type="text/javascript">
|
||||
var public_spreadsheet_url = 'https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AmYzu_s7QHsmdE5OcDE1SENpT1g2R2JEX2tnZ3ZIWHc&output=html';
|
||||
|
||||
$(document).ready( function() {
|
||||
Tabletop.init( { key: public_spreadsheet_url,
|
||||
callback: showInfo,
|
||||
wanted: [ "Cats", "Courses" ],
|
||||
debug: true } )
|
||||
})
|
||||
|
||||
function showInfo(data, tabletop) {
|
||||
$("#table_info").text("We found the tables " + tabletop.model_names.join(", "));
|
||||
|
||||
$.each( tabletop.sheets(), function(i, sheet) {
|
||||
$("#table_info").append("<p>" + sheet.name + " has " + sheet.column_names.join(", ") + "</p>");
|
||||
});
|
||||
|
||||
$.each( tabletop.sheets("Cats").all(), function(i, cat) {
|
||||
var cat_li = $('<li><h4>' + cat.name + '</h4></li>')
|
||||
cat_li.append(cat.description);
|
||||
cat_li.appendTo("#cats");
|
||||
})
|
||||
|
||||
$.each( tabletop.sheets("Courses").all(), function(i, course) {
|
||||
var cat_li = $('<li><h4>' + course.title + '</h4></li>')
|
||||
cat_li.append(course.description);
|
||||
cat_li.append("<p>Cost: $" + course.cost + "</p>");
|
||||
cat_li.appendTo("#courses");
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
document.write("The published spreadsheet is located at <a target='_new' href='" + public_spreadsheet_url + "'>" + public_spreadsheet_url + "</a>");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user