Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions 039_madlibs/P5/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src='https://cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.5.1/tabletop.min.js'></script>
<script language="javascript" type="text/javascript" src="https://cdn.jsdelivr.net/npm/p5@1.4.1/lib/p5.min.js"></script>

<script language="javascript" type="text/javascript" src="sketch.js"></script>
</head>

<body>

<head>
<script src="https://cdn.jsdelivr.net/npm/papaparse@5.3.2/papaparse.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/addons/p5.dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/addons/p5.sound.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" />

</head>

<body>
<script src="sketch.js"></script>
<h1>MadLibs</h1>
<p>_____________! they said ________ as they jumped into their _____________ and flew off with their __________ __________."</p>
</body>
</body>

</html>
33 changes: 25 additions & 8 deletions 039_madlibs/P5/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,28 @@ var txt =

function setup() {
noCanvas();
Tabletop.init({
key: '15WyEmfu6B1UCzzqeacYnzI8lutrxF6uWvFDiSteBqTs',
callback: gotData,
simpleSheet: true
});
// Tabletop.init({
// key: '15WyEmfu6B1UCzzqeacYnzI8lutrxF6uWvFDiSteBqTs',
// callback: gotData,
// simpleSheet: true
// });

// Unfortunately since 2020 tabletop.js has been deprecated
// because of some changes that Google had made. To learn
// more about it, visit https://github.com/jsoma/tabletop

// In this example, the library Papa Parse has been used
// in a very similar fashion, so do something like this
// instead. Keep in mind that the Google Sheet link has
// to a CSV link, rather than a web page!
Papa.parse('https://docs.google.com/spreadsheets/d/e/2PACX-1vSiJDczupcvlAJxd70RJ9hZina9cqweCiTj1EkYrH_17FhFBjdMFTEY2TOMmhwGBHGR05y7QRXLNbo6/pub?output=csv', {
download: true,
header: true,
complete: function(results) {
var stuff = results.data
data = stuff
}
})

var button = createButton('generate madlib');
button.mousePressed(generate);
Expand All @@ -31,6 +48,6 @@ function generate() {
createP(madlib);
}

function gotData(stuff, tabletop) {
data = stuff;
}
// function gotData(stuff, tabletop) {
// data = stuff;
// }