Skip to content

Instantly share code, notes, and snippets.

@saveroo
Forked from iBasit/tajweed-javascript.js
Created September 26, 2019 18:42
Show Gist options
  • Save saveroo/cf444bb4423914d4213423c6618415b6 to your computer and use it in GitHub Desktop.
Save saveroo/cf444bb4423914d4213423c6618415b6 to your computer and use it in GitHub Desktop.
each css class name is basically a color: #53533 coding
/**
* parse the tajweed text
* @param quranBy
* @param object verseObject {surah: 2, ayah: 4, verse: 'verse text here..'}
* @returns {String}
*/
parseTajweed: function (quranBy, verseObject)
{
var text = verseObject.verse;
text = text.replace(/\[h/g, '<span class="ham_wasl" title="Hamzat Wasl" alt="').replace(/\[s/g, '<span class="slnt" title="Silent" alt="').replace(/\[l/g, '<span class="slnt" title="Lam Shamsiyyah" alt="').replace(/\[n/g, '<span class="madda_normal" title="Normal Prolongation: 2 Vowels" alt="').replace(/\[p/g, '<span class="madda_permissible" title="Permissible Prolongation: 2, 4, 6 Vowels" alt="').replace(/\[m/g, '<span class="madda_necessary" title="Necessary Prolongation: 6 Vowels" alt="').replace(/\[q/g, '<span class="qlq" title="Qalqalah" alt="').replace(/\[o/g, '<span class="madda_obligatory" title="Obligatory Prolongation: 4-5 Vowels" alt="').replace(/\[c/g, '<span class="ikhf_shfw" title="Ikhfa\' Shafawi - With Meem" alt="').replace(/\[f/g, '<span class="ikhf" title="Ikhfa\'" alt="').replace(/\[w/g, '<span class="idghm_shfw" title="Idgham Shafawi - With Meem" alt="').replace(/\[i/g, '<span class="iqlb" title="Iqlab" alt="').replace(/\[a/g, '<span class="idgh_ghn" title="Idgham - With Ghunnah" alt="').replace(/\[u/g, '<span class="idgh_w_ghn" title="Idgham - Without Ghunnah" alt="').replace(/\[d/g, '<span class="idgh_mus" title="Idgham - Mutajanisayn" alt="').replace(/\[b/g, '<span class="idgh_mus" title="Idgham - Mutaqaribayn" alt="').replace(/\[g/g, '<span class="ghn" title="Ghunnah: 2 Vowels" alt="').replace(/\[/g, '" >').replace(/\]/g, '</span>');
verseObject.verse = text;
return text;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment