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

use replace history function

parent bc3abbc1
No related branches found
No related tags found
No related merge requests found
...@@ -113,15 +113,7 @@ function navigate_to_article(self, source) { ...@@ -113,15 +113,7 @@ function navigate_to_article(self, source) {
}) })
.then(function(response){ .then(function(response){
self.waiting_for_articles = false self.waiting_for_articles = false
history.replaceState({article: self.article, this.replace_history()
search_results: {},
lang: self.lang,
error: self.error,
pos_selected: self.pos_selected,
scope: self.scope,
article_info: self.article_info,
page: self.page,
perPage: self.perPage}, '')
if (source) { if (source) {
self.$plausible.trackEvent('internal link incoming', {props: {origin: source}}) self.$plausible.trackEvent('internal link incoming', {props: {origin: source}})
} }
...@@ -230,17 +222,7 @@ function navigate_to_query(self, word) { ...@@ -230,17 +222,7 @@ function navigate_to_query(self, word) {
} }
self.waiting_for_articles = false self.waiting_for_articles = false
history.replaceState({ self.replace_history()
article: self.article,
lang: self.lang,
error: self.error,
pos_selected: self.pos_selected,
scope: self.scope,
article_info: self.article_info,
search_results: self.search_results,
page: self.page,
perPage: self.perPage
}, '')
self.previous = self.$route.fullPath self.previous = self.$route.fullPath
}) })
...@@ -290,6 +272,19 @@ export default { ...@@ -290,6 +272,19 @@ export default {
SearchToolbar SearchToolbar
}, },
methods: { methods: {
replace_history: function() {
history.replaceState({article: this.article,
search_results: {},
lang: this.lang,
error: null,
scope: this.scope,
article_info: this.article_info,
page: this.page,
perPage: this.perPage,
selected: this.selected,
inflection_suggestions: this.inflection_suggestions}, '')
},
total_results: function() { total_results: function() {
if (this.article_info) { if (this.article_info) {
let total = 0 let total = 0
...@@ -384,17 +379,7 @@ export default { ...@@ -384,17 +379,7 @@ export default {
Promise.all([ Promise.all([
load_articles(this, query, offset, this.perPage, "bm"), load_articles(this, query, offset, this.perPage, "bm"),
load_articles(this, query, offset, this.perPage, "nn")]).then(() => { load_articles(this, query, offset, this.perPage, "nn")]).then(() => {
history.replaceState({article: self.article, self.replace_history()
search_results: self.search_results,
lang: self.lang,
error: self.error,
pos_selected: self.pos_selected,
scope: self.scope,
article_info: self.article_info,
page: self.page,
perPage: self.perPage,
selected: self.selected,
inflection_suggestions: self.inflection_suggestions}, ''),
self.$forceUpdate() self.$forceUpdate()
} }
...@@ -441,17 +426,7 @@ export default { ...@@ -441,17 +426,7 @@ export default {
article_link_click: function(item) { article_link_click: function(item) {
if (this.article && this.article.article_id == item.article_id){ if (this.article && this.article.article_id == item.article_id){
this.article_key++ this.article_key++
history.replaceState({article: this.article, this.replace_history()
search_results: this.search_results,
lang: this.lang,
error: this.error,
pos_selected: this.pos_selected,
scope: this.scope,
article_info: this.article_info,
page: this.page,
perPage: this.perPage,
selected: this.selected,
inflection_suggestions: this.inflection_suggestions}, '')
}else{ }else{
navigate_to_article(this, item.source) navigate_to_article(this, item.source)
...@@ -461,17 +436,7 @@ export default { ...@@ -461,17 +436,7 @@ export default {
item.article.source = this.$route.fullPath item.article.source = this.$route.fullPath
this.previous = this.previous.split('#')[0] + "#" + item.title_id this.previous = this.previous.split('#')[0] + "#" + item.title_id
this.article = item.article this.article = item.article
history.replaceState({article: this.article, this.replace_history()
search_results: {},
lang: this.lang,
error: null,
pos_selected: this.pos_selected,
scope: this.scope,
article_info: this.article_info,
page: this.page,
perPage: this.perPage,
selected: this.selected,
inflection_suggestions: this.inflection_suggestions}, '')
}, },
return_to_results: function() { return_to_results: function() {
this.article = null this.article = null
...@@ -515,18 +480,7 @@ export default { ...@@ -515,18 +480,7 @@ export default {
} }
else { else {
self.waiting_for_articles = false self.waiting_for_articles = false
history.replaceState({article: self.article, self.replace_history()
search_results: self.search_results,
lang: self.lang,
error: self.error,
pos_selected: self.pos_selected,
scope: self.scope,
article_info: self.article_info,
page: self.page,
perPage: self.perPage,
selected: self.selected,
inflection_suggestions: self.inflection_suggestions}, '')
self.load_monthly_bm() self.load_monthly_bm()
self.load_monthly_nn() self.load_monthly_nn()
......
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