Skip to content

Commit

Permalink
updated API version, changed split delimeter
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan committed Nov 30, 2024
1 parent 62a30b1 commit 9266fe3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/components/display/verses/SingleArabicVerse.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import Spinner from '$svgs/Spinner.svelte';
import { fetchSingleVerseData } from '$utils/fetchData';
import { __fontType } from '$utils/stores';
import { splitDelimeter } from '$data/websiteSettings';
$: fontType = [1, 2, 3].includes($__fontType) ? 1 : 4;
$: fetchData = fetchSingleVerseData(key, fontType);
Expand All @@ -13,7 +14,7 @@
<Spinner size="10" />
{:then data}
<div class="direction-rtl text-3xl leading-normal arabic-font-{fontType}">
{data[key].words.arabic.split('|').join(' ')}
{data[key].words.arabic.split(splitDelimeter).join(' ')}
{data[key].words.end}
</div>
{:catch error}
Expand Down
10 changes: 5 additions & 5 deletions src/components/display/verses/Word.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
import { supplicationsFromQuran } from '$data/quranMeta';
import { __currentPage, __fontType, __displayType, __userSettings, __audioSettings, __wordTranslation, __wordTranslationEnabled, __wordTransliterationEnabled, __morphologyKey, __wordTooltip, __verseKey, __websiteTheme, __hideNonDuaPart } from '$utils/stores';
// import { tajweedRulings, tajweedColorIds } from '$data/tajweedRulings';
import { apiEndpoint } from '$data/websiteSettings';
import { apiEndpoint, splitDelimeter } from '$data/websiteSettings';
const chapter = key.split(':')[0];
const verse = key.split(':')[1];
const wordKey = `${chapter}:${verse}:${word + 1}`;
const fontSizes = JSON.parse($__userSettings).displaySettings.fontSizes;
const arabicSplit = value.words.arabic.split('|');
const transliterationSplit = value.words.transliteration.split('|');
const translationSplit = value.words.translation.split('|');
const arabicSplit = value.words.arabic.split(splitDelimeter);
const transliterationSplit = value.words.transliteration.split(splitDelimeter);
const translationSplit = value.words.translation.split(splitDelimeter);
const v4PopoverEnabled = false;
// fix for Ba'da Ma Ja'aka for page 254
Expand Down Expand Up @@ -66,7 +66,7 @@
}
</script>

{#if $__currentPage != 'mushaf' || ($__currentPage === 'mushaf' && +value.words.line.split('|')[word] === line)}
{#if $__currentPage != 'mushaf' || ($__currentPage === 'mushaf' && +value.words.line.split(splitDelimeter)[word] === line)}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div id={wordKey} class={wordDivClasses} on:click={() => wordClickHandler({ key: wordKey, type: 'word' })}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<!-- ================== -->

<!-- data from Quran.com's API -->
<!-- after transliteration, show other translations -->
{#if $__verseTranslationData[value.meta.verse - 1].hasOwnProperty('translations')}
<!-- after transliteration, show other translations -->
{#each Object.entries($__verseTranslationData[Object.keys($__verseTranslationData)[value.meta.verse - 1]].translations) as [verseTranslationID, verseTranslation]}
{#if verseTranslation.resource_id !== 57}
<Layout verseTranslationID={verseTranslation.resource_id} {verseTranslation} {value} />
Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/HomepageTabs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import { checkTimeSpecificChapters } from '$utils/checkTimeSpecificChapters';
import { term } from '$utils/terminologies';
import { fetchSingleVerseData } from '$utils/fetchData';
import { splitDelimeter } from '$data/websiteSettings';
// CSS classes for chapter cards and tabs
const cardGridClasses = 'grid md:grid-cols-2 lg:grid-cols-3 gap-3';
Expand Down Expand Up @@ -200,7 +201,7 @@
{#if activeTab === 3 && totalBookmarks !== 0}
<div class="text-sm opacity-70 truncate direction-rtl text-right arabic-font-1">
{#await fetchData then data}
{data[bookmark].words.arabic.split('|').join(' ')}
{data[bookmark].words.arabic.split(splitDelimeter).join(' ')}
{:catch error}
<p></p>
{/await}
Expand Down
6 changes: 4 additions & 2 deletions src/data/websiteSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export const websiteTitle = `Quran ${websiteTagline} - ${websiteURL}`;

export const wbwLanguages = 'English, Urdu, Hindi, Indonesian, Bangla, Turkish, Tamil, French, German, Russian, Ingush, Chinese, Malayalam, Divehi and Persian';

export const apiEndpoint = 'https://api.quranwbw.com/v1';
// export const apiEndpoint = 'https://api.quranwbw.com/v1';
// export const apiEndpoint = 'http://localhost:7500/v1';

export const staticEndpoint = 'https://static.quranwbw.com/data';

export const apiVersion = 108;
export const apiVersion = 109;

export const wordsAudioURL = 'https://audios.quranwbw.com/words';

Expand All @@ -22,3 +22,5 @@ export const mushafHeaderFontLink = 'https://v4.quranwbw.com/fonts/chapter-heade
export const mushafFontVersion = 4;

export const errorLoadingDataMessage = 'Sorry, there was an error while loading the data. Please refresh the page and try again.';

export const splitDelimeter = '||';
5 changes: 3 additions & 2 deletions src/routes/page/[page]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { selectableFontTypes } from '$data/options';
import { loadFont } from '$utils/loadFont';
import { toggleMushafMinimalMode } from '$utils/toggleMushafMinimalMode';
import { splitDelimeter } from '$data/websiteSettings';
import '$lib/swiped-events.min.js';
// Lines to be centered instead of justified
Expand Down Expand Up @@ -54,7 +55,7 @@
const apiData = data.data.verses;
localStorage.setItem('pageData', JSON.stringify(apiData));
startingLine = apiData[Object.keys(apiData)[0]].words.line.split('|')[0];
startingLine = apiData[Object.keys(apiData)[0]].words.line.split(splitDelimeter)[0];
endingLine = apiData[Object.keys(apiData)[Object.keys(apiData).length - 1]].words.end_line;
// Get chapter numbers
Expand All @@ -77,7 +78,7 @@
// Get line numbers for chapters
chapters.forEach((chapter, index) => {
lines.push(+apiData[`${chapter}:${verses[index]}`].words.line.split('|')[0]);
lines.push(+apiData[`${chapter}:${verses[index]}`].words.line.split(splitDelimeter)[0]);
});
// Set the mushaf page divisions
Expand Down

0 comments on commit 9266fe3

Please sign in to comment.