-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_old.html
executable file
·98 lines (69 loc) · 2.01 KB
/
index_old.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
<!doctype html>
<html>
<head>
<!-- need some logic here to pick between tesseract and OCRAD, tess/ocr-ad.js, css stays the same.-->
<script src="lib/fitty.min.js"></script>
<link rel="stylesheet" href="fonts.css">
</head>
<body>
<div id="json"></div>
<div id="container">
<div id="top">
<div id="read">
<div id="readword"></div>
<div id="readdata">
<div id="source"></div>
<div id="distance"></div>
</div>
</div>
<div id="chrs">
<canvas id="type" width="100" height="100"></canvas>
<div id="text">
</div>
</div>
</div>
<canvas id="full"></canvas>
<div id="words">
</div>
</div>
<img id="page" crossorigin="anonymous">
<div id="console">
<div id="data"></div>
<div id="pages"></div>
</div>
</body>
<script>
let tess = ["lib/tesseract/tesseract.min.js", "lib/levenshtein.js", "tess.js", "tess.css"];
let ocrad = ["ocrad.js", "lib/levenshtein.js", "ocr.js", "ocrad.css"];
let url = new URL(window.location.href);
let rando = rand(0, 1);
let mode = url.searchParams.get('mode');
if (mode == "tesseract") {
rando = 0;
} else if (mode == "ocrad") {
rando = 1;
}
if (rando == 0) {
mode = tess;
} else {
mode = ocrad;
}
console.log(mode);
for (let m of mode) {
if (m.includes("css")) {
let lin = document.createElement("link");
lin.href = m;
lin.rel = "stylesheet";
document.head.appendChild(lin);
} else {
let scr = document.createElement("script");
scr.src = m;
scr.setAttribute("defer", true);
document.head.appendChild(scr);
}
}
function rand(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
}
</script>
</html>