2020-10-24 00:32:55 +00:00
|
|
|
<template>
|
|
|
|
<nav class="uk-navbar-container uk-navbar-transparent uk-margin" uk-navbar>
|
|
|
|
<div class="uk-navbar-left">
|
|
|
|
|
|
|
|
<a class="uk-navbar-item uk-logo" href="#">GetBible</a>
|
|
|
|
|
|
|
|
<div class="uk-navbar-item">
|
|
|
|
<form class="uk-search uk-search-default" action="javascript:void(0)">
|
|
|
|
<span uk-search-icon></span>
|
2020-10-26 12:33:27 +00:00
|
|
|
<input class="uk-search-input" v-model="search" type="search" placeholder="Search Chapter...">
|
2020-10-24 00:32:55 +00:00
|
|
|
</form>
|
2020-10-26 14:50:29 +00:00
|
|
|
|
2020-10-24 00:32:55 +00:00
|
|
|
</div>
|
2020-10-26 14:50:29 +00:00
|
|
|
|
2020-10-24 00:32:55 +00:00
|
|
|
<!-- <span class="uk-label uk-label-primary"><span class="uk-badge uk-badge-danger">{{ num_of_tr}} </span>Translations Available</span> -->
|
|
|
|
|
|
|
|
</div>
|
2020-10-26 14:50:29 +00:00
|
|
|
<a class="uk-navbar-item uk-position-center-right" href="#modal-sections" uk-toggle><span uk-icon="icon: cog; ratio:2"></span></a>
|
|
|
|
|
|
|
|
<div id="modal-sections" uk-modal>
|
|
|
|
<div class="uk-modal-dialog">
|
|
|
|
<button class="uk-modal-close-default" type="button" uk-close></button>
|
|
|
|
<div class="uk-modal-header">
|
|
|
|
<h2 class="uk-modal-title">Settings</h2>
|
|
|
|
</div>
|
|
|
|
<div class="uk-modal-body">
|
|
|
|
<div class="uk-margin">
|
|
|
|
<h3>Saved Translations</h3>
|
|
|
|
<div>
|
|
|
|
<ul class="uk-list uk-list-large uk-list-divider">
|
2020-10-26 19:00:09 +00:00
|
|
|
<li
|
|
|
|
v-for="(tr,i) in Object.keys(savedTranslations)"
|
|
|
|
:key="i"
|
|
|
|
><div><span>{{savedTranslations[tr]["language"]?`(${savedTranslations[tr]["language"]})`:null}} {{savedTranslations[tr]['translation']}}</span> <a class="uk-position-center-right uk-position-relative"><span uk-icon="icon: minus-circle;"></span></a>
|
|
|
|
</div> </li>
|
|
|
|
|
2020-10-26 14:50:29 +00:00
|
|
|
<li>
|
|
|
|
<div uk-form-custom="target: > * > span:first-child">
|
|
|
|
<select>
|
|
|
|
<option value="">Add Translation...</option>
|
2020-10-26 19:00:09 +00:00
|
|
|
<option
|
|
|
|
v-for="(tr,i) in Object.keys(translations)"
|
|
|
|
:key="i"
|
|
|
|
:value="tr"
|
|
|
|
>{{translations[tr]["language"]?`(${translations[tr]["language"]})`:null}} {{translations[tr]['translation']}}
|
|
|
|
</option>
|
2020-10-26 14:50:29 +00:00
|
|
|
</select>
|
|
|
|
<button class="uk-button uk-button-default" type="button" tabindex="-1">
|
|
|
|
<span></span>
|
|
|
|
<span uk-icon="icon: chevron-down"></span>
|
|
|
|
</button>
|
|
|
|
</div>
|
2020-10-26 19:00:09 +00:00
|
|
|
<a><span uk-icon="icon: plus-circle; ratio:2"></span></a>
|
2020-10-26 14:50:29 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="uk-modal-footer uk-text-right">
|
|
|
|
<button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
|
|
|
|
<button class="uk-button uk-button-primary" type="button">Save</button>
|
2020-10-26 19:00:09 +00:00
|
|
|
</div>
|
2020-10-26 14:50:29 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-26 19:00:09 +00:00
|
|
|
|
2020-10-24 00:32:55 +00:00
|
|
|
</nav>
|
2020-10-26 14:50:45 +00:00
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data: () => {
|
|
|
|
return {
|
|
|
|
translations: {},
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
2020-10-26 19:00:09 +00:00
|
|
|
computed: {
|
|
|
|
savedTranslations() {
|
|
|
|
let o = {}
|
|
|
|
let counter = 0
|
|
|
|
for(const tr in this.translations){
|
|
|
|
if(counter>2)
|
|
|
|
break;
|
|
|
|
o = {...o, [tr]:this.translations[tr]}
|
|
|
|
counter +=1
|
|
|
|
// Object.assign({}, o,{[tr]: this.translations[tr]})
|
|
|
|
}
|
|
|
|
console.log(o);
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
},
|
2020-10-26 14:50:45 +00:00
|
|
|
async created(){
|
|
|
|
let config = {
|
|
|
|
headers: {'Access-Control-Allow-Origin': '*'}
|
|
|
|
};
|
2020-10-26 19:00:09 +00:00
|
|
|
let response = await fetch(`https://getbible.net/v2/translations.json`,config)
|
2020-10-26 14:50:45 +00:00
|
|
|
.catch(function(err) { this.translations = err });
|
|
|
|
|
|
|
|
if(!response)
|
|
|
|
return;
|
|
|
|
|
2020-10-26 19:00:09 +00:00
|
|
|
let data = await response.json().catch(err => {console.log(err);})
|
2020-10-26 14:50:45 +00:00
|
|
|
|
|
|
|
if(!data)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.translations = data
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|