mirror of
https://github.com/getbible/app.git
synced 2025-01-02 20:20:13 +00:00
formatted code for readability
This commit is contained in:
parent
8cb87ee774
commit
45b2fb239f
61
src/App.vue
61
src/App.vue
@ -1,12 +1,11 @@
|
||||
<template>
|
||||
<div class="secondary-lighten3">
|
||||
<navbar/>
|
||||
<div class="secondary-lighten3">
|
||||
<navbar />
|
||||
<div class="uk-container uk-animation-slide-bottom uk-margin-top">
|
||||
<selections/>
|
||||
<selections />
|
||||
<div class="uk-container uk-container-small">
|
||||
<verses/>
|
||||
<options/>
|
||||
|
||||
<verses />
|
||||
<options />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="loading" id="overlay">
|
||||
@ -14,26 +13,25 @@
|
||||
<span uk-spinner="ratio: 3"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import _ from 'lodash';
|
||||
|
||||
import UIkit from 'uikit';
|
||||
import Icons from 'uikit/dist/js/uikit-icons';
|
||||
import {mapGetters} from 'vuex';
|
||||
import UIkit from "uikit";
|
||||
import Icons from "uikit/dist/js/uikit-icons";
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
import navbar from './components/NavBar.vue';
|
||||
import options from './components/Options.vue';
|
||||
import Selections from './components/Selection.vue'
|
||||
import Verses from './components/Verses.vue'
|
||||
import navbar from "./components/NavBar.vue";
|
||||
import options from "./components/Options.vue";
|
||||
import Selections from "./components/Selection.vue";
|
||||
import Verses from "./components/Verses.vue";
|
||||
|
||||
UIkit.use(Icons);
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
name: "App",
|
||||
components: {
|
||||
navbar,
|
||||
options,
|
||||
@ -41,23 +39,22 @@ export default {
|
||||
Verses,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['loading'])
|
||||
...mapGetters(["loading"]),
|
||||
},
|
||||
created(){
|
||||
|
||||
this.$store.dispatch('initialise')
|
||||
console.log('Initialising');
|
||||
created() {
|
||||
this.$store.dispatch("initialise");
|
||||
console.log("Initialising");
|
||||
console.log(JSON.parse(JSON.stringify(this.$store.state)));
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import "../node_modules/uikit/src/less/uikit.less";
|
||||
@import "../node_modules/uikit/src/less/uikit.theme.less";
|
||||
@global-link-color: #DA7D02;
|
||||
@global-link-color: #da7d02;
|
||||
@global-background: #f5f4f4;
|
||||
@primary:#55828b;
|
||||
@primary: #55828b;
|
||||
@secondary: #fed18c;
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
@ -69,10 +66,10 @@ export default {
|
||||
}
|
||||
.disabled {
|
||||
cursor: not-allowed;
|
||||
color: gray
|
||||
color: gray;
|
||||
}
|
||||
.disabled:hover {
|
||||
color:gray
|
||||
color: gray;
|
||||
}
|
||||
#overlay {
|
||||
position: fixed;
|
||||
@ -83,19 +80,19 @@ export default {
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(255,255,255,0.7);
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
z-index: 20000;
|
||||
cursor: pointer;
|
||||
}
|
||||
.less-opacity{
|
||||
background-color: rgba(255,255,255,0.7);
|
||||
.less-opacity {
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
.primary {
|
||||
// background-color: #813405 !important;
|
||||
// background-color: #55828b !important;
|
||||
background-color: @primary !important;
|
||||
}
|
||||
}
|
||||
.secondary {
|
||||
// background-color: #f9a03f !important;
|
||||
// background-color: #87bba2 !important;
|
||||
@ -111,7 +108,7 @@ export default {
|
||||
.text-primary {
|
||||
// color: #813405 !important;
|
||||
color: #55828b !important;
|
||||
}
|
||||
}
|
||||
.text-secondary {
|
||||
// color: #f9a03f !important;
|
||||
// color: #87bba2 !important;
|
||||
|
@ -8,10 +8,10 @@ export { BASE_URL, API_VERSION };
|
||||
|
||||
|
||||
export default {
|
||||
get_translations(){
|
||||
get_translations() {
|
||||
return fetch(`${BASE_URL}/${API_VERSION}/translations.json`)
|
||||
},
|
||||
get_translation(abbreviation){
|
||||
get_translation(abbreviation) {
|
||||
return fetch(`${BASE_URL}/${API_VERSION}/${abbreviation}.json`)
|
||||
}
|
||||
}
|
@ -1,137 +1,159 @@
|
||||
<template>
|
||||
<div class="uk-container">
|
||||
|
||||
<div class="uk-margin" uk-margin>
|
||||
<ul class="uk-pagination" v-if="chapter">
|
||||
<li @click="prev"><a class="text-primary" href="#"><span class="uk-margin-small-right" uk-pagination-previous></span> Previous Chapter</a></li>
|
||||
<li class="uk-margin-auto-left" @click="next"><a class="text-primary" href="#">Next Chapter<span class="uk-margin-small-left" uk-pagination-next></span></a></li>
|
||||
<li @click="prev">
|
||||
<a class="text-primary" href="#"
|
||||
><span class="uk-margin-small-right" uk-pagination-previous></span>
|
||||
Previous Chapter</a
|
||||
>
|
||||
</li>
|
||||
<li class="uk-margin-auto-left" @click="next">
|
||||
<a class="text-primary" href="#"
|
||||
>Next Chapter<span
|
||||
class="uk-margin-small-left"
|
||||
uk-pagination-next
|
||||
></span
|
||||
></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import _ from 'lodash';
|
||||
import { mapGetters } from 'vuex'
|
||||
import { BASE_URL, API_VERSION } from '../api/getbible_v2_api'
|
||||
import _ from "lodash";
|
||||
import { mapGetters } from "vuex";
|
||||
import { BASE_URL, API_VERSION } from "../api/getbible_v2_api";
|
||||
|
||||
export default {
|
||||
components:{
|
||||
},
|
||||
data: function(){
|
||||
components: {},
|
||||
data: function () {
|
||||
return {
|
||||
progress: 0,
|
||||
loading: false,
|
||||
|
||||
}},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
translations(){
|
||||
translations() {
|
||||
return this.$store.state.saved_translations;
|
||||
},
|
||||
saved_translations(){
|
||||
saved_translations() {
|
||||
console.log(this.$store.state.saved_translations);
|
||||
return this.$store.state.saved_translations
|
||||
return this.$store.state.saved_translations;
|
||||
},
|
||||
...mapGetters(['chapters', 'chapter']),
|
||||
fchapters: function (){
|
||||
if(!this.search)
|
||||
return this.chapter.verses
|
||||
return this.filteredChapters
|
||||
...mapGetters(["chapters", "chapter"]),
|
||||
fchapters: function () {
|
||||
if (!this.search) return this.chapter.verses;
|
||||
return this.filteredChapters;
|
||||
},
|
||||
filteredChapters() {
|
||||
return _.orderBy(this.chapter.verses.filter((item) =>
|
||||
item.verse.toString().toLowerCase().includes(this.search.toLowerCase())
|
||||
|| item.chapter.toString().toLowerCase().includes(this.search.toLowerCase())
|
||||
|| item.name.toString().toLowerCase().includes(this.search.toLowerCase())
|
||||
|| item.text.toLowerCase().includes(this.search.toLowerCase())), 'verse');
|
||||
return _.orderBy(
|
||||
this.chapter.verses.filter(
|
||||
(item) =>
|
||||
item.verse
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(this.search.toLowerCase()) ||
|
||||
item.chapter
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(this.search.toLowerCase()) ||
|
||||
item.name
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(this.search.toLowerCase()) ||
|
||||
item.text.toLowerCase().includes(this.search.toLowerCase())
|
||||
),
|
||||
"verse"
|
||||
);
|
||||
},
|
||||
},
|
||||
methods:{
|
||||
t(i){
|
||||
return this.translations.find(t => t.abbreviation === i)
|
||||
methods: {
|
||||
t(i) {
|
||||
return this.translations.find((t) => t.abbreviation === i);
|
||||
},
|
||||
next(){
|
||||
if(this.chapter<this.chapters.length)
|
||||
this.$store.dispatch('set_chapter', this.chapter + 1)
|
||||
next() {
|
||||
if (this.chapter < this.chapters.length)
|
||||
this.$store.dispatch("set_chapter", this.chapter + 1);
|
||||
},
|
||||
prev(){
|
||||
if(this.chapter>1)
|
||||
this.$store.dispatch('set_chapter', this.chapter - 1)
|
||||
prev() {
|
||||
if (this.chapter > 1)
|
||||
this.$store.dispatch("set_chapter", this.chapter - 1);
|
||||
},
|
||||
async update_chapter() {
|
||||
// this.loading = true
|
||||
this.progress = 95
|
||||
this.progress = 95;
|
||||
let config = {
|
||||
headers: {'Access-Control-Allow-Origin': '*'}
|
||||
headers: { "Access-Control-Allow-Origin": "*" },
|
||||
};
|
||||
|
||||
let url = `${BASE_URL}/${API_VERSION}/${this.translation}/${this.book}/${this.chapter_num}.json`
|
||||
|
||||
let response = await fetch(url, config).catch(function(err) {
|
||||
this.chapter = err
|
||||
this.loading =false
|
||||
this.message = 'Error'
|
||||
let url = `${BASE_URL}/${API_VERSION}/${this.translation}/${this.book}/${this.chapter_num}.json`;
|
||||
|
||||
let response = await fetch(url, config).catch(function (err) {
|
||||
this.chapter = err;
|
||||
this.loading = false;
|
||||
this.message = "Error";
|
||||
});
|
||||
|
||||
if (!response) return;
|
||||
|
||||
this.progress = 99
|
||||
let data = await response.json().catch(err => {
|
||||
this.chapter = err
|
||||
this.loading =false
|
||||
this.message = 'Error'
|
||||
})
|
||||
this.loading =false
|
||||
this.progress = 99;
|
||||
let data = await response.json().catch((err) => {
|
||||
this.chapter = err;
|
||||
this.loading = false;
|
||||
this.message = "Error";
|
||||
});
|
||||
this.loading = false;
|
||||
|
||||
if (!data) return;
|
||||
|
||||
this.chapter = data
|
||||
this.progress =0
|
||||
|
||||
this.chapter = data;
|
||||
this.progress = 0;
|
||||
},
|
||||
async update_tr(){
|
||||
|
||||
},
|
||||
async update_bk(){
|
||||
async update_tr() {},
|
||||
async update_bk() {
|
||||
let config = {
|
||||
headers: {'Access-Control-Allow-Origin': '*'}
|
||||
headers: { "Access-Control-Allow-Origin": "*" },
|
||||
};
|
||||
this.loading =true
|
||||
this.progress =25
|
||||
this.message = 'Loading...'
|
||||
let url = `${BASE_URL}/${API_VERSION}/${this.translation}/books.json`
|
||||
fetch(url,config)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
this.loading = true;
|
||||
this.progress = 25;
|
||||
this.message = "Loading...";
|
||||
let url = `${BASE_URL}/${API_VERSION}/${this.translation}/books.json`;
|
||||
fetch(url, config)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
// console.log(data)
|
||||
this.books = data
|
||||
this.progress = 60
|
||||
this.books = data;
|
||||
this.progress = 60;
|
||||
this.update_ch();
|
||||
}).catch(function(err) {
|
||||
this.chapter = err
|
||||
this.loading =false
|
||||
this.message = 'Error'
|
||||
})
|
||||
.catch(function (err) {
|
||||
this.chapter = err;
|
||||
this.loading = false;
|
||||
this.message = "Error";
|
||||
});
|
||||
|
||||
},
|
||||
async update_ch(){
|
||||
async update_ch() {
|
||||
let config = {
|
||||
headers: {'Access-Control-Allow-Origin': '*'}
|
||||
headers: { "Access-Control-Allow-Origin": "*" },
|
||||
};
|
||||
fetch(`${BASE_URL}/${API_VERSION}/${this.translation}/${this.book}/chapters.json`,config)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
fetch(
|
||||
`${BASE_URL}/${API_VERSION}/${this.translation}/${this.book}/chapters.json`,
|
||||
config
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
// console.log(data)
|
||||
this.chapters = data
|
||||
this.progress = 85
|
||||
this.chapters = data;
|
||||
this.progress = 85;
|
||||
this.update_chapter();
|
||||
}).catch(function(err) {
|
||||
this.chapter = err
|
||||
this.loading =false
|
||||
this.message = 'Error'
|
||||
})
|
||||
.catch(function (err) {
|
||||
this.chapter = err;
|
||||
this.loading = false;
|
||||
this.message = "Error";
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
@ -7,34 +7,32 @@
|
||||
<input v-model="secondary" type="color" name="" id="">
|
||||
</a> -->
|
||||
<label for="primary">Primary Color: </label>
|
||||
<input v-model="primary" type="color" name="primary" id="primary">
|
||||
<br/>
|
||||
<input v-model="primary" type="color" name="primary" id="primary" />
|
||||
<br />
|
||||
<label for="secondary">Secondary Color: </label>
|
||||
<input v-model="secondary" type="color" name="secondary" id="secondary">
|
||||
|
||||
<input v-model="secondary" type="color" name="secondary" id="secondary" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {dispatch} from 'vuex'
|
||||
import { dispatch } from "vuex";
|
||||
export default {
|
||||
data(){
|
||||
data() {
|
||||
return {
|
||||
primary: '#55828b',
|
||||
secondary: '#fed18c'
|
||||
}
|
||||
primary: "#55828b",
|
||||
secondary: "#fed18c",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
updatePrimary(){
|
||||
dispatch('primary', this.primary)
|
||||
updatePrimary() {
|
||||
dispatch("primary", this.primary);
|
||||
},
|
||||
updateSecondary(){
|
||||
dispatch('secondary', this.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
updateSecondary() {
|
||||
dispatch("secondary", this.secondary);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
@ -1,82 +1,139 @@
|
||||
<template>
|
||||
|
||||
<div id="offcanvas-slide" uk-offcanvas>
|
||||
<div class="uk-offcanvas-bar secondary text-secondary">
|
||||
|
||||
<div class="uk-nav uk-nav-default">
|
||||
<div class="uk-margin">
|
||||
<form class="uk-search uk-search-default" action="javascript:void(0)">
|
||||
<!-- <span uk-search-icon></span> -->
|
||||
<input class="uk-search-input text-secondary primary rounded" v-model="search_text" type="search" placeholder="Search Words...">
|
||||
<input
|
||||
class="uk-search-input text-secondary primary rounded"
|
||||
v-model="search_text"
|
||||
type="search"
|
||||
placeholder="Search Words..."
|
||||
/>
|
||||
<div class="uk-margin">
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary rounded">Search</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary rounded"
|
||||
>
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="uk-margin">
|
||||
|
||||
<div class="uk-margin">
|
||||
<div class="uk-button-group text-primary ">
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary uk-active">ALL WORDS</button>
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary">ANY WORDS</button>
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary">PHRASE</button>
|
||||
<div class="uk-button-group text-primary">
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary uk-active"
|
||||
>
|
||||
ALL WORDS
|
||||
</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary"
|
||||
>
|
||||
ANY WORDS
|
||||
</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary"
|
||||
>
|
||||
PHRASE
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-margin">
|
||||
<div class="uk-button-group">
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary uk-active">BIBLE</button>
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary">OT</button>
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary">NT</button>
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary">CHAPTER</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary uk-active"
|
||||
>
|
||||
BIBLE
|
||||
</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary"
|
||||
>
|
||||
OT
|
||||
</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary"
|
||||
>
|
||||
NT
|
||||
</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary"
|
||||
>
|
||||
CHAPTER
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-button-group" data-uk-button-radio>
|
||||
<label class="uk-button primary">
|
||||
<input class="primary" type="radio" checked="checked" v-model="gender" value="0" style="display:none;"/>
|
||||
<input
|
||||
class="primary"
|
||||
type="radio"
|
||||
checked="checked"
|
||||
v-model="gender"
|
||||
value="0"
|
||||
style="display: none"
|
||||
/>
|
||||
Male
|
||||
</label>
|
||||
<label class="uk-button primary">
|
||||
<input type="radio" v-model="gender" value="1" style="display:none;"/>
|
||||
<input
|
||||
type="radio"
|
||||
v-model="gender"
|
||||
value="1"
|
||||
style="display: none"
|
||||
/>
|
||||
Female
|
||||
</label>
|
||||
</div>
|
||||
{{gender}}
|
||||
{{ gender }}
|
||||
<!-- <input type="color" name="theme" id=""> -->
|
||||
<div class="uk-margin">
|
||||
<div class="uk-button-group">
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary uk-active">EXACT MATCH</button>
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary">PARTIAL MATCH</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary uk-active"
|
||||
>
|
||||
EXACT MATCH
|
||||
</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary"
|
||||
>
|
||||
PARTIAL MATCH
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-margin">
|
||||
<div class="uk-button-group">
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary uk-active">CASE INSENSITIVE</button>
|
||||
<button class="uk-button uk-button-default uk-button-small text-secondary primary">CASE SENSITIVE</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary uk-active"
|
||||
>
|
||||
CASE INSENSITIVE
|
||||
</button>
|
||||
<button
|
||||
class="uk-button uk-button-default uk-button-small text-secondary primary"
|
||||
>
|
||||
CASE SENSITIVE
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
data() {
|
||||
return {
|
||||
search_text: '',
|
||||
search_area: '',
|
||||
match: '',
|
||||
sensitivity: '',
|
||||
words: '',
|
||||
gender: '',
|
||||
}
|
||||
search_text: "",
|
||||
search_area: "",
|
||||
match: "",
|
||||
sensitivity: "",
|
||||
words: "",
|
||||
gender: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
@ -1,94 +1,128 @@
|
||||
<template>
|
||||
<div id="selection" class="primary text-secondary uk-animation-slide-bottom uk-width-1-1 uk-card uk-card-default uk-card-body rounded" uk-margin>
|
||||
<div class="" v-if="!saved_translations.length>0">No translations added. <br/>Please click <a @click="open_settings">HERE</a> to Open Settings</div>
|
||||
<div
|
||||
id="selection"
|
||||
class="primary text-secondary uk-animation-slide-bottom uk-width-1-1 uk-card uk-card-default uk-card-body rounded"
|
||||
uk-margin
|
||||
>
|
||||
<div class="" v-if="!saved_translations.length > 0">
|
||||
No translations added. <br />Please click
|
||||
<a @click="open_settings">HERE</a> to Open Settings
|
||||
</div>
|
||||
<div v-else>
|
||||
|
||||
<ul class="uk-nav-default uk-nav-parent-icon uk-witdth-1-1 " uk-nav="multiple: false" >
|
||||
<li class="uk-parent uk-witdth-1-1"><a class="text-secondary">Translation</a>
|
||||
<ul class="uk-nav-sub uk-subnav uk-subnav-pill uk-pagination" uk-margin>
|
||||
|
||||
<ul
|
||||
class="uk-nav-default uk-nav-parent-icon uk-witdth-1-1"
|
||||
uk-nav="multiple: false"
|
||||
>
|
||||
<li class="uk-parent uk-witdth-1-1">
|
||||
<a class="text-secondary">Translation</a>
|
||||
<ul
|
||||
class="uk-nav-sub uk-subnav uk-subnav-pill uk-pagination"
|
||||
uk-margin
|
||||
>
|
||||
<!-- <li><a href="#"><span uk-pagination-previous></span></a></li> -->
|
||||
<li
|
||||
class="uk-card uk-card-hover text-secondary rounded"
|
||||
v-for="(tr,i) in saved_translations"
|
||||
v-for="(tr, i) in saved_translations"
|
||||
@click="set_translation(tr.abbreviation)"
|
||||
:key="i"
|
||||
><a class="text-secondary" href="#">{{tr["language"]?`(${tr["language"]})`:null}} {{tr['translation']}}</a></li>
|
||||
>
|
||||
<a class="text-secondary" href="#"
|
||||
>{{ tr["language"] ? `(${tr["language"]})` : null }}
|
||||
{{ tr["translation"] }}</a
|
||||
>
|
||||
</li>
|
||||
<!-- <li><a href="#"><span uk-pagination-next></span></a></li> -->
|
||||
</ul>
|
||||
</li>
|
||||
<li class="uk-nav-divider uk-witdth-1-1"></li>
|
||||
<li v-if="translation" class="uk-parent uk-witdth-1-1"><a class="text-secondary">Books</a>
|
||||
<ul class="uk-nav-sub uk-subnav uk-subnav-pill uk-pagination" uk-margin>
|
||||
|
||||
<!-- <li><a href="#"><span uk-pagination-previous></span></a></li> -->
|
||||
<li class="uk-card uk-card-hover text-secondary"
|
||||
v-for="(bk,i) in books"
|
||||
@click="set_book(bk['nr'])"
|
||||
:key="i"
|
||||
><a href="#" class="text-secondary">{{bk['name']}}</a></li>
|
||||
<!-- <li><a href="#"><span uk-pagination-next></span></a></li> -->
|
||||
</ul>
|
||||
</li>
|
||||
<li class="uk-nav-divider uk-witdth-1-1"></li>
|
||||
<li v-if="book_nr" class="uk-parent uk-witdth-1-1 "><a class="text-secondary">Chapters</a>
|
||||
<ul class="uk-nav-sub uk-subnav uk-subnav-pill uk-pagination" uk-margin>
|
||||
<li v-if="translation" class="uk-parent uk-witdth-1-1">
|
||||
<a class="text-secondary">Books</a>
|
||||
<ul
|
||||
class="uk-nav-sub uk-subnav uk-subnav-pill uk-pagination"
|
||||
uk-margin
|
||||
>
|
||||
<!-- <li><a href="#"><span uk-pagination-previous></span></a></li> -->
|
||||
<li
|
||||
class="uk-card uk-card-hover "
|
||||
v-for="(ch,i) in chapters"
|
||||
class="uk-card uk-card-hover text-secondary"
|
||||
v-for="(bk, i) in books"
|
||||
@click="set_book(bk['nr'])"
|
||||
:key="i"
|
||||
>
|
||||
<a href="#" class="text-secondary">{{ bk["name"] }}</a>
|
||||
</li>
|
||||
<!-- <li><a href="#"><span uk-pagination-next></span></a></li> -->
|
||||
</ul>
|
||||
</li>
|
||||
<li class="uk-nav-divider uk-witdth-1-1"></li>
|
||||
<li v-if="book_nr" class="uk-parent uk-witdth-1-1">
|
||||
<a class="text-secondary">Chapters</a>
|
||||
<ul
|
||||
class="uk-nav-sub uk-subnav uk-subnav-pill uk-pagination"
|
||||
uk-margin
|
||||
>
|
||||
<!-- <li><a href="#"><span uk-pagination-previous></span></a></li> -->
|
||||
<li
|
||||
class="uk-card uk-card-hover"
|
||||
v-for="(ch, i) in chapters"
|
||||
@click="set_chapter(ch['chapter'])"
|
||||
:key="i"
|
||||
><a href="#selection" class="text-secondary" uk-toggle>{{ch['chapter']}}</a></li>
|
||||
>
|
||||
<a href="#selection" class="text-secondary" uk-toggle>{{
|
||||
ch["chapter"]
|
||||
}}</a>
|
||||
</li>
|
||||
<!-- <li><a href="#"><span uk-pagination-next></span></a></li> -->
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import _ from 'lodash';
|
||||
import UIkit from 'uikit';
|
||||
import UIkit from "uikit";
|
||||
|
||||
import {mapGetters} from 'vuex';
|
||||
import { mapGetters } from "vuex";
|
||||
export default {
|
||||
components:{
|
||||
components: {
|
||||
// verses
|
||||
},
|
||||
data: function(){
|
||||
data: function () {
|
||||
return {
|
||||
// translation: 'akjv',
|
||||
|
||||
}},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// translations(){
|
||||
// // console.log(this.$store.state.saved_translations);
|
||||
// return this.$store.getters.saved_translations;
|
||||
// },
|
||||
...mapGetters(['chapters', 'books', 'translation', 'book_nr', 'saved_translations']),
|
||||
|
||||
...mapGetters([
|
||||
"chapters",
|
||||
"books",
|
||||
"translation",
|
||||
"book_nr",
|
||||
"saved_translations",
|
||||
]),
|
||||
},
|
||||
methods:{
|
||||
t(i){
|
||||
return this.translations.find(t => t.abbreviation === i)
|
||||
methods: {
|
||||
t(i) {
|
||||
return this.translations.find((t) => t.abbreviation === i);
|
||||
},
|
||||
set_translation(a) {
|
||||
console.log("Hello");
|
||||
this.$store.dispatch('set_translation', {selected_translation:a})
|
||||
this.$store.dispatch("set_translation", { selected_translation: a });
|
||||
},
|
||||
set_book(b){
|
||||
this.$store.dispatch('set_book', b)
|
||||
set_book(b) {
|
||||
this.$store.dispatch("set_book", b);
|
||||
},
|
||||
set_chapter(c){
|
||||
this.$store.dispatch('set_chapter', c)
|
||||
set_chapter(c) {
|
||||
this.$store.dispatch("set_chapter", c);
|
||||
},
|
||||
open_settings(){
|
||||
UIkit.modal('#modal-sections').show()
|
||||
}
|
||||
open_settings() {
|
||||
UIkit.modal("#modal-sections").show();
|
||||
},
|
||||
created(){
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
};
|
||||
</script>
|
@ -1,34 +1,46 @@
|
||||
<template >
|
||||
<div v-if="verses.length" >
|
||||
<div v-if="verses.length">
|
||||
<!-- {{search.toLowerCase() + fverses.length}} -->
|
||||
<br />
|
||||
<div class="uk-card uk-card-default primary uk-card-body uk-width-1-1 rounded">
|
||||
<ul :dir="dir"
|
||||
class="uk-margin-medium-top uk-list uk-list-divider uk-animation-hover">
|
||||
<li v-for="(verse, i) in pverses" :key="i"
|
||||
<div
|
||||
class="uk-card uk-card-default primary uk-card-body uk-width-1-1 rounded"
|
||||
>
|
||||
<ul
|
||||
:dir="dir"
|
||||
class="uk-margin-medium-top uk-list uk-list-divider uk-animation-hover"
|
||||
>
|
||||
<li
|
||||
v-for="(verse, i) in pverses"
|
||||
:key="i"
|
||||
:class="`uk-animation-slide-bottom uk-animation-15 uk-animation-hover`"
|
||||
>
|
||||
|
||||
<h5 class=" uk-primary text-secondary">
|
||||
<span class="uk-heading-bullet"> {{book_name+' '}} </span>
|
||||
<h5 class="uk-primary text-secondary">
|
||||
<span class="uk-heading-bullet"> {{ book_name + " " }} </span>
|
||||
<span class="uk-badge secondary text-primary badge-light">
|
||||
{{verse.chapter}}:{{verse.verse}}
|
||||
{{ verse.chapter }}:{{ verse.verse }}
|
||||
</span>
|
||||
</h5>
|
||||
<span class="text-secondary">
|
||||
{{verse.text}}
|
||||
{{ verse.text }}
|
||||
</span>
|
||||
<br/>
|
||||
<br />
|
||||
<p></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="uk-position-small uk-position-center-left uk-overlay ">
|
||||
<span @click="prevV" class="uk-icon-button primary text-secondary" uk-icon="icon:chevron-left; ratio:2"></span>
|
||||
</div>
|
||||
<div class="uk-position-small uk-position-center-right uk-overlay ">
|
||||
<span @click="nextV" class="uk-icon-button primary text-secondary" uk-icon="icon:chevron-right; ratio:2"></span>
|
||||
|
||||
<div class="uk-position-small uk-position-center-left uk-overlay">
|
||||
<span
|
||||
@click="prevV"
|
||||
class="uk-icon-button primary text-secondary"
|
||||
uk-icon="icon:chevron-left; ratio:2"
|
||||
></span>
|
||||
</div>
|
||||
<div class="uk-position-small uk-position-center-right uk-overlay">
|
||||
<span
|
||||
@click="nextV"
|
||||
class="uk-icon-button primary text-secondary"
|
||||
uk-icon="icon:chevron-right; ratio:2"
|
||||
></span>
|
||||
</div>
|
||||
|
||||
<!-- <ul class="uk-pagination" uk-margin>
|
||||
@ -49,48 +61,60 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import _ from 'lodash';
|
||||
import {mapGetters} from 'vuex';
|
||||
import _ from "lodash";
|
||||
import { mapGetters } from "vuex";
|
||||
export default {
|
||||
data: () => {
|
||||
return {
|
||||
// dir: ''
|
||||
prev: 0,
|
||||
next:5
|
||||
}
|
||||
next: 5,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['verses', 'dir', 'book_name', 'search']),
|
||||
pverses(){
|
||||
return this.fverses.slice(this.prev, this.next)
|
||||
...mapGetters(["verses", "dir", "book_name", "search"]),
|
||||
pverses() {
|
||||
return this.fverses.slice(this.prev, this.next);
|
||||
},
|
||||
fverses: function (){
|
||||
fverses: function () {
|
||||
console.log(this.search);
|
||||
if(!this.search)
|
||||
return this.verses
|
||||
return this.filteredVerses
|
||||
if (!this.search) return this.verses;
|
||||
return this.filteredVerses;
|
||||
},
|
||||
filteredVerses() {
|
||||
return _.orderBy(this.verses.filter((item) =>
|
||||
item.verse.toString().toLowerCase().includes(this.search.toLowerCase())
|
||||
|| item.chapter.toString().toLowerCase().includes(this.search.toLowerCase())
|
||||
|| item.name.toString().toLowerCase().includes(this.search.toLowerCase())
|
||||
|| item.text.toLowerCase().includes(this.search.toLowerCase())), 'verse');
|
||||
return _.orderBy(
|
||||
this.verses.filter(
|
||||
(item) =>
|
||||
item.verse
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(this.search.toLowerCase()) ||
|
||||
item.chapter
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(this.search.toLowerCase()) ||
|
||||
item.name
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(this.search.toLowerCase()) ||
|
||||
item.text.toLowerCase().includes(this.search.toLowerCase())
|
||||
),
|
||||
"verse"
|
||||
);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
nextV(){
|
||||
if(this.next> this.fverses.length) return;
|
||||
this.next = this.next + 5
|
||||
this.prev = this.prev+ 5
|
||||
nextV() {
|
||||
if (this.next > this.fverses.length) return;
|
||||
this.next = this.next + 5;
|
||||
this.prev = this.prev + 5;
|
||||
// console.log(this.next, this.prev);
|
||||
},
|
||||
prevV(){
|
||||
if(this.prev<1)
|
||||
return;
|
||||
this.next -=5
|
||||
this.prev -=5
|
||||
}
|
||||
}
|
||||
}
|
||||
prevV() {
|
||||
if (this.prev < 1) return;
|
||||
this.next -= 5;
|
||||
this.prev -= 5;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -2,7 +2,7 @@ import idb from '../api/idb';
|
||||
import getbible from '../api/getbible_v2_api';
|
||||
|
||||
export default {
|
||||
async add({commit}, payload){
|
||||
async add({ commit }, payload) {
|
||||
|
||||
// payload = {
|
||||
// abbreviation: '',
|
||||
@ -14,11 +14,11 @@ export default {
|
||||
commit('toggle_loading', true)
|
||||
const response = await getbible.get_translation(payload.abbreviation).catch(err => console.log(err))
|
||||
// console.log(response);
|
||||
if(!response) return;
|
||||
if (!response) return;
|
||||
|
||||
const data = await response.json().catch(err => console.log(err))
|
||||
// console.log(JSON.parse(data));
|
||||
if(!data) return;
|
||||
if (!data) return;
|
||||
let dataString = JSON.stringify(data)
|
||||
let savet = JSON.stringify(payload.saved_translations.putObj)
|
||||
// console.log(dataString);
|
||||
@ -31,18 +31,18 @@ export default {
|
||||
//save translation in indexdb
|
||||
success = await idb.save(payload.translation).catch(err => console.log(err));
|
||||
|
||||
if(!success)
|
||||
if (!success)
|
||||
return;
|
||||
|
||||
// then save the newly added translation details to the list of saved tr...s
|
||||
success = await idb.save(payload.saved_translations).catch(err => console.log(err));
|
||||
|
||||
if(!success) return;
|
||||
if (!success) return;
|
||||
|
||||
commit('add_translation', payload);
|
||||
commit('toggle_loading', false)
|
||||
},
|
||||
async remove({commit}, payload){
|
||||
async remove({ commit }, payload) {
|
||||
// payload example
|
||||
// payload = {
|
||||
// translation:{
|
||||
@ -55,63 +55,63 @@ export default {
|
||||
// }
|
||||
// }
|
||||
commit('toggle_loading', true)
|
||||
const {translation, saved_translations} = payload
|
||||
const { translation, saved_translations } = payload
|
||||
let success = false
|
||||
//save translation in indexdb
|
||||
success = await idb.delete(translation).catch(err => console.log(err));
|
||||
|
||||
if(!success)
|
||||
if (!success)
|
||||
return;
|
||||
|
||||
// then save the newly added translation details to the list of saved tr...s
|
||||
success = await idb.delete(saved_translations).catch(err => console.log(err));
|
||||
|
||||
|
||||
if(!success) return;
|
||||
if (!success) return;
|
||||
|
||||
commit('REMOVE_TRANSLATION', payload);
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
commit('toggle_loading', false)
|
||||
}, 1200)
|
||||
},
|
||||
async initialise({commit}){
|
||||
async initialise({ commit }) {
|
||||
commit('toggle_loading', true)
|
||||
let saved_translations = await idb.getAll('saved_translations').catch(err => console.log(err));
|
||||
console.log(saved_translations);
|
||||
if(!saved_translations) saved_translations = [];
|
||||
if (!saved_translations) saved_translations = [];
|
||||
|
||||
|
||||
let translations = await idb.getAll('translations').catch(err => console.log(err));
|
||||
|
||||
if(!translations || !translations.length) translations = [{}];
|
||||
if (!translations || !translations.length) translations = [{}];
|
||||
|
||||
commit('initialise', {saved_translations, translation: translations[0]})
|
||||
commit('initialise', { saved_translations, translation: translations[0] })
|
||||
|
||||
commit('toggle_loading', false)
|
||||
|
||||
},
|
||||
set_chapter({commit}, payload) {
|
||||
set_chapter({ commit }, payload) {
|
||||
commit('set_chapter', payload)
|
||||
},
|
||||
message({commit}, payload){
|
||||
message({ commit }, payload) {
|
||||
commit('message', payload)
|
||||
},
|
||||
set_book({commit}, payload) {
|
||||
set_book({ commit }, payload) {
|
||||
commit('set_book', payload)
|
||||
},
|
||||
async set_translation({commit}, payload){
|
||||
async set_translation({ commit }, payload) {
|
||||
commit('toggle_loading', true)
|
||||
let translation = await idb.get('translations', payload.selected_translation).catch(err => console.log(err));
|
||||
|
||||
if(!translation) return;
|
||||
if (!translation) return;
|
||||
payload.translation = translation
|
||||
commit('set_translation', payload)
|
||||
// console.log("from acitons", payload);
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
commit('toggle_loading', false)
|
||||
}, 2500)
|
||||
},
|
||||
search({commit}, payload){
|
||||
search({ commit }, payload) {
|
||||
commit('search', payload)
|
||||
}
|
||||
}
|
@ -2,67 +2,67 @@
|
||||
|
||||
export default {
|
||||
|
||||
chapter : (state) =>{
|
||||
chapter: (state) => {
|
||||
return state.selected.chapter
|
||||
},
|
||||
|
||||
book_nr : (state) =>{
|
||||
book_nr: (state) => {
|
||||
return state.selected.book
|
||||
},
|
||||
loading: (state) =>{
|
||||
loading: (state) => {
|
||||
return state.loading;
|
||||
},
|
||||
book_name:(state, getters)=> {
|
||||
if(!getters.books.length) return null
|
||||
book_name: (state, getters) => {
|
||||
if (!getters.books.length) return null
|
||||
let book = getters.books.find(book => book.nr === getters.book_nr)
|
||||
if(!book) return null;
|
||||
if (!book) return null;
|
||||
return book.name;
|
||||
},
|
||||
|
||||
translation: (state)=>{
|
||||
translation: (state) => {
|
||||
return state.selected.translation;
|
||||
},
|
||||
saved_translations: (state)=>{
|
||||
saved_translations: (state) => {
|
||||
return state.saved_translations;
|
||||
},
|
||||
in_memory_translation : (state) =>{
|
||||
in_memory_translation: (state) => {
|
||||
// console.log("from ", state.in_memory_translation );
|
||||
return state.in_memory_translation
|
||||
},
|
||||
|
||||
books : (state, getters)=>{
|
||||
if(!getters.in_memory_translation.books)
|
||||
books: (state, getters) => {
|
||||
if (!getters.in_memory_translation.books)
|
||||
return []
|
||||
debugger;
|
||||
return getters.in_memory_translation.books.map(book => ({nr: book.nr, name: book.name}))
|
||||
return getters.in_memory_translation.books.map(book => ({ nr: book.nr, name: book.name }))
|
||||
},
|
||||
|
||||
dir:(state, getters)=>{
|
||||
dir: (state, getters) => {
|
||||
// console.log(getters.in_memory_translation);
|
||||
if(!getters.in_memory_translation.direction)
|
||||
if (!getters.in_memory_translation.direction)
|
||||
return 'ltr'
|
||||
return getters.in_memory_translation.direction.toLowerCase();
|
||||
},
|
||||
search: (state)=>{
|
||||
search: (state) => {
|
||||
console.log(state.search);
|
||||
debugger;
|
||||
return state.search;
|
||||
},
|
||||
chapters : (state, getters) =>{
|
||||
chapters: (state, getters) => {
|
||||
console.log(getters.book_nr);
|
||||
debugger;
|
||||
if(!getters.book_nr) return [];
|
||||
if (!getters.book_nr) return [];
|
||||
const book = getters.in_memory_translation.books.find(book => book.nr == getters.book_nr)
|
||||
console.log("Found the book",book);
|
||||
console.log("Found the book", book);
|
||||
return book.chapters
|
||||
},
|
||||
|
||||
verses: (state, getters) => {
|
||||
// console.log("Searching for chapter", getters.chapter);
|
||||
if(!getters.chapter)
|
||||
if (!getters.chapter)
|
||||
return []
|
||||
const chapter = getters.chapters.find(chapter => chapter.chapter === getters.chapter)
|
||||
return chapter.verses;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
|
||||
|
||||
export default {
|
||||
add_translation (state, payload ) {
|
||||
add_translation(state, payload) {
|
||||
|
||||
state.saved_translations.push(payload.saved_translations.putObj)
|
||||
|
||||
},
|
||||
REMOVE_TRANSLATION (state, payload ) {
|
||||
REMOVE_TRANSLATION(state, payload) {
|
||||
|
||||
const {keyPath} = payload.saved_translations;
|
||||
const { keyPath } = payload.saved_translations;
|
||||
|
||||
state.saved_translations = state.saved_translations.filter(tr => tr.abbreviation !== keyPath)
|
||||
|
||||
if(state.in_memory_translation.abbreviation === keyPath){
|
||||
if (state.in_memory_translation.abbreviation === keyPath) {
|
||||
state.in_memory_translation = {}
|
||||
state.selected = {
|
||||
translation: null,
|
||||
@ -22,35 +22,35 @@ export default {
|
||||
}
|
||||
|
||||
},
|
||||
save_settings(state, settings){
|
||||
save_settings(state, settings) {
|
||||
state.settings = settings;
|
||||
localStorage.setItem('settings', JSON.stringify(settings))
|
||||
},
|
||||
add_search(state, search){
|
||||
add_search(state, search) {
|
||||
state.search = search
|
||||
},
|
||||
initialise(state, payload){
|
||||
initialise(state, payload) {
|
||||
state.saved_translations = payload.saved_translations
|
||||
state.in_memory_translation = payload.translation
|
||||
console.log(state.saved_translations);
|
||||
},
|
||||
set_chapter(state, payload){
|
||||
set_chapter(state, payload) {
|
||||
state.selected.chapter = payload;
|
||||
},
|
||||
set_book(state, payload){
|
||||
set_book(state, payload) {
|
||||
state.selected.chapter = null;
|
||||
state.selected.book = payload;
|
||||
},
|
||||
set_translation(state, payload){
|
||||
set_translation(state, payload) {
|
||||
state.selected.book = null
|
||||
state.selected.chapter = null
|
||||
state.selected.translation = payload.selected_translation;
|
||||
state.in_memory_translation = payload.translation;
|
||||
},
|
||||
toggle_loading(state, payload){
|
||||
toggle_loading(state, payload) {
|
||||
state.loading = payload;
|
||||
},
|
||||
search(state, payload){
|
||||
search(state, payload) {
|
||||
state.search = payload;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
export default {
|
||||
saved_translations: [],
|
||||
selected:{
|
||||
selected: {
|
||||
translation: null,
|
||||
book: null,
|
||||
chapter: null
|
||||
},
|
||||
loading: false,
|
||||
in_memory_translation:{},
|
||||
in_memory_translation: {},
|
||||
search: '',
|
||||
}
|
||||
}
|
@ -1,24 +1,24 @@
|
||||
export const isArray = function(a) {
|
||||
export const isArray = function (a) {
|
||||
return (!!a) && (a.constructor === Array);
|
||||
};
|
||||
|
||||
export const isObject = function(a) {
|
||||
export const isObject = function (a) {
|
||||
return (!!a) && (a.constructor === Object);
|
||||
};
|
||||
|
||||
export const isDate = function(o) {
|
||||
export const isDate = function (o) {
|
||||
return o instanceof Object && o.constructor === Date;
|
||||
}
|
||||
}
|
||||
|
||||
export const has = function(o,p){
|
||||
export const has = function (o, p) {
|
||||
let has = true
|
||||
for (const prop of p) {
|
||||
has = o.hasOwnProperty(prop)
|
||||
if(!has) break;
|
||||
if (!has) break;
|
||||
}
|
||||
return has;
|
||||
}
|
||||
export const querablePromise = function(promise) {
|
||||
export const querablePromise = function (promise) {
|
||||
// Don't modify any promise that has been already modified.
|
||||
if (promise.isPending) return promise;
|
||||
|
||||
@ -36,13 +36,13 @@ export const querablePromise = function(promise) {
|
||||
// We must actually wait for the promise to either resolve or reject,
|
||||
// wrap that value, then let it continue on.
|
||||
const result = promise.then(
|
||||
function(val) {
|
||||
function (val) {
|
||||
state.isResolved = true;
|
||||
state.isPending = false;
|
||||
state.val = val;
|
||||
return val;
|
||||
},
|
||||
function(err) {
|
||||
function (err) {
|
||||
state.isRejected = true;
|
||||
state.isPending = false;
|
||||
state.err = err;
|
||||
@ -51,8 +51,8 @@ export const querablePromise = function(promise) {
|
||||
);
|
||||
|
||||
for (const val of Object.keys(state)) {
|
||||
result[val] = function() { return state[val]; };
|
||||
result[val] = function () { return state[val]; };
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user