-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathLexicon.js
More file actions
51 lines (47 loc) · 5.46 KB
/
Lexicon.js
File metadata and controls
51 lines (47 loc) · 5.46 KB
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
/**
* @fileOverview Lexicon is the JavaScript controller for the OSHB Lexicon app.
* @version 1.0
* @author David
*/
(function() {
// Use ID to select entries.
var augments = ["122", "176", "193", "217", "218", "219", "223", "227", "244", "310", "328", "349", "352", "359", "441", "454", "518", "520", "565", "576", "581", "657", "671", "682", "738", "746", "783", "805", "834", "838", "859", "862", "899", "953", "973", "1004", "1090", "1101", "1106", "1109", "1121", "1168", "1197", "1238", "1250", "1254", "1268", "1300", "1304", "1328", "1350", "1356", "1419", "1430", "1436", "1460", "1462", "1471", "1481", "1524", "1550", "1633", "1688", "1699", "1713", "1719", "1754", "1760", "1793", "1799", "1803", "1817", "1826", "1861", "1888", "1913", "1933", "1984", "1995", "2006", "2030", "2048", "2094", "2109", "2114", "2119", "2123", "2131", "2148", "2151", "2174", "2186", "2222", "2235", "2254", "2256", "2258", "2275", "2286", "2290", "2292", "2300", "2342", "2363", "2366", "2403", "2416", "2427", "2470", "2490", "2491", "2492", "2502", "2505", "2506", "2513", "2529", "2530", "2532", "2556", "2557", "2560", "2563", "2575", "2590", "2603", "2608", "2616", "2617", "2654", "2660", "2682", "2686", "2691", "2712", "2717", "2720", "2721", "2742", "2763", "2764", "2771", "2775", "2778", "2790", "2791", "2818", "2836", "2844", "2859", "2870", "2892", "2896", "2902", "2930", "3026", "3039", "3136", "3162", "3227", "3239", "3272", "3293", "3326", "3384", "3399", "3470", "3499", "3512", "3520", "3543", "3559", "3563", "3568", "3581", "3588", "3635", "3641", "3651", "3667", "3669", "3708", "3713", "3715", "3722", "3724", "3733", "3734", "3738", "3739", "3820", "3823", "3833", "3835", "3837", "3856", "3867", "3885", "3886", "3898", "3919", "3971", "3988", "4024", "4057", "4060", "4070", "4116", "4118", "4135", "4149", "4172", "4206", "4207", "4224", "4229", "4245", "4364", "4365", "4409", "4414", "4427", "4445", "4448", "4455", "4478", "4480", "4506", "4531", "4541", "4551", "4569", "4609", "4654", "4659", "4685", "4686", "4718", "4723", "4759", "4853", "4869", "4880", "4881", "4888", "4893", "4894", "4911", "4915", "4916", "4924", "4937", "4938", "4945", "5007", "5015", "5034", "5035", "5077", "5090", "5094", "5102", "5108", "5115", "5116", "5130", "5132", "5137", "5144", "5158", "5170", "5178", "5183", "5198", "5216", "5218", "5234", "5243", "5257", "5258", "5271", "5273", "5274", "5279", "5292", "5299", "5310", "5322", "5327", "5344", "5355", "5356", "5362", "5387", "5391", "5401", "5410", "5425", "5433", "5483", "5492", "5512", "5518", "5526", "5531", "5533", "5541", "5543", "5587", "5591", "5592", "5596", "5599", "5606", "5607", "5608", "5612", "5633", "5640", "5642", "5643", "5674", "5697", "5710", "5713", "5730", "5731", "5737", "5740", "5749", "5753", "5766", "5774", "5788", "5798", "5800", "5844", "5848", "5849", "5858", "5860", "5867", "5868", "5869", "5892", "5921", "5930", "5945", "5953", "5971", "5973", "6001", "6014", "6016", "6030", "6031", "6049", "6060", "6075", "6076", "6087", "6089", "6090", "6105", "6121", "6131", "6152", "6154", "6163", "6166", "6186", "6211", "6213", "6245", "6282", "6286", "6288", "6306", "6327", "6335", "6341", "6363", "6411", "6412", "6452", "6485", "6524", "6537", "6544", "6565", "6567", "6571", "6572", "6595", "6601", "6605", "6612", "6632", "6635", "6643", "6658", "6670", "6672", "6677", "6679", "6692", "6695", "6696", "6718", "6731", "6735", "6743", "6756", "6767", "6781", "6793", "6800", "6807", "6848", "6862", "6867", "6869", "6872", "6887", "6892", "6924", "6957", "6960", "6963", "6965", "6979", "6996", "6999", "7014", "7024", "7049", "7050", "7087", "7097", "7105", "7106", "7110", "7114", "7133", "7136", "7161", "7183", "7189", "7197", "7203", "7218", "7227", "7235", "7280", "7285", "7287", "7298", "7311", "7348", "7356", "7363", "7384", "7389", "7397", "7411", "7417", "7423", "7442", "7447", "7451", "7461", "7462", "7488", "7489", "7497", "7531", "7597", "7602", "7623", "7628", "7641", "7652", "7663", "7673", "7685", "7699", "7704", "7711", "7722", "7737", "7739", "7751", "7754", "7760", "7771", "7777", "7791", "7819", "7892", "7919", "7921", "7936", "7975", "7991", "7997", "7999", "8019", "8077", "8088", "8110", "8138", "8163", "8165", "8173", "8175", "8178", "8186", "8197", "8227", "8240", "8296", "8302", "8314", "8321", "8336", "8385", "8388", "8433", "8438", "8453", "8523", "8556", "8577", "8585", "8599", "8602", "8615", "8625", "8632", "8649"],
wordGroup = window.wordGroup,
aug = window.aug,
lexID = document.getElementById("lexID");
// Parses a lemma from the OSHB text.
function parseLemma(lemma) {
var parts = lemma.split("/");
return parts[parts.length - 1].replace(" ", "");
}
// Click handler for the input form.
var noPush = false; // lets you go back and forward again
function setID() {
var id = parseLemma(lexID.value);
if (parseInt(id) || id.length == 1) {
id = aug[(augments.indexOf(id) >= 0) ? id + "a" : id];
}
wordGroup.set(id);
if (!noPush) {
window.history.pushState({}, "", "?lexID=" + lexID.value);
}
noPush = false;
return false;
}
document.getElementById("submit").onclick = setID;
function setIDFromQueryString() {
var queryString = window.location.search;
var urlParams = new URLSearchParams(queryString);
var lexIDFromQueryString = urlParams.get('lexID');
if (lexIDFromQueryString) {
lexID.value = lexIDFromQueryString;
setID();
}
}
setIDFromQueryString();
window.addEventListener("popstate", function() {
noPush = true;
setIDFromQueryString();
});
lexID.select();
})();