-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
111,027 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
d3.csv("https://zhuyuhao.com/yuhao/star/chaifen/宇浩卿雲全漢字拆分表.csv", function (data) { | ||
var dictionary = data; | ||
var button = d3.select("#button"); | ||
var form = d3.select("#form"); | ||
form.on("keyup", runEnter); | ||
|
||
// Defining the function | ||
function runEnter() { | ||
d3.select("#tbody").html("") | ||
d3.event.preventDefault(); | ||
var inputValue = d3.select("#user-input").property("value"); | ||
var inputChars = [...inputValue]; | ||
for (var n = 0; n < inputChars.length; n++) { | ||
var filteredDictionary = | ||
dictionary.filter(dictionary => dictionary.char.includes(inputChars[n])); | ||
var output = _.sortBy(filteredDictionary, 'code') | ||
for (var i = 0; i < filteredDictionary.length; i++) { | ||
d3.select("#tbody").insert("tr").html( | ||
"<td><a href='https://zi.tools/zi/" + (output[i]['char']) + "'>" + (output[i]['char']) + "</a></td>" | ||
+ | ||
"<td>" + (output[i]['division']) + "</td>" | ||
+ | ||
"<td>" + (output[i]['code']) + "</td>" | ||
+ | ||
"<td>" + (output[i]['division_tw']) + "</td>" | ||
+ | ||
"<td>" + (output[i]['code_tw']) + "</td>" | ||
+ | ||
"<td>" + (output[i]['region']) + "</td>" | ||
) | ||
} | ||
} | ||
|
||
// d3.select("#tbody2").html("") | ||
// d3.event.preventDefault(); | ||
// var inputValue = d3.select("#user-input").property("value"); | ||
// var inputChars = [...inputValue]; | ||
// for (var n = 0; n < inputChars.length; n++) { | ||
// var filteredDictionary = | ||
// dictionary.filter(dictionary => dictionary.char.includes(inputChars[n])); | ||
// var output = _.sortBy(filteredDictionary, 'code') | ||
// for (var i = 0; i < filteredDictionary.length; i++) { | ||
// d3.select("#tbody2").insert("tr").html( | ||
// "<td><a href='https://zi.tools/zi/" + (output[i]['char']) + "'>" + (output[i]['char']) + "</a></td>" | ||
// + | ||
// "<td>" + (output[i]['division']) + "</td>" | ||
// + | ||
// "<td>" + (output[i]['code']) + "</td>" | ||
// + | ||
// "<td>" + (output[i]['division_tw']) + "</td>" | ||
// + | ||
// "<td>" + (output[i]['code_tw']) + "</td>" | ||
// + | ||
// "<td>" + (output[i]['region']) + "</td>" | ||
// ) | ||
// } | ||
// } | ||
}; | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | ||
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
|
||
<title>宇浩卿雲拆分查詢系統</title> | ||
<style media="screen, print"> | ||
@font-face { | ||
font-family: 'YuhaoSongti'; | ||
src: url("https://zhuyuhao.com/yuhao/fonts/YuhaoSongti.ttf"); | ||
} | ||
|
||
body { | ||
font-family: "YuhaoSongti", serif; | ||
} | ||
</style> | ||
|
||
<!-- Font Awesome icons (free version)--> | ||
<script src="https://use.fontawesome.com/releases/v5.15.1/js/all.js" crossorigin="anonymous"></script> | ||
<!-- Google fonts--> | ||
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet" /> | ||
|
||
<script src="https://d3js.org/d3.v3.min.js"></script> | ||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js"></script> | ||
|
||
<link href="styles.css" rel="stylesheet"> | ||
</head> | ||
|
||
<body> | ||
<header class="mas"> | ||
<div class="container h-100 align-items-center"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="mx-auto"> | ||
<br> | ||
<h2 class=>宇浩拆分·卿雲編碼</h2> | ||
<h6><a href="https://zhuyuhao.com/yuhao/">點擊返回官網首頁</a></h6> | ||
<br> | ||
<form id="form" onsubmit="return false"> | ||
<div class="input-group input-group-newsletter"> | ||
<input class="form-control" id="user-input" placeholder="輸入字詞句"> | ||
</div> | ||
<!-- <br> | ||
<div class="boton input-group-append" id="boton"> | ||
<button class="boton" type="button" id="button">查詢宇浩拆分 | ||
</button> | ||
</div> --> | ||
</form> | ||
<br> | ||
<table class="table" cellpadding="10"> | ||
<thead> | ||
<tr> | ||
<th scope="col">字</th> | ||
<th scope="col">拆分</th> | ||
<th scope="col">全碼</th> | ||
<th scope="col">臺拆</th> | ||
<th scope="col">臺碼</th> | ||
<th scope="col">字集</th> | ||
</tr> | ||
</thead> | ||
<tbody style="font-family: YuhaoSongti;" id="tbody"> | ||
<script src="app.js"></script> | ||
</tbody> | ||
</table> | ||
<!-- <table class="table" cellpadding="10"> | ||
<thead> | ||
<tr> | ||
<th scope="col">字</th> | ||
<th scope="col">拆分</th> | ||
<th scope="col">全碼</th> | ||
<th scope="col">臺拆</th> | ||
<th scope="col">臺碼</th> | ||
<th scope="col">字集</th> | ||
</tr> | ||
</thead> | ||
<tbody style="font-family: YuhaoSongti;" id="tbody2"> | ||
<script src="app.js"></script> | ||
</tbody> | ||
</table> --> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</header> | ||
|
||
<!-- Optional JavaScript --> | ||
<!-- jQuery first, then Popper.js, then Bootstrap JS --> | ||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" | ||
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" | ||
crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" | ||
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" | ||
crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" | ||
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" | ||
crossorigin="anonymous"></script> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.