-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
123 lines (122 loc) · 4.76 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!--
/*csvContour
* index.html
*===================================================================
* Copyright (c) 2020 Yuji SODE <yuji.sode@gmail.com>
*
* This software is released under the MIT License.
* See LICENSE or http://opensource.org/licenses/mit-license.php
*===================================================================
*/
-->
<!-- This program is web version of 'csvContour'. -->
<!-- Tool to draw text contour map. -->
<!DOCTYPE html><html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='description' content="This program is web version of 'csvContour'. Tool to draw text contour map.">
<title>csvContour</title>
<!-- style -->
<style type='text/css'>
.csvContour{
border:1px solid #000f;
width:30vw;
}
textarea{
resize:both;
overflow:auto;
width:20vw;
height:10vh;
}
</style>
<script src='contourChars.js'></script>
<script src='csvContour.js'></script>
</head>
<body>
<h1>csvContour</h1>
<p>
Tool to draw text contour map.<br>
This program is web version of <a href='https://github.com/YujiSODE/csvContour'>csvContour</a>.<br>
</p>
<!-- input -->
<div id='controls' class='csvContour'>
<div>
<label>
Input numerical <code>csv text</code> map, that is composed of numerical values, comma (,) and newline character<br>
(comment: a line begins with <code>#</code>)<br>
<textarea id='csvInput'></textarea>
</label>
</div>
<!-- -->
<button type='button' id='convertB1'>Convert</button>
<button type='button' id='convertB2'>Convert (framed)</button>
<button type='button' id='clearB'>Clear</button>
<button type='button' id='resetB'>Reset</button>
</div>
<!-- output -->
<div id='divPre' class='csvContour'>
<pre id='mapResult'>=== RESULT ===</pre>
</div>
<footer>
<p>Copyright (c) 2020 Yuji SODE</p>
<a href='https://github.com/YujiSODE/csvContour'>GitHub</a>
</footer>
<script>
(function(){
var slf=window,csvMap='',target=slf.document.getElementById('mapResult');
//
//initial value: sample map
slf.document.getElementById('csvInput').value='#sample map\n0,0,0,0,0,0,1,2,2,2\n0,1,1,1,1,1,1,1,2,2\n0,1,1,1,2,2,1,1,1,2\n1,1,1,2,3,3,2,1,1,1\n1,1,2,3,4,4,3,3,1,1\n1,2,3,4,4,4,3,3,2,1\n1,2,3,3,4,4,3,3,2,1\n1,1,2,3,3,3,3,2,1,0\n0,1,1,2,3,3,2,1,0,0\n0,0,1,1,2,2,1,0,0,1\n0,0,0,1,1,1,0,0,1,1\n0,0,0,0,0,0,0,1,1,1';
//
//normal mapping
slf.document.getElementById('convertB1').addEventListener('click',()=>{
csvMap=slf.document.getElementById('csvInput').value.replace(/^\#.*$/mg,'');
target.textContent=csvContour(csvMap,0);
},false);
//
//framed mapping
slf.document.getElementById('convertB2').addEventListener('click',()=>{
csvMap=slf.document.getElementById('csvInput').value.replace(/^\#.*$/mg,'');
target.textContent=csvContour(csvMap,slf.Infinity);
},false);
//
//to clear
slf.document.getElementById('clearB').addEventListener('click',()=>{
slf.document.getElementById('csvInput').value='';
target.textContent='=== RESULT ===';
},false);
//
//to reset
slf.document.getElementById('resetB').addEventListener('click',()=>{
slf.document.getElementById('csvInput').value='#sample map\n0,0,0,0,0,0,1,2,2,2\n0,1,1,1,1,1,1,1,2,2\n0,1,1,1,2,2,1,1,1,2\n1,1,1,2,3,3,2,1,1,1\n1,1,2,3,4,4,3,3,1,1\n1,2,3,4,4,4,3,3,2,1\n1,2,3,3,4,4,3,3,2,1\n1,1,2,3,3,3,3,2,1,0\n0,1,1,2,3,3,2,1,0,0\n0,0,1,1,2,2,1,0,0,1\n0,0,0,1,1,1,0,0,1,1\n0,0,0,0,0,0,0,1,1,1';
target.textContent='=== RESULT ===';
},false);
})();
</script>
</body>
</html>
<!-- /* csvContour/index.html */ -->
<!-- /* This program is web version of 'csvContour'. */ -->
<!-- /* Tool to draw text contour map. */ -->
<!--/*
* MIT License
*
* Copyright (c) 2020 Yuji Sode
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/-->