Skip to content

Commit

Permalink
sort book names
Browse files Browse the repository at this point in the history
  • Loading branch information
fawazahmed0 committed Apr 7, 2024
1 parent deebb58 commit 0412c62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions generatehadith.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ async function test() {
let isocodes = await getJSON('isocodes/iso-codes', quranLinks)
let hadithPath = saveDir

let sortedEditionsArr = ['bukhari', 'muslim', 'nasai', 'abudawud', 'tirmidhi', 'ibnmajah', 'malik']
let sortedEditionsJSON = {}
sortedEditionsArr.concat(Object.keys(editionsJSON)).forEach(editionName=>sortedEditionsJSON[editionName]=editionsJSON[editionName])
editionsJSON=sortedEditionsJSON

// create books index i.e list of books available
let pathToSave = path.join(hadithPath,`index.html`)
let dataToSave = `<ul class="list-group">${Object.entries(editionsJSON).map( e =>`<li class="list-group-item"><a href="${e[0]}">${e[1].name}</a></li>`).join('')}</ul>`
Expand Down
6 changes: 6 additions & 0 deletions template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ async function ready() {
window.showSpinningWheel('#mycontainer','beforeend')

let data = await window.getJSON('editions');

let sortedEditionsArr = ['bukhari', 'muslim', 'nasai', 'abudawud', 'tirmidhi', 'ibnmajah', 'malik']
let sortedEditionsJSON = {}
sortedEditionsArr.concat(Object.keys(data)).forEach(editionName=>sortedEditionsJSON[editionName]=data[editionName])
data=sortedEditionsJSON

let bigUL = getElement('ul', { class: 'list-group' })
let count = 0
for (let [key, value] of Object.entries(data)) {
Expand Down

0 comments on commit 0412c62

Please sign in to comment.