Built with blockbuilder.org
Created
September 22, 2018 03:09
-
-
Save enjalot/b2822e40d35ca199eaedcc15e72bc11a to your computer and use it in GitHub Desktop.
vocab [UNLISTED]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<style> | |
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } | |
</style> | |
</head> | |
<body> | |
<textarea id="input"></textarea> | |
<div id="text">Hello, I am Nathan</div> | |
<script> | |
var vocab = []; | |
// Feel free to change or delete any of the code you see in this editor! | |
d3.select("#input").on("input", function() { | |
console.log("input", this.value) | |
d3.select("#text").text(this.value) | |
}) | |
d3.select("#text").on("mouseup", function() { | |
console.log("selection", window.getSelection() ) | |
console.log(window.getSelection().toString()) | |
var selected = window.getSelection() | |
var word = selected.toString() | |
// lookup in CEDICT | |
// add to data structure | |
//vocab.push( { word: word, definition: definition }) | |
// rerender table with new word | |
}) | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment