-
Notifications
You must be signed in to change notification settings - Fork 1
/
concepticon.html
292 lines (273 loc) · 6.98 KB
/
concepticon.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="javascripts/vendor/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="javascripts/vendor/sorttable.js"></script>
<script type="text/javascript" src="javascripts/vendor/highlight.js"></script>
<style>
.highlight { background-color: yellow }
table {
border: 2px solid black;
//max-width: 1200px;
}
span.hovera{
color: red;
font-weight: bold;
}
div.hoverb{
display:none;
}
span.hovera:hover .hoverb{
display: block;
font-weight: normal;
background-color: CornFlowerBlue;
color: white;
}
td {
max-width: 250px;
}
.DEFINITION {
border: 1px solid gray;
max-width: 400px;
font-size: 80%;
}
/* Sortable tables */
table.sortable thead {
background-color:lightgray;
color:#000000;
//font-weight: bold;
cursor: pointer;
}
tr {
border: 1px solid black;
}
</style>
<script>
if (window.File && window.FileReader && window.FileList && window.Blob)
{
}
else
{
alert("The File APIs are not fully supported in this browser.");
}
/* file-handler function from http://www.html5rocks.com/de/tutorials/file/dndfiles/ */
function handleFileSelect(evt)
{
var files = evt.target.files; /* FileList object */
var file = files[0];
var store = document.getElementById('store');
/* create file reader instance */
var reader = new FileReader();
reader.onload = function(e){store.innerText = reader.result;}
reader.readAsText(file);
}
function showData()
{
var store = document.getElementById('store');
data = store.innerText;
lines = data.split('\n');
var show = document.getElementById('show');
var db = document.getElementById('db');
var start = 0;
var counter = 0;
var header = {};
for(i=0;i<lines.length;i++)
{
line = lines[i];
if(line[0] != '#' && line.length > 0 && line[0] != ' ')
{
if(start == 1)
{
points = line.split('\t');
table += '<tr id="OW_'+points[0]+'">' //<td>"+counter+"</td>";
counter += 1;
for(j=0,p;p=points[j];j++)
{
if(header[j] == 'OMEGAWIKI')
{
var fill = '<a target="_blank" href="http://www.omegawiki.org/DefinedMeaning:'+p+'">'+p+'</a>';
}
else if(header[j] == 'SEEALSO')
{
var fill_ar = [];
if(p=='-')
{
fill_ar.push('<span style="color:white">.</span>');
}
else
{
var fills = p.split(';');
for(var k=0,f;f=fills[k];k++)
{
var tmp_fill = '<a target="_blank" href="http://www.omegawiki.org/DefinedMeaning:'+f+'">'+f+'</a> ';
fill_ar.push(tmp_fill);
}
}
var fill = fill_ar.join(', ')
}
else if(header[j] == 'WOLD')
{
var fill_ar = [];
if(p == '-')
{
fill_ar.push('<span style="color:white">Z</span>');
}
else
{
var fills = p.split(';');
for(var k=0,f; f=fills[k];k++)
{
if(f != '-')
{
var tmp_fill = '<a target="_blank" href="http://wold.livingsources.org/meaning/'+f.replace(/\./,"-")+'">'+f+'</a>';
fill_ar.push(tmp_fill);
}
}
}
if(fill_ar.length == 1)
{
var fill = fill_ar[0];
}
else if(fill_ar.length > 1)
{
var fill = '<span style="background-color:red">'+fill_ar.join(', ')+'</span>';
}
else
{
var fill = '<span style="color:white">Z</span>';
}
}
else
{
if(p != '--')
{
var fill = p;
}
else
{
var fill = '<span style="color:white">Z</span>';
}
}
table += '<td class="'+header[j]+'">'+fill+'</td>';
}
table += '</tr>';
}
else
{
start = 1;
counter = 1;
var points = line.split('\t');
var table = '<table id="concepticon" class="sortable" border="1"><tr>'; //<th>'+points.join('</th><th>')+'</th></tr>';
for(var j=0, p; p = points[j]; j++)
{
header[j] = p;
table += '<th id="'+p.toLowerCase()+'">'+p+'</th>';
}
table += '</tr>';
}
}
}
table += '</table>';
show.innerHTML = table;
}
var highl = 0;
function searchTable(event)
{
//$('#concepticon').removeHighlight();
var table = document.getElementById('concepticon');
var text = document.getElementById('textfield').value;
if(text.replace(/["\s]/g, '') == "")
{
for(var i=1,row;row=table.rows[i];i++)
{
row.style.display="table-row";
}
return;
}
for(var i=1, row; row=table.rows[i]; i++)
{
cell = row.cells[2];
var fullText = '';
for(j=0,cell;cell=row.cells[j];j++)
{
fullText += cell.innerHTML.toUpperCase();
}
if(fullText.indexOf(text.toUpperCase()) == -1)
{
if(fullText == text.toUpperCase().replace(/"/g,''))
{
row.style.display = 'table-row';
}
else
{
row.style.display = "none";
}
}
else
{
row.style.display = 'table-row';
}
}
if(event.keyCode == 13)
{
//$('#concepticon').removeHighlight();
highl = 1;
$('td').highlight(text);
}
else if (highl == 1)
{
$('#concepticon').removeHighlight();
}
}
function loadFile(url,wait)
{
$.ajax({
async: wait,
type: "GET",
url: url,
dataType: "text",
success: function(data) { storeText(data); }
});
}
function storeText(data)
{
var store = document.getElementById("store");
store.innerText = data;
var db = document.getElementById("db");
//db.innerHTML = store.innerText;
}
</script>
</head>
<body>
<div id="store" style="display:none"></div>
<h3>Concepticon-Viewer (<a href="http://quanthistling.info">QLC Research Group</a>)
<span class="hovera">[?]
<div class="hoverb">
<ul>
<li>
Upload a file with help of the BROWSE button on the left.
</li>
<li>Load the file-content by pressing the SHOW button.</li>
<li>Pressing ENTER in the search field will highlight all instances of the search
strings.</li>
</ul>
</div>
</span>
</h3>
<input type="file" id="file" name="file" accept=".tsv" class="submit2 active" />
<input type="button" id="showstuff" name="showstuff" value="SHOW" onclick="showData();" class="submit2 active"/>
<span style="padding-left:20px;color:white">.</span>
<input type="text" onkeyup="searchTable(event);" id="textfield" size=40 placeholder="search for words or phrases" />
<br>
<br>
<div id="show"></div>
<div id="db"></div>
<script>
document.getElementById('file').addEventListener('change', handleFileSelect, false);
</script>
<script>
loadFile('data/small_list.tsv',false);
showData();
</script>
</body>
</head>