Closed bksubhuti closed 4 years ago
I fixed the live translate which was thought of as a bug by sri lanka monks.. but cannot get the jstree to refill see discord. It works on index.htm loading. but not onselectchange() in prefs want to call this code somehow..don't know how.
```
const setBookInfo = (rawBookMetaData) => { const structuredData = JSON.parse(rawBookMetaData).books;
for (const book of structuredData) { for (const set of book.sets) { for (const text of set.texts) { const extraInfo = {set: set.name, book: book.name}; bookData.flat[text.bookId] = Object.assign(extraInfo, text); } } } const treeData = structuredData.map(sd => { return { text: toTranslate(sd.name), children: sd.sets.map(set => { return { text: toTranslate(set.name), children: set.texts.map(text => { return { text: toTranslate(text.title), icon: 'images/text.png', data: text } }) } }) } }); $('#books-tree').jstree({core: {data: treeData}}); $('#books-tree').on('select_node.jstree', (event, data) => { if (data && data.node && data.node.data) { // this is actual text const bookInfo = data.node.data; PaliHistoryGoUrl(bookInfo.bookId + "#p1"); } else { // this is an expandable entity (e.g. a book) // data.instance.toggle_node(data.selected); } }); };
verified as fixed
I fixed the live translate which was thought of as a bug by sri lanka monks.. but cannot get the jstree to refill see discord. It works on index.htm loading. but not onselectchange() in prefs want to call this code somehow..don't know how.
const setBookInfo = (rawBookMetaData) => { const structuredData = JSON.parse(rawBookMetaData).books;