Skip to content
Snippets Groups Projects
Commit e8b69fae authored by Henrik Askjer's avatar Henrik Askjer
Browse files

Dev

parent ce36ba5e
No related branches found
No related tags found
No related merge requests found
src/assets/cate-brodersen-b7ukrYhnt8c-unsplash.webp

90.4 KiB

src/assets/designecologist-5mj5jLhYWpY-unsplash.jpg

2.69 MiB

src/assets/designecologist-5mj5jLhYWpY-unsplash.webp

2.14 MiB

......@@ -94,7 +94,7 @@ export default {
},
metaInfo() {
if (this.articleLookup) {
return {title: this.article.lemmas[0].lemma + ' - ' + {"bm,nn": "Ordbøkene.no - Bokmålsordboka og Nynorskordboka", "bm": "Bokmålsordboka", "nn": "Nynorskordboka"}[this.dictionary],
return {title: this.article.lemmas[0].lemma + ' | ' + {"bm,nn": "Bokmålsordboka og Nynorskordboka", "bm": "Bokmålsordboka", "nn": "Nynorskordboka"}[this.dictionary],
meta: [{name: 'description', vmid: 'description', content: this.meta_description}]
}
}
......
......@@ -262,7 +262,7 @@ function navigate_to_query(self, word, keep_page) {
let advanced_search = /[?_*%|]/.test(q)
// Get inflections
if (!advanced_search) {
if (!advanced_search && self.$route.name == 'search') {
let params = {q, dict: self.lang, dform: 'int', include: "i", meta: 'n', wc: self.pos_selected}
self.api.get('api/suggest?', {params})
//self.api.get('https://httpstat.us/502')
......@@ -451,25 +451,26 @@ export default {
}
}).catch(function(error){
if (self.fallback) {
if (error.response) {
self.error = {title: self.$t('error.server.title'), description: self.$t('error.server.description', {code: error.response.status})}
}
else if (error.message == "Network Error") {
self.error = {title: self.$t('error.network.title'), description: self.$t('error.network.description')}
self.api = axios.create({baseURL: FALLBACK_ENDPOINT})
if (!self.error || !self.error.response) {
if (self.fallback) {
if (error.response) {
self.error = {title: self.$t('error.server.title'), description: self.$t('error.server.description', {code: error.response.status}), response: error.response}
}
else if (error.message == "Network Error") {
self.error = {title: self.$t('error.network.title'), description: self.$t('error.network.description')}
}
else {
self.error = {title: self.$t('error.generic.title'), description: self.$t('error.generic.description')}
}
self.waiting_for_metadata = false
self.waiting_for_articles = false
}
else {
self.error = {title: self.$t('error.generic.title'), description: self.$t('error.generic.description')}
self.fallback = true
self.load_welcome_and_metadata()
}
self.waiting_for_metadata = false
self.waiting_for_articles = false
}
else {
self.fallback = true
self.api = axios.create({baseURL: FALLBACK_ENDPOINT})
self.load_welcome_and_metadata()
}
})
},
......@@ -506,13 +507,13 @@ export default {
},
load_monthly_bm: function() {
let self = this
this.api.get('bm/article/120608.json').then(function(response){
this.api.get('bm/article/502.json').then(function(response){
self.monthly_bm = Object.assign(response.data, {dictionary: 'bm'})
})
},
load_monthly_nn: function() {
let self = this
this.api.get('nn/article/44621.json').then(function(response){
this.api.get('nn/article/493.json').then(function(response){
self.monthly_nn = Object.assign(response.data, {dictionary: 'nn'})
})
},
......@@ -525,35 +526,37 @@ export default {
this.suggest_fulltext = false
this.suggest_other_dict = false
this.api = axios.create({baseURL: FALLBACK_ENDPOINT})
if (this.fallback || !retry_params.retry) {
this.fallback = true
if (error.response) {
if (error.response.status == 404) {
if (retry_params.article) {
this.error = {title: this.$t('error.404.title'), description: this.$t('error.no_article', {id: this.$route.params.id}), article: true}
if (!this.error || !this.error.response) {
if (this.fallback || !retry_params.retry) {
this.fallback = true
if (error.response) {
if (error.response.status == 404) {
if (retry_params.article) {
this.error = {title: this.$t('error.404.title'), description: this.$t('error.no_article', {id: this.$route.params.id}), article: true, response: error.response}
}
else {
this.error = {title: this.$t('error.404.title'), description: this.$t('error.404.description'), article: retry_params.article, response: error.response}
}
}
else if (error.response.status == 503) {
this.error = {title: this.$t('error.503.title'), description: this.$t('error.503.description'), article: retry_params.article, response: error.response}
}
else if (String(error.response.status)[0] == "5") {
this.error = {title: this.$t('error.server.title'), description: this.$t('error.server.description', {code: error.response.status}), article: retry_params.article, response: error.response}
}
else {
this.error = {title: this.$t('error.404.title'), description: this.$t('error.404.description'), article: retry_params.article}
this.error = {title: this.$t('error.generic_code.title'), description: this.$t('error.generic_code.description', {code: error.response.status}), article: retry_params.article, response: error.response}
}
}
else if (error.response.status == 503) {
this.error = {title: this.$t('error.503.title'), description: this.$t('error.503.description'), article: retry_params.article}
}
else if (String(error.response.status)[0] == "5") {
this.error = {title: this.$t('error.server.title'), description: this.$t('error.server.description', {code: error.response.status}), article: retry_params.article}
} else if (error.message == "Network Error") {
this.error = {title: this.$t('error.network.title'), description: this.$t('error.network.description'), article: retry_params.article, response: error.response}
}
else {
this.error = {title: this.$t('error.generic_code.title'), description: this.$t('error.generic_code.description', {code: error.response.status}), article: retry_params.article}
this.error = {title: this.$t('error.generic.title'), description: this.$t('error.generic.description'), article: retry_params.article, response: error.response}
}
} else if (error.message == "Network Error") {
this.error = {title: this.$t('error.network.title'), description: this.$t('error.network.description'), article: retry_params.article}
}
else {
this.error = {title: this.$t('error.generic.title'), description: this.$t('error.generic.description'), article: retry_params.article}
} else {
this.fallback = true
retry_params.retry(this, retry_params.arg)
}
} else {
this.fallback = true
retry_params.retry(this, retry_params.arg)
}
},
......@@ -809,9 +812,11 @@ main {
div.welcome {
padding-top: 10px;
flex-grow: 10;
background-image: url('../assets/designecologist-5mj5jLhYWpY-unsplash.webp');
background-image: url('../assets/cate-brodersen-b7ukrYhnt8c-unsplash.webp');
background-size: cover;
background-repeat: no-repeat;
background-position-x: center;
background-position-y: -380px;
padding-bottom: 10px;
}
......
{
"sub_title": "Bokmålsordboka and Nynorskordboka",
"background": "Background image: ",
"photo": "Photo by Jeremy Bishop on unsplash.com",
"photo": "Photo by Cate Brodersen on unsplash.com",
"close": "Close",
"cancel": "Cancel",
"or": " or ",
......
{
"sub_title": "Bokmålsordboka og Nynorskordboka",
"photo": "Foto: Jeremy Bishop (unsplash.com)",
"photo": "Foto: Cate Brodersen (unsplash.com)",
"background": "Bakgrunnsbilde. ",
"close": "Lukk",
"cancel": "Avbryt",
......
{
"sub_title": "Bokmålsordboka og Nynorskordboka",
"photo": "Foto: Jeremy Bishop (unsplash.com)",
"photo": "Foto: Cate Brodersen (unsplash.com)",
"background": "Bakgrunnsbilde. ",
"close": "Lukk",
"cancel": "Avbryt",
......
......@@ -50,27 +50,9 @@ const router = new VueRouter({
},
{
name: "word",
path: ':q'
path: ':q([^?]+)'
}
]
},
{
path: 'bob/*',
redirect: to => {
return "bm/" + to.params.pathMatch
}
},
{
path: 'nob/*',
redirect: to => {
return "nn/" + to.params.pathMatch
}
},
{
path: 'bob,nob/*',
redirect: to => {
return "bm,nn/" + to.params.pathMatch
}
}
]
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment