54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
/******/ (() => { // webpackBootstrap
|
|
var __webpack_exports__ = {};
|
|
/*!*********************!*\
|
|
!*** ./src/view.js ***!
|
|
\*********************/
|
|
// NO NEEDED ANYMORE BECAUSE DIRECTLY UPDATED BY PHP
|
|
|
|
// async function updateWordsDefinitions() {
|
|
// const vocabularySummary = document.querySelector("#vocabulaire-summary");
|
|
// let tooltipWordsDefinition = vocabularySummary.querySelectorAll("details");
|
|
|
|
// const vocabulairesPostsIds = Array.from(tooltipWordsDefinition).map(
|
|
// (element) => element.getAttribute("data-definition-id"),
|
|
// );
|
|
|
|
// try {
|
|
// const tooltipData = await getTooltipsDatas(vocabulairesPostsIds);
|
|
|
|
// tooltipWordsDefinition.forEach((word, index) => {
|
|
// const foundTooltipDatas = tooltipData.find(
|
|
// (tooltip) =>
|
|
// tooltip.id === parseInt(word.getAttribute("data-definition-id")),
|
|
// );
|
|
|
|
// const definitionText = word.querySelector(
|
|
// ".homegrade-blocks-vocabulaire-summary__content",
|
|
// );
|
|
// definitionText.textContent = foundTooltipDatas.acf.definition;
|
|
// });
|
|
// } catch (error) {
|
|
// console.log("Something went wrong!", error);
|
|
// }
|
|
// }
|
|
|
|
// async function getTooltipsDatas(vocabulairesPostsIds) {
|
|
// try {
|
|
// const response = await fetch(
|
|
// `/wp-json/wp/v2/vocabulaire?include=${vocabulairesPostsIds.toString()}`,
|
|
// );
|
|
// if (!response.ok) {
|
|
// throw new Error(`Request failed with status: ${response.status}`);
|
|
// }
|
|
// const data = await response.json();
|
|
// return data;
|
|
// } catch (err) {
|
|
// throw err;
|
|
// }
|
|
// }
|
|
// window.addEventListener("DOMContentLoaded", (event) => {
|
|
// updateWordsDefinitions();
|
|
// });
|
|
/******/ })()
|
|
;
|
|
//# sourceMappingURL=view.js.map
|