mirror of
https://github.com/getbible/app.git
synced 2024-06-10 14:22:21 +00:00
Removed static web urls and fixed some issues
This commit is contained in:
parent
195eec66b1
commit
10c4e1e6c5
|
@ -4,6 +4,8 @@
|
||||||
let BASE_URL = 'https://getbible.net';
|
let BASE_URL = 'https://getbible.net';
|
||||||
let API_VERSION = 'v2';
|
let API_VERSION = 'v2';
|
||||||
|
|
||||||
|
export { BASE_URL, API_VERSION };
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
get_translations(){
|
get_translations(){
|
||||||
|
|
|
@ -27,6 +27,21 @@ export default {
|
||||||
let db = e.target.result;
|
let db = e.target.result;
|
||||||
db.createObjectStore("saved_translations", { keyPath:'abbreviation' });
|
db.createObjectStore("saved_translations", { keyPath:'abbreviation' });
|
||||||
db.createObjectStore("translations", { keyPath:'abbreviation' });
|
db.createObjectStore("translations", { keyPath:'abbreviation' });
|
||||||
|
|
||||||
|
// let index = translations.createIndex('book_idx', 'name');
|
||||||
|
// let transaction = db.transaction("books"); // readonly
|
||||||
|
// let books = transaction.objectStore("books");
|
||||||
|
// let bookIndex = translations.index("book_idx");
|
||||||
|
|
||||||
|
// let request = bookIndex.getAll("Genesis");
|
||||||
|
|
||||||
|
// request.onsuccess = function() {
|
||||||
|
// if (request.result !== undefined) {
|
||||||
|
// console.log("Books", request.result); // array of books with name="Genesis"
|
||||||
|
// } else {
|
||||||
|
// console.log("No such books");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -134,50 +149,50 @@ export default {
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async search(name, keyPath) {
|
// async search(name, keyPath) {
|
||||||
|
|
||||||
let db = await this.getDb();
|
// let db = await this.getDb();
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
let trans = db.transaction([name],'readonly');
|
// let trans = db.transaction([name],'readonly');
|
||||||
trans.oncomplete = () => {
|
// trans.oncomplete = () => {
|
||||||
resolve(tr);
|
// resolve(tr);
|
||||||
};
|
// };
|
||||||
|
|
||||||
let store = trans.objectStore(name);
|
// let store = trans.objectStore(name);
|
||||||
let tr = {};
|
// let tr = {};
|
||||||
|
|
||||||
store.openCursor().onsuccess = e => {
|
// store.openCursor().onsuccess = e => {
|
||||||
let cursor = e.target.result;
|
// let cursor = e.target.result;
|
||||||
if (cursor) {
|
// if (cursor) {
|
||||||
if (keyPath == cursor.value.keyPath){
|
// if (keyPath == cursor.value.keyPath){
|
||||||
tr = cursor.value
|
// tr = cursor.value
|
||||||
for (const book in cursor.value.books) {
|
// for (const book in cursor.value.books) {
|
||||||
for (const chapters in book) {
|
// for (const chapters in book) {
|
||||||
for (const verses in chapters) {
|
// for (const verses in chapters) {
|
||||||
for (const verse in verses) {
|
// for (const verse in verses) {
|
||||||
if(verse.text.includes(keyPath)){
|
// if(verse.text.includes(keyPath)){
|
||||||
console.log("We found a row with value: " + JSON.stringify(verse.text));
|
// console.log("We found a row with value: " + JSON.stringify(verse.text));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
cursor.continue();
|
// cursor.continue();
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
trans.onerror = e => {
|
// trans.onerror = e => {
|
||||||
reject(e)
|
// reject(e)
|
||||||
}
|
// }
|
||||||
trans.onabort = e => {
|
// trans.onabort = e => {
|
||||||
reject(e)
|
// reject(e)
|
||||||
}
|
// }
|
||||||
trans.commit();
|
// trans.commit();
|
||||||
|
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
|
||||||
}
|
}
|
|
@ -11,7 +11,8 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import {mapGetters} from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
|
import { BASE_URL, API_VERSION } from '../api/getbible_v2_api'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components:{
|
components:{
|
||||||
|
@ -63,7 +64,7 @@ export default {
|
||||||
headers: {'Access-Control-Allow-Origin': '*'}
|
headers: {'Access-Control-Allow-Origin': '*'}
|
||||||
};
|
};
|
||||||
|
|
||||||
let url = `https://getbible.net/v2/${this.translation}/${this.book}/${this.chapter_num}.json`
|
let url = `${BASE_URL}/${API_VERSION}/${this.translation}/${this.book}/${this.chapter_num}.json`
|
||||||
|
|
||||||
let response = await fetch(url, config).catch(function(err) {
|
let response = await fetch(url, config).catch(function(err) {
|
||||||
this.chapter = err
|
this.chapter = err
|
||||||
|
@ -98,7 +99,7 @@ export default {
|
||||||
this.loading =true
|
this.loading =true
|
||||||
this.progress =25
|
this.progress =25
|
||||||
this.message = 'Loading...'
|
this.message = 'Loading...'
|
||||||
let url = `https://getbible.net/v2/${this.translation}/books.json`
|
let url = `${BASE_URL}/${API_VERSION}/${this.translation}/books.json`
|
||||||
fetch(url,config)
|
fetch(url,config)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
@ -117,7 +118,7 @@ export default {
|
||||||
let config = {
|
let config = {
|
||||||
headers: {'Access-Control-Allow-Origin': '*'}
|
headers: {'Access-Control-Allow-Origin': '*'}
|
||||||
};
|
};
|
||||||
fetch(`https://getbible.net/v2/${this.translation}/${this.book}/chapters.json`,config)
|
fetch(`${BASE_URL}/${API_VERSION}/${this.translation}/${this.book}/chapters.json`,config)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
// console.log(data)
|
// console.log(data)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<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 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 translation added. <br/>Please click <a @click="open_settings">HERE</a> to Open Settings</div>
|
<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>
|
<div v-else>
|
||||||
|
|
||||||
<ul class="uk-nav-default uk-nav-parent-icon uk-witdth-1-1 " uk-nav="multiple: false" >
|
<ul class="uk-nav-default uk-nav-parent-icon uk-witdth-1-1 " uk-nav="multiple: false" >
|
||||||
|
|
|
@ -3,34 +3,10 @@
|
||||||
export default {
|
export default {
|
||||||
add_translation (state, payload ) {
|
add_translation (state, payload ) {
|
||||||
|
|
||||||
// payload = {
|
|
||||||
// translation:{
|
|
||||||
// name: 'translation',
|
|
||||||
// putObj: {}
|
|
||||||
// },
|
|
||||||
// saved_translations:{
|
|
||||||
// name: 'saved_translation',
|
|
||||||
// putObj: {}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
state.saved_translations.push(payload.saved_translations.putObj)
|
state.saved_translations.push(payload.saved_translations.putObj)
|
||||||
|
|
||||||
},
|
},
|
||||||
REMOVE_TRANSLATION (state, payload ) {
|
REMOVE_TRANSLATION (state, payload ) {
|
||||||
// payload example
|
|
||||||
// payload = {
|
|
||||||
// translation:{
|
|
||||||
// name: 'translation',
|
|
||||||
// keyPath: 'aksjv'
|
|
||||||
// },
|
|
||||||
// saved_translations:{
|
|
||||||
// name: 'saved_translation',
|
|
||||||
// keyPath: "askjv"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
const {keyPath} = payload.saved_translations;
|
const {keyPath} = payload.saved_translations;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user