diff --git a/kanken_online/static/data.js b/kanken_online/static/data.js new file mode 100644 index 0000000..a3833ce --- /dev/null +++ b/kanken_online/static/data.js @@ -0,0 +1,10 @@ +const kanjiTSVButton = document.getElementById("kanji-tsv-download-button"); +const kotobaTSVButton = document.getElementById("kotoba-tsv-download-button"); +const databaseButton = document.getElementById("database-download-button"); + +for (const button of [kanjiTSVButton, kotobaTSVButton, databaseButton]) { + button.addEventListener("click", () => { + const fileName = button.getAttribute("data-filename"); + location.assign(`/static/download/${fileName}`); + }); +} \ No newline at end of file diff --git a/kanken_online/templates/data.html b/kanken_online/templates/data.html index 28667c8..ef68c03 100644 --- a/kanken_online/templates/data.html +++ b/kanken_online/templates/data.html @@ -1,12 +1,16 @@ {% extends 'base.html' %} +{% block scripts %} + +{% endblock %} + {% block header %}