-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
225 lines (207 loc) · 9.96 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
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
<html>
<head>
<style>
body {
font-family: monospace;
font-size: 14px;
padding: 16px;
}
li > a {
display: block;
margin: 6px 0 6px 2em;
max-width: 90%;
overflow-wrap: break-word;
}
input {
border: none;
padding: 0 0 6px 0;
outline: none;
background-image:
repeating-linear-gradient(to bottom, white, white 13px, black 14px);
}
</style>
<script>
/**
* A modified copy of some of the code from Exet
* (https://github.com/viresh-ratnakar/exet).
*/
let xlufzSelect;
let xlufzKeyword;
let xlufzJighlight;
xlufzNav = function() {
let url = xlufzSelect.value;
if (!url) {
return;
}
xlufzKeyword.value = xlufzKeyword.value.trim();
if (!xlufzKeyword.value) {
return;
}
if (xlufzHighlight.value == 'none') {
xlufzHighlight.value = 'ml=';
}
if (!xlufzKeyword.value || xlufzHighlight.value == 'none') {
return;
}
let datamuseParam = xlufzKeyword.value;
if (xlufzHighlight.value) {
datamuseParam = xlufzHighlight.value +
encodeURIComponent(xlufzKeyword.value);
}
url = 'xlufz.php?srcurl=' +
encodeURIComponent(url) + '&max=1000&' + datamuseParam;
window.open(url, '_blank');
}
xlufzMakeMenus = function() {
const inds = [
{name: "Select web page to apply Xlufz to:", url: ""},
{name: "separator"},
{name: "Crossword Unclued's anagram indicators",
url: "https://www.crosswordunclued.com/2008/09/anagram-indicators.html"},
{name: "Crossword Unclued's hidden words indicators",
url: "https://www.crosswordunclued.com/2009/03/" +
"hidden-word-indicators.html"},
{name: "Crossword Unclued's reversal indicators",
url: "https://www.crosswordunclued.com/2009/07/reversal-indicators.html"},
{name: "Crossword Unclued's homophone indicators",
url: "https://www.crosswordunclued.com/2009/02/homophone-indicators.html"},
{name: "separator"},
{name: "Crossword Unclued's deletion indicators",
url: "https://www.crosswordunclued.com/2009/04/deletion-indicators.html"},
{name: "Crossword Unclued's letter-picking indicators",
url: "https://www.crosswordunclued.com/2009/04/" +
"letter-sequence-indicators.html"},
{name: "Crossword Unclued's containment indicators",
url: "https://www.crosswordunclued.com/2009/02/" +
"container-and-content-indicators.html"},
{name: "separator"},
{name: "Crossword Unclued's list of abbreviations",
url: "https://www.crosswordunclued.com/2008/10/" +
"cryptic-abbreviations.html"},
{name: "Wikipedia's list of abbreviations",
url: "https://en.wikipedia.org/wiki/Crossword_abbreviations"},
{name: "Mythic beasts list of abbreviations",
url: "https://longair.net/mark/random/indicators/"},
{name: "separator"},
{name: "All indicators from cryptics.georgeho.org",
url: "https://cryptics.georgeho.org/data?sql=select+%2A+from+indicators_consolidated&_hide_sql=1"},
{name: "Alternation indicators from cryptics.georgeho.org",
url: "https://cryptics.georgeho.org/data?sql=select+rowid%2C+wordplay%2C+indicator%2C+clue_rowids+from+indicators+where+%22wordplay%22+%3D+%22alternation%22+order+by+rowid+limit+1000%0D%0A&_hide_sql=1"},
{name: "Anagram indicators from cryptics.georgeho.org",
url: "https://cryptics.georgeho.org/data?sql=select+rowid%2C+wordplay%2C+indicator%2C+clue_rowids+from+indicators+where+%22wordplay%22+%3D+%22anagram%22+order+by+rowid+limit+1000%0D%0A&_hide_sql=1"},
{name: "Container indicators from cryptics.georgeho.org",
url: "https://cryptics.georgeho.org/data?sql=select+rowid%2C+wordplay%2C+indicator%2C+clue_rowids+from+indicators+where+%22wordplay%22+%3D+%22container%22+order+by+rowid+limit+1000%0D%0A&_hide_sql=1"},
{name: "Deletion indicators from cryptics.georgeho.org",
url: "https://cryptics.georgeho.org/data?sql=select+rowid%2C+wordplay%2C+indicator%2C+clue_rowids+from+indicators+where+%22wordplay%22+%3D+%22deletion%22+order+by+rowid+limit+1000%0D%0A&_hide_sql=1"},
{name: "Hidden word indicators from cryptics.georgeho.org",
url: "https://cryptics.georgeho.org/data?sql=select+rowid%2C+wordplay%2C+indicator%2C+clue_rowids+from+indicators+where+%22wordplay%22+%3D+%22hidden%22+order+by+rowid+limit+1000%0D%0A&_hide_sql=1"},
{name: "Homophone indicators from cryptics.georgeho.org",
url: "https://cryptics.georgeho.org/data?sql=select+rowid%2C+wordplay%2C+indicator%2C+clue_rowids+from+indicators+where+%22wordplay%22+%3D+%22homophone%22+order+by+rowid+limit+1000%0D%0A&_hide_sql=1"},
{name: "Insertion indicators from cryptics.georgeho.org",
url: "https://cryptics.georgeho.org/data?sql=select+rowid%2C+wordplay%2C+indicator%2C+clue_rowids+from+indicators+where+%22wordplay%22+%3D+%22insertion%22+order+by+rowid+limit+1000%0D%0A&_hide_sql=1"},
{name: "Reversal indicators from cryptics.georgeho.org",
url: "https://cryptics.georgeho.org/data?sql=select+rowid%2C+wordplay%2C+indicator%2C+clue_rowids+from+indicators+where+%22wordplay%22+%3D+%22reversal%22+order+by+rowid+limit+1000%0D%0A&_hide_sql=1"},
];
const highlighters = [
{name:
"Choose keyword's relationship to the web page's words to highlight:",
key: "none"},
{name: "Highlight words related to:", key: "ml="},
{name: "Highlight words that often precede:", key: "rel_bgb="},
{name: "Highlight words that often follow:", key: "rel_bga="},
{name: "Highlight words using Datamuse words API parameters:", key: ""},
];
let html = '<select id="xlufz-select" onchange="xlufzNav()">';
for (let ind of inds) {
if (ind.name == "separator") {
html += '\n<option disabled>----------</option>'
continue;
}
html = html + `
<option value="${ind.url}">${ind.name}</option>`
}
html += '</select>';
html += ' <select id="xlufz-highlight" onchange="xlufzNav()">';
for (let hlt of highlighters) {
const title = (hlt.key == 'none') ? '' : ' title="Datamuse words API ' + ((hlt.key == '') ?
'[param=value[&p2=v2...]] directly specified in keyword' :
('param ' + hlt.key + '[keyword]')) + '"';
html += `
<option value="${hlt.key}"${title}>${hlt.name}</option>`
}
html += `</select>
<input type="text" class="xlv-answer" size="15"
placeholder="no keyword"
title="Enter a keyword and choose a highlighting category to the left"
onchange="xlufzNav()"
id='xlufz-keyword'></input>`;
const xlufzDiv = document.getElementById('xlufz');
xlufzDiv.innerHTML = html;
xlufzSelect = document.getElementById('xlufz-select');
xlufzHighlight = document.getElementById('xlufz-highlight');
xlufzKeyword = document.getElementById('xlufz-keyword');
}
</script>
</head>
<body>
<h2>Xlufz: A web service that highlights selected words on a web page</h2>
<p>
<i>
Use Xlufz (results open in a new tab):
</i>
</p>
<div id="xlufz">
</div>
<script>
xlufzMakeMenus();
</script>
<hr>
<p>
The Xlufz service can be accessed at xlufz.ratnakar.org/xlufz.php.
Here are some examples:
</p>
<ul>
<li>Cryptic container indicators that "mean like" <i>glass</i>:
<a href="https://xlufz.ratnakar.org/xlufz.php?ml=glass&max=1000&srcurl=https%3A%2F%2Fwww.highlightpress.com.au%2Fcontainers.html"><code>https://xlufz.ratnakar.org/xlufz.php?ml=glass&max=1000&srcurl=https%3A%2F%2Fwww.highlightpress.com.au%2Fcontainers.html</code></a></li>
<li>All published cryptic indicators related to the topic of <i>climate</i>: <a href="https://xlufz.ratnakar.org/xlufz.php?topics=climate&max=1000&srcurl=https%3A%2F%2Fcryptics.georgeho.org%2Fdata%3Fsql%3Dselect%2B%252A%2Bfrom%2Bindicators_consolidated%26_hide_sql%3D1"><code>https://xlufz.ratnakar.org/xlufz.php?topics=climate&max=1000&srcurl=https%3A%2F%2Fcryptics.georgeho.org%2Fdata%3Fsql%3Dselect%2B%252A%2Bfrom%2Bindicators_consolidated%26_hide_sql%3D1</code></a></li>
<li>Abbreviations of words that can be described by the adjective <i>blue</i>: <a href="https://xlufz.ratnakar.org/xlufz.php?rel_jja=blue&max=1000&srcurl=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FCrossword_abbreviations"><code>https://xlufz.ratnakar.org/xlufz.php?rel_jja=blue&max=1000&srcurl=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FCrossword_abbreviations</code></a></li>
<li>Anagram indicators that often precede the word <i>drink</i>: <a href="https://xlufz.ratnakar.org/xlufz.php?rel_bgb=drink&max=1000&srcurl=https%3A%2F%2Fwww.crosswordunclued.com%2F2008%2F09%2Fanagram-indicators.html"><code>https://xlufz.ratnakar.org/xlufz.php?rel_bgb=drink&max=1000&srcurl=https%3A%2F%2Fwww.crosswordunclued.com%2F2008%2F09%2Fanagram-indicators.html</code></a></li>
</ul>
<p>
This service is used by <a href="https://exet.app">Exet</a>, a free and
<a href="https://github.com/viresh-ratnakar/exet">open source</a> web app
for crossword construction, to show setters suggestions for cryptic
indicators related to the theme of the clue surface that they might be
toying with.
</p>
<p>
Xlufz is an open source project with the MIT license. It can be accessed
<a href="https://github.com/viresh-ratnakar/xlufz">here on
Github</a>.
</p>
<p>
As can be seen from the examples above, you pass the URL of the web page
as a URLEncoded parameter named <code>srcurl</code>. All other parameters
that you pass are used for word selection in the Datamuse words API.
</p>
<p>
Only a small set of web pages can be processed by Xlufz. You can easily
modify the code to change this set and run your own instance of Xlufz.
This set currently consists of the following URL roots:
</p>
<ul>
<li><code>cryptics.georgeho.org</code></li>
<li><code>www.crosswordunclued.com</code></li>
<li><code>www.highlightpress.com.au</code></li>
<li><code>en.wikipedia.org</code></li>
<li><code>longair.net</code></li>
</ul>
<p>
Xlufz uses the excellent and versatile
<a href="https://www.datamuse.com/api/">Datamuse words API</a>. Please refer
to its documentation to see how you can modify the word selection
parameters to highlight words that have a certain letter pattern, or rhyme
with something, etc.
</p>
</body>
</html>