Adjusted d3 import method
This commit is contained in:
@@ -5,14 +5,15 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="icon" type="image/x-icon" href="../assets/favicon.png" />
|
<link rel="icon" type="image/x-icon" href="../assets/favicon.png" />
|
||||||
|
|
||||||
<script src="../assets/d3.v7.min.js" charset="utf-8"></script>
|
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
|
||||||
Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
|
Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
|
||||||
sans-serif;
|
sans-serif;
|
||||||
}
|
}
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<title>D3 mit JavaScript</title>
|
<title>D3 mit JavaScript</title>
|
||||||
@@ -25,17 +26,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script type="importmap">
|
||||||
url = "https://duolingo.checksch.de/duo_user_info.json";
|
{
|
||||||
|
"imports": {
|
||||||
|
"d3": "https://cdn.skypack.dev/d3@7"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
import * as d3 from "https://cdn.skypack.dev/d3@7";
|
||||||
|
const url = "https://duolingo.checksch.de/duo_user_info.json";
|
||||||
|
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((out) => {
|
.then((out) => {
|
||||||
const langInfo = out.lang_data;
|
const langInfo = out.lang_data;
|
||||||
|
|
||||||
langInfoPrepped = [];
|
let langInfoPrepped = [];
|
||||||
Object.entries(langInfo).forEach((el) => {
|
Object.entries(langInfo).forEach((el) => {
|
||||||
item = {};
|
let item = {};
|
||||||
item["name"] = el[1].learningLanguage;
|
item["name"] = el[1].learningLanguage;
|
||||||
item["count"] = el[1].xp;
|
item["count"] = el[1].xp;
|
||||||
|
|
||||||
|
|||||||
@@ -19,14 +19,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="importmap">
|
|
||||||
{
|
|
||||||
"imports": {
|
|
||||||
"d3": "https://cdn.skypack.dev/d3@7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
<py-script>
|
<py-script>
|
||||||
from pyodide import create_proxy, to_js, open_url
|
from pyodide import create_proxy, to_js, open_url
|
||||||
|
|||||||
Reference in New Issue
Block a user