-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
139 lines (136 loc) · 3.86 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>New Lexeme</title>
</head>
<body>
<main>
<h1>New Lexeme</h1>
<div id="wbl-snl-intro-text-wrapper"></div>
<div id="app"></div>
<script type="module">
import createAndMount from './src/main.ts';
import DevMessagesRepository from './src/plugins/MessagesPlugin/DevMessagesRepository';
import DevItemSearcher from './src/data-access/DevItemSearcher';
import DevLexemeCreator from './src/data-access/DevLexemeCreator';
import DevLangCodeRetriever from './src/data-access/DevLangCodeRetriever';
import LanguageItemSearcher from './src/data-access/LanguageItemSearcher';
import '@wikimedia/codex/dist/codex.style.css';
import '@wikimedia/codex-design-tokens/theme-wikimedia-ui.css';
const config = {
rootSelector: '#app',
isAnonymous: false,
tempUserEnabled: false,
licenseUrl: 'https://creativecommons.org/publicdomain/zero/1.0/',
licenseName: 'Creative Commons CC0',
wikibaseLexemeTermLanguages: new Map([
[ 'en', 'English' ],
[ 'en-ca', 'Canadian English' ],
[ 'en-gb', 'British English' ],
[ 'enm', 'Middle English' ],
[ 'es', 'Spanish' ],
[ 'de', 'German' ],
[ 'aeb', 'Tunisian Arabic' ],
[ 'af', 'Afrikaans' ],
[ 'eo', 'Esperanto' ],
[ 'ha-arab', 'Hausa in Arab script' ]
]),
lexicalCategorySuggestions: [
{
id: 'Q1084',
display: {
label: {
language: 'en',
value: 'noun',
},
description: {
language: 'en',
value: 'part of speech in grammar denoting a figurative or real thing or person',
},
},
},
{
id: 'Q34698',
display: {
label: {
language: 'en',
value: 'adjective',
},
description: {
language: 'en',
value: 'part of speech that describes a noun or pronoun',
},
},
},
{
id: 'Q24905',
display: {
label: {
language: 'en',
value: 'verb',
},
description: {
language: 'en',
value: 'Lexical Category',
},
},
},
{
id: 'Q380057',
display: {
label: {
language: 'en',
value: 'adverb',
},
description: {
language: 'en',
value: 'word that modifies a verb, adjective, or another adverb',
},
},
},
],
placeholderExampleData: {
languageLabel: 'English',
lexicalCategoryLabel: 'verb',
lemma: 'speak',
spellingVariant: 'en',
},
maxLemmaLength: 100,
};
const devItemSearcher = new DevItemSearcher();
const services = {
itemSearcher: devItemSearcher,
languageItemSearcher: new LanguageItemSearcher(
devItemSearcher,
[ 'default', 'language' ],
),
langCodeRetriever: new DevLangCodeRetriever(),
messagesRepository: new DevMessagesRepository(),
lexemeCreator: new DevLexemeCreator(),
searchLinker: {
getSearchUrlForLexeme( searchTerm ) {
const search = encodeURIComponent( searchTerm );
return `https://www.wikidata.org/w/index.php?search=${search}&ns146=1`;
},
},
tracker: {
increment( name ) {
console.log( `TRACK: increment ${name}` );
},
},
urlLauncher: { async goToURL( url ) { alert( `Navigating to: ${url}` ); } },
};
const params = new URLSearchParams( location.search );
if ( params.has( 'initParams' ) ) {
config.initParams = JSON.parse( params.get( 'initParams' ) );
}
if ( params.has( 'isAnonymous' ) ) {
config.isAnonymous = params.get( 'isAnonymous' ) !== 'false';
}
createAndMount( config, services );
</script>
</main>
</body>
</html>