Skip to content

Instantly share code, notes, and snippets.

@kujirahand
Created August 16, 2021 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kujirahand/005adff6965f737a2d3d5b065f6e2d0c to your computer and use it in GitHub Desktop.
Save kujirahand/005adff6965f737a2d3d5b065f6e2d0c to your computer and use it in GitHub Desktop.
3×3のグリッドのアイデア発想ツール 改良版
<!DOCTYPE html><meta charset="utf-8"><html><body>
<!-- UIを作成 -->
<div id="g"></div>
<p style="clear:both"></p>
<p><a id="save" download="idea.txt" href="#">保存</a></p>
<!-- JavaScript -->
<script>
// 3×3のグリッドを作成
const g = document.querySelector('#g')
const items = []
for (let i = 0; i < 9; i++) {
const e = document.createElement('textarea')
e.innerHTML = '?'
if (i == 4) { e.className = 'center' }
g.appendChild(e)
items.push(e)
}
// 保存リンクでデータをダウンロード
const save = document.querySelector('#save')
save.onclick = (e) => {
const m = items.map(i => i.value)
const text = m.join('\n')
const blob = new Blob([text], {'type': 'text/plain'})
save.href = URL.createObjectURL(blob)
};
</script>
<style>
#g { width: 600px; }
textarea {
padding: 0px; margin: 0px;
width: 198px; height: 150px;
font-size: 1.3em; float: left;
}
.center { background-color: #fff0f0; }
</style>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment