Skip to content

Commit

Permalink
update demos
Browse files Browse the repository at this point in the history
  • Loading branch information
spencermountain committed Dec 14, 2021
1 parent e3bc5ae commit b6abd5d
Show file tree
Hide file tree
Showing 6 changed files with 779 additions and 725 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Expand Up @@ -4,6 +4,9 @@
- **[breaking]** - plural methods like .sentences() always return arrays, even with a 'clue' param.
-->

#### 9.0.3
- **[fix]** - typescript error

#### 9.0.1

- **[fix]** - runtime error in cli (thanks maxlath!)
Expand Down
56 changes: 26 additions & 30 deletions demo/basic.html
@@ -1,34 +1,30 @@
<html></html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="https://unpkg.com/spencer-css" />
</head>
<body>
<div class="m4">
client-side test for <a href="https://github.com/spencermountain/wtf_wikipedia">wtf_wikipedia</a>
</div>
<div class="m2">
<div>ES5 build:</div>
<b class="m2" id="result">loading...</b>
</div>

<div class="m2">
<div>ESModule:</div>
<b class="m2" id="module">loading...</b>
</div>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="https://unpkg.com/spencer-css" />
</head>

<body>
<div class="m4">
client-side test for <a href="https://github.com/spencermountain/wtf_wikipedia">wtf_wikipedia</a>
</div>
<div class="m2">
<div>Radiohead members:</div>
<b class="m2" id="result">loading...</b>
</div>

<!-- load minified build -->
<script src="../builds/wtf_wikipedia-client.min.js"></script>
<script defer>
wtf.fetch('On a Friday', { lang: 'en' }).then((doc) => {
let val = doc.infobox(0).get('current_members')
let members = val.links().map((link) => link.page())
document.querySelector('#result').innerHTML = members.join(', ')
})
</script>
</body>

<!-- load minified build -->
<script src="../builds/wtf_wikipedia-client.min.js"></script>
<script defer>
wtf.fetch('On a Friday', { lang: 'en' }).then((doc) => {
let val = doc.infobox(0).get('current_members')
let members = val.links().map((link) => link.page())
document.querySelector('#result').innerHTML = members.join(', ')
})
</script>
</body>
</html>
</html>
55 changes: 26 additions & 29 deletions demo/es-module.html
@@ -1,32 +1,29 @@
<html></html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="https://unpkg.com/spencer-css" />
</head>
<body>
<div class="m4">
client-side test for <a href="https://github.com/spencermountain/wtf_wikipedia">wtf_wikipedia</a>
</div>
<div class="m2">
<div>ES5 build:</div>
<b class="m2" id="result">loading...</b>
</div>

<div class="m2">
<div>ESModule:</div>
<b class="m2" id="module">loading...</b>
</div>
<!-- test es-module -->
<script type="module">
import wtf from '../builds/wtf_wikipedia-client.mjs'
wtf.fetch('Toronto Raptors').then(doc => {
let coach = doc.infobox().get('coach')
document.querySelector('#module').innerHTML = coach.text() //'Nick Nurse'
})
</script>
</body>
</html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="https://unpkg.com/spencer-css" />
</head>

<body>
<div class="m4">
client-side test for <a href="https://github.com/spencermountain/wtf_wikipedia">wtf_wikipedia</a>
</div>

<div class="m2">
<div>Raptors Coach:</div>
<b class="m2" id="module">loading...</b>
</div>
<!-- test es-module -->
<script type="module">
import wtf from '../builds/wtf_wikipedia-client.mjs'
wtf.fetch('Toronto Raptors').then(doc => {
let coach = doc.infobox().get('coach')
document.querySelector('#module').innerHTML = coach.text() //'Nick Nurse'
})
</script>
</body>

</html>
29 changes: 29 additions & 0 deletions demo/plugin.html
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="https://unpkg.com/spencer-css" />
</head>

<body>
<div class="m4">
client-side plugin demo for <a href="https://github.com/spencermountain/wtf_wikipedia">wtf_wikipedia</a>
</div>
<script src="https://unpkg.com/wtf_wikipedia"></script>
<script src="https://unpkg.com/wtf-plugin-classify"></script>
<script defer>
window.onload = function () {
wtf.plugin(window.wtfClassify)
wtf.fetch('On a Friday', { lang: 'en' }).then((doc) => {
document.querySelector('#result').innerHTML = `
<div >${doc.title()}</div>
<pre >${JSON.stringify(doc.classify(), null, 2)}</pre>
`
})
}
</script>
</body>

</html>

0 comments on commit b6abd5d

Please sign in to comment.