-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
148 lines (148 loc) · 6.68 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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>la xlasisku</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="format-detection" content="telephone=no" />
<meta name="description" content="lojban dictionary searcher :3" />
<link rel="shortcut icon" href="cmaxra.png" type="image/png" />
<link rel="stylesheet" href="noto.css" />
<link rel="stylesheet" href="style.css" />
<script defer src="temml/dist/temml.min.js"></script>
<script defer src="temml/contrib/auto-render/dist/auto-render.min.js"></script>
<script defer src="latkerlo-jvotci/js/docs/data.js"></script>
<script defer src="latkerlo-jvotci/js/docs/rafsi.js"></script>
<script defer src="latkerlo-jvotci/js/docs/tarmi.js"></script>
<script defer src="latkerlo-jvotci/js/docs/tools.js"></script>
<script defer src="latkerlo-jvotci/js/docs/jvozba.js"></script>
<script defer src="latkerlo-jvotci/js/docs/katna.js"></script>
</head>
<body id="main">
<h1>la xlasisku</h1>
<p class="sub"><a href="https://github.com/berrymot/xlasisku" target="_blank">github repo</a></p>
<p>
<span class="nobr opt">
<button id="sm" disabled>normal</button><button id="xm" disabled>regex</button><button id="rm" disabled>rhyme</button>
</span>
<span class="nobr opt">
<button id="theme">theme</button>
</span>
<br />
<span class="normalonly">
<span class="nobr opt">
<button id="jvo-rn" disabled>CLL</button><button id="jvo-y" disabled>allow -'y-</button>
</span>
<span class="nobr opt">
<button id="jvo-cme">cmevla</button>
</span>
<span class="nobr opt">
<button id="jvo-mz" disabled>-mz-</button>
</span>
<button class="nopad" id="jvo-x" disabled>reset</button>
<b><a href="jvoptions.html" target="_blank">?</a></b>
</span>
<span class="regexonly">
<span class="nobr opt">
<button id="regex-tight">wrap in ^( )$</button><button id="regex-i">ignore case</button>
</span>
</span>
<span class="rhymeonly">
<span class="nobr opt">
<button id="rhyme-y">ignore y</button>
</span>
</span>
</p>
<div id="fakebox">
<input type="text" id="search" name="search" autocomplete="off" spellcheck="false" placeholder="loading" disabled size="1" />
<span id="clear-wrap"> <button class="clear nopad" id="clear">×</button></span>
</div>
<div id="info"></div>
<div id="length"></div>
<div id="results"></div>
<div id="bottom"></div>
<script>
// theme (mi lebna ti la lalxu)
function setTheme(dark) {
document.documentElement.className = dark ? "dark" : "";
try {
localStorage.setItem("theme", dark ? "dark" : "light");
} catch (e) {
//
}
}
var theme = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)") ? "dark" : "light";
try {
theme = localStorage.getItem("theme") || theme;
} catch (e) {
//
}
setTheme(theme == "dark");
setTimeout(() => {document.body.style.transition = "background 0.2s"}, 0);
</script>
<script src="data/jbo.js"></script>
<script src="helper.js"></script>
<script src="events.js"></script>
<script>
// ready for stuff to happen
worker = new Worker("worker.js");
worker.addEventListener("message", function(e) {
results = e.data;
id("results").innerHTML = "";
id("length").innerHTML = results.length + " result" + (results.length == 1 ? "" : "s");
page = 0;
load(results, page);
checkLength();
});
id("sm").removeAttribute("disabled");
id("rm").removeAttribute("disabled");
id("xm").removeAttribute("disabled");
id("search").removeAttribute("disabled");
id("search").setAttribute("placeholder", "search");
// url things
function redirect() {
var vars = "?";
if (q)
vars += "&q=" + encodeURIComponent(q);
if (config["rhyme"])
vars += "&rhyme=" + (config["rhyme.ignorey"] ? "y" : "");
else if (config["regex"]) {
var options = [];
if (config["regex.insensitive"]) options.push("i");
if (config["regex.tight"]) options.push("tight");
vars += "®ex=" + options.join(",");
} else {
vars += jvoptionsUrl();
}
vars = vars.replace(/\?&/g, "?").replace(/=&/g, "&").replace(/[&=?]$/, "");
window.history.pushState(null, null, window.location.href.split("?")[0] + vars);
}
function hardRedirect(str) {
window.location.href = window.location.href.split("?")[0] + str;
}
window.addEventListener("DOMContentLoaded", (e) => {
const params = new URLSearchParams(window.location.search);
if (!params.has("q") && params.has("gc")) {
const gcq = getConflictRegex(params.get("gc"));
hardRedirect("?q=" + encodeURIComponent(gcq) + "®ex=tight");
} else {
const qpar = params.get("q");
if (params.has("rhyme")) {
rhymeMode(params.get("rhyme") == "y");
} else if (params.has("regex")) {
var options = params.get("regex").split(",");
regexMode(options.includes("i"), options.includes("tight"));
} else {
var options = (params.get("lujvo") || "").split(",");
searchMode(options.includes("cme"));
}
if (qpar) {
id("search").value = qpar;
dispatchSearchInputEvent();
}
id("search").focus();
}
});
</script>
</body>
</html>