mirror of
https://github.com/LucasVbr/own-workspace.git
synced 2026-05-13 17:21:58 +00:00
Merge pull request #7 from LucasVbr/master
Add 50 Lo-fi musics and translate #btn-newword
This commit is contained in:
+61
-41
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="btn-newword">
|
<div id="btn-newword">
|
||||||
<button @click="getNewWordEveryday" id="fetch" class="btn">
|
<button @click="getNewWordEveryday" id="fetch" class="btn">
|
||||||
Générer un mot
|
Generate a word
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -30,9 +30,9 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
Total todo: {{this.nbItemsFinished}}
|
Total todo: {{ this.nbItemsFinished }}
|
||||||
<br>
|
<br>
|
||||||
Total sessions: {{this.$store.getters.nbSessions}}
|
Total sessions: {{ this.$store.getters.nbSessions }}
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<button class="btn" id="see-words" @click="displayWord = true">
|
<button class="btn" id="see-words" @click="displayWord = true">
|
||||||
English word
|
English word
|
||||||
@@ -46,17 +46,17 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Stats",
|
name: 'Stats',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
date: "",
|
date: '',
|
||||||
time: "",
|
time: '',
|
||||||
word: {
|
word: {
|
||||||
word: "",
|
word: '',
|
||||||
definition: "",
|
definition: '',
|
||||||
},
|
},
|
||||||
displayWord: true,
|
displayWord: true,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
generateDateOfTheDay() {
|
generateDateOfTheDay() {
|
||||||
@@ -69,9 +69,28 @@ export default {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
prettyPrintDate(date, day, month) {
|
prettyPrintDate(date, day, month) {
|
||||||
const days = ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"];
|
const days = [
|
||||||
|
'Dimanche',
|
||||||
|
'Lundi',
|
||||||
|
'Mardi',
|
||||||
|
'Mercredi',
|
||||||
|
'Jeudi',
|
||||||
|
'Vendredi',
|
||||||
|
'Samedi'];
|
||||||
const dayOfTheWeek = days[date.getDay()];
|
const dayOfTheWeek = days[date.getDay()];
|
||||||
const months = ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"];
|
const months = [
|
||||||
|
'janvier',
|
||||||
|
'février',
|
||||||
|
'mars',
|
||||||
|
'avril',
|
||||||
|
'mai',
|
||||||
|
'juin',
|
||||||
|
'juillet',
|
||||||
|
'août',
|
||||||
|
'septembre',
|
||||||
|
'octobre',
|
||||||
|
'novembre',
|
||||||
|
'décembre'];
|
||||||
return `${dayOfTheWeek}, ${day} ${months[month - 1]}`;
|
return `${dayOfTheWeek}, ${day} ${months[month - 1]}`;
|
||||||
},
|
},
|
||||||
getCurrentTime() {
|
getCurrentTime() {
|
||||||
@@ -84,37 +103,37 @@ export default {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
prettyPrintTime(hours, minutes) {
|
prettyPrintTime(hours, minutes) {
|
||||||
return `${hours < 10 ? "0" + hours : hours}:${minutes < 10 ? "0" + minutes : minutes}`;
|
return `${hours < 10 ? '0' + hours : hours}:${minutes < 10 ?
|
||||||
|
'0' + minutes :
|
||||||
|
minutes}`;
|
||||||
},
|
},
|
||||||
getNewWordEveryday() {
|
getNewWordEveryday() {
|
||||||
document.getElementById("fetch").disabled = true;
|
document.getElementById('fetch').disabled = true;
|
||||||
// fetch a new english word everyday
|
// fetch a new english word everyday
|
||||||
fetch("https://random-word-api.herokuapp.com/word?number=1")
|
fetch('https://random-word-api.herokuapp.com/word?number=1').
|
||||||
.then(response => response.json())
|
then(response => response.json()).
|
||||||
.then(data => {
|
then(data => {
|
||||||
// uppercase first letter of data[0]
|
// uppercase first letter of data[0]
|
||||||
const word = data[0];
|
const word = data[0];
|
||||||
this.getDefinition(word);
|
this.getDefinition(word);
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
getDefinition(word) {
|
getDefinition(word) {
|
||||||
const url = 'https://api.dictionaryapi.dev/api/v2/entries/en/' + word;
|
const url = 'https://api.dictionaryapi.dev/api/v2/entries/en/' + word;
|
||||||
return fetch(url)
|
return fetch(url).then(response => response.json()).then(data => {
|
||||||
.then(response => response.json())
|
if (data.length > 0) {
|
||||||
.then(data => {
|
document.getElementById('fetch').disabled = false;
|
||||||
if (data.length > 0) {
|
const wordUppercased = word.charAt(0).toUpperCase() + word.slice(1);
|
||||||
document.getElementById("fetch").disabled = false;
|
this.word.word = wordUppercased + ' : ';
|
||||||
const wordUppercased = word.charAt(0).toUpperCase() + word.slice(1);
|
this.word.definition = data[0].meanings[0].definitions[0].definition;
|
||||||
this.word.word = wordUppercased + " : ";
|
} else {
|
||||||
this.word.definition = data[0].meanings[0].definitions[0].definition;
|
// get another word if the word is not found
|
||||||
} else {
|
this.getNewWordEveryday();
|
||||||
// get another word if the word is not found
|
}
|
||||||
this.getNewWordEveryday();
|
}).catch(error => {
|
||||||
}
|
console.log(error);
|
||||||
}).catch(error => {
|
});
|
||||||
console.log(error);
|
},
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.generateDateOfTheDay();
|
this.generateDateOfTheDay();
|
||||||
@@ -130,16 +149,16 @@ export default {
|
|||||||
},
|
},
|
||||||
colorSelected() {
|
colorSelected() {
|
||||||
return this.$store.getters.colorSelected;
|
return this.$store.getters.colorSelected;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
colorSelected: function(color) {
|
colorSelected: function(color) {
|
||||||
if (this.displayWord) {
|
if (this.displayWord) {
|
||||||
document.getElementById("word").style.color = color;
|
document.getElementById('word').style.color = color;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -200,6 +219,7 @@ export default {
|
|||||||
#see-words {
|
#see-words {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********** */
|
/* ********** */
|
||||||
/* RESPONSIVE */
|
/* RESPONSIVE */
|
||||||
/* ********** */
|
/* ********** */
|
||||||
|
|||||||
+52
-1
@@ -5,7 +5,58 @@
|
|||||||
"7NOSDKb0HlU",
|
"7NOSDKb0HlU",
|
||||||
"-5KAN9_CzSA",
|
"-5KAN9_CzSA",
|
||||||
"jfKfPfyJRdk",
|
"jfKfPfyJRdk",
|
||||||
"GDQnA1LVCWA"
|
|
||||||
|
"GDQnA1LVCWA",
|
||||||
|
"-pzxY5DtZIQ",
|
||||||
|
"Mu3BfD6wmPg",
|
||||||
|
"guhAfOxt5gg",
|
||||||
|
"XoX6zS5-jOY",
|
||||||
|
"doxeMNXYFqk",
|
||||||
|
"kHI9hnC-pnI",
|
||||||
|
"RY89j1qdKvo",
|
||||||
|
"pIOZVb97dSk",
|
||||||
|
"eEXEEuSLjEo",
|
||||||
|
"Bksv9OEj1j8",
|
||||||
|
"nXKDQflDgTo",
|
||||||
|
"gl5DYoxkI20",
|
||||||
|
"Lsr7bJk4zAY",
|
||||||
|
"wVgj3o9k7eY",
|
||||||
|
"YqcN2xmPngc",
|
||||||
|
"-0o37zLDsWo",
|
||||||
|
"0h6a07yVacY",
|
||||||
|
"l9QSIDvbVos",
|
||||||
|
"iH7bdQxXlJI",
|
||||||
|
"T_QWejmgwGg",
|
||||||
|
"yumRWK7XuR4",
|
||||||
|
"4X_uoKF2Wvo",
|
||||||
|
"ozS8auVro70",
|
||||||
|
"uP2X50NrKHQ",
|
||||||
|
"1sPZhg-30ao",
|
||||||
|
"q4V5cvQWWeY",
|
||||||
|
"mjoXkcdGPTM",
|
||||||
|
"XyN-LascAL0",
|
||||||
|
"nV8eAWmVEk4",
|
||||||
|
"yBOv-4ndFGw",
|
||||||
|
"XcUoDrI2BwU",
|
||||||
|
"8NRAOg1c2l0",
|
||||||
|
"XGn4_-ylcaI",
|
||||||
|
"IauSZrpfgLI",
|
||||||
|
"iunocgt3c3E",
|
||||||
|
"J7w58QcrSDc",
|
||||||
|
"4722D_KdAa0",
|
||||||
|
"Fd-2C-ue0h4",
|
||||||
|
"Yu8-JBPhNr8",
|
||||||
|
"zEOnXL9Jo0A",
|
||||||
|
"rRKZ9XAXDKg",
|
||||||
|
"Vjzs4M0wAV0",
|
||||||
|
"4uCNdTiB4Us",
|
||||||
|
"EwREEj3UZT8",
|
||||||
|
"uVem4rbFVrE",
|
||||||
|
"ArqZ1dnXpYs",
|
||||||
|
"UPMgJeYsOLo",
|
||||||
|
"SNq9pPG-Qn0",
|
||||||
|
"BYyPga-3g3k",
|
||||||
|
"h2Hl1uNwDz4"
|
||||||
],
|
],
|
||||||
"easterEggs": [
|
"easterEggs": [
|
||||||
"VDgaKWRuhRU",
|
"VDgaKWRuhRU",
|
||||||
|
|||||||
Reference in New Issue
Block a user