Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beta.ordbok.uib.no
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Språksamlingane
beta.ordbok.uib.no
Commits
3ce89846
Commit
3ce89846
authored
3 years ago
by
Ole Voldsæter
Browse files
Options
Downloads
Patches
Plain Diff
fikser meta#318
parent
7fff4bf7
No related branches found
Branches containing commit
Tags
release_2021-11-24
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/DictionaryView.vue
+11
-2
11 additions, 2 deletions
src/components/DictionaryView.vue
with
11 additions
and
2 deletions
src/components/DictionaryView.vue
+
11
−
2
View file @
3ce89846
...
@@ -74,6 +74,15 @@ import Autocomplete from './Autocomplete.vue'
...
@@ -74,6 +74,15 @@ import Autocomplete from './Autocomplete.vue'
var
api_endpoint
=
'
https://beta.ordbok.uib.no/api/dict
'
var
api_endpoint
=
'
https://beta.ordbok.uib.no/api/dict
'
function
compare_by_hgno
(
lemma_text
)
{
return
function
(
art1
,
art2
)
{
let
lemma1
=
art1
.
lemmas
.
filter
(
lemma
=>
lemma
.
lemma
==
lemma_text
)[
0
]
let
lemma2
=
art2
.
lemmas
.
filter
(
lemma
=>
lemma
.
lemma
==
lemma_text
)[
0
]
return
lemma1
.
hgno
-
lemma2
.
hgno
}
}
axios
.
interceptors
.
request
.
use
(
function
(
config
)
{
axios
.
interceptors
.
request
.
use
(
function
(
config
)
{
config
.
headers
[
"
x-api-key
"
]
=
"
ZkYiyRVXxH86ijsvhx3cH4SY5Iik2ijI3BKVJGMm
"
config
.
headers
[
"
x-api-key
"
]
=
"
ZkYiyRVXxH86ijsvhx3cH4SY5Iik2ijI3BKVJGMm
"
return
config
;
return
config
;
...
@@ -132,7 +141,7 @@ function navigate_to_search(self, query) {
...
@@ -132,7 +141,7 @@ function navigate_to_search(self, query) {
function
navigate_to_word
(
self
,
word
)
{
function
navigate_to_word
(
self
,
word
)
{
axios
.
get
(
self
.
api_pref
+
'
suggest?q=
'
+
word
)
axios
.
get
(
self
.
api_pref
+
'
suggest?q=
'
+
word
)
.
then
(
function
(
response
){
.
then
(
function
(
response
){
self
.
search_results
=
response
.
data
.
filter
(
result
=>
result
.
match
.
length
==
word
.
length
)
self
.
search_results
=
response
.
data
.
filter
(
result
=>
result
.
match
.
length
==
word
.
length
)
.
sort
(
compare_by_hgno
(
word
))
if
(
!
self
.
search_results
.
length
)
{
if
(
!
self
.
search_results
.
length
)
{
self
.
error
=
"
Ordet '
"
+
decodeURIComponent
(
word
)
+
"
' finnes ikke i ordbøkene
"
self
.
error
=
"
Ordet '
"
+
decodeURIComponent
(
word
)
+
"
' finnes ikke i ordbøkene
"
}
else
{
}
else
{
...
@@ -185,7 +194,7 @@ export default {
...
@@ -185,7 +194,7 @@ export default {
if
(
event
.
articles
){
if
(
event
.
articles
){
let
source
=
'
/
'
+
this
.
lang
+
'
/w/
'
+
event
.
word
let
source
=
'
/
'
+
this
.
lang
+
'
/w/
'
+
event
.
word
this
.
$router
.
push
(
source
)
this
.
$router
.
push
(
source
)
this
.
search_results
=
event
.
articles
.
map
(
a
=>
Object
.
assign
(
a
,
{
source
:
source
}))
this
.
search_results
=
event
.
articles
.
sort
(
compare_by_hgno
(
event
.
word
)).
map
(
a
=>
Object
.
assign
(
a
,
{
source
:
source
}))
this
.
article
=
null
this
.
article
=
null
this
.
error
=
null
this
.
error
=
null
history
.
replaceState
({
article
:
this
.
article
,
search_results
:
this
.
search_results
,
lang
:
this
.
lang
,
error
:
this
.
error
},
''
)
history
.
replaceState
({
article
:
this
.
article
,
search_results
:
this
.
search_results
,
lang
:
this
.
lang
,
error
:
this
.
error
},
''
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment