/* * jsQari: JavaScript Quran Recitation widget * http://www.qurantracker.com/jsQari * * Copyright (c) 2011 Ziad Mannan * Dual licensed under the MIT and GPL licenses. * - http://www.opensource.org/licenses/mit-license.php * - http://www.gnu.org/copyleft/gpl.html * * Author: Ziad Mannan * Contributor: Mohamad Ehab * - linkedin: http://eg.linkedin.com/in/mohamadehab/ * - ODesk: https://www.odesk.com/users/~015620c5c655db4b75 * Version: 1.3 * Date: 17th Juy 2013 * - http://www.linkedin.com/pub/gamal-mahmoud/8a/804/66 */ var sel_surah var selected_ayah var JSQari = function () { this.jsqariPlayer = $("#jquery_jplayer_1"); this.jsqariBasmalahPlayed = false; this.jsqariSurahFrom; this.jsqariAyahFrom; this.jsqariSurahTo; this.jsqariAyahTo; this.jsqariRepeatAyah; this.jsqariRepeatSection; this.jsqariReciter; //Curr this.jsqariSurahCurr = 1; this.jsqariAyahCurr = 1; this.jsqariRepeatAyahCurr = 1; this.jsqariRepeatSectionCurr = 1; this.surahAyahs = [0, 7, 286, 200, 176, 120, 165, 206, 75, 129, 109, 123, 111, 43, 52, 99, 128, 111, 110, 98, 135, 112, 78, 118, 64, 77, 227, 93, 88, 69, 60, 34, 30, 73, 54, 45, 83, 182, 88, 75, 85, 54, 53, 89, 59, 37, 35, 38, 29, 18, 45, 60, 49, 62, 55, 78, 96, 29, 22, 24, 13, 14, 11, 11, 18, 12, 12, 30, 52, 52, 44, 28, 28, 20, 56, 40, 31, 50, 40, 46, 42, 29, 19, 36, 25, 22, 17, 19, 26, 30, 20, 15, 21, 11, 8, 8, 19, 5, 8, 8, 11, 11, 8, 3, 9, 5, 4, 7, 3, 6, 3, 5, 4, 5, 6]; this.surahNames = ["", "1. الفاتحة", "2. البقرة", "3. آل عمران", "4. النساء", "5. المائدة", "6.الأنعام", "7. الأعراف", "8. الأنفال", "9. التوبة", "10. يونس", "11. هود", "12. يوسف", "13. الرعد", "14. إبراهيم", "15. الحجر", "16. النحل", "17. الإسراء", "18. الكهف", "19. مريم", "20. طه", "21. الأنبياء", "22. الحج", "23. المؤمنون", "24. النور", "25. الفرقان", "26. الشعراء", "27. النمل", "28. القصص", "29. العنكبوت", "30. الروم", "31. لقمان", "32. السجدة", "33. الأحزاب", "34. سبأ", "35. فاطر", "36. يس", "37. الصافات", "38. ص", "39. الزمر", "40. غافر", "41. فصلت", "42. الشورى", "43. الزخرف", "44. الدخان", "45. الجاثية", "46. الأحقاف", "47. محمد", "48. الفتح", "49. الحجرات", "50. ق", "51. الذاريات", "52. الطور", "53. النجم", "54. القمر", "55. الرحمن", "56. الواقعة", "57. الحديد", "58. المجادلة", "59. الحشر", "60. الممتحنة", "61. الصف", "62. الجمعة", "63. المنافقون", "64. التغابن", "65. الطلاق", "66. التحريم", "67. الملك", "68. القلم", "69. الحاقة", "70. المعارج", "71. نوح", "72. الجن", "73. المزمل", "74. المدثر", "75. القيامة", "76. الإنسان", "77. المرسلات", "78. النبأ", "79. النازعات", "80. عبس", "81. التكوير", "82. الإنفطار", "83. المطففين", "84. الإنشقاق", "85. البروج", "86. الطارق", "87. الأعلى", "88. الغاشية", "89. الفجر", "90. البلد", "91. الشمس", "92. الليل", "93. الضحى", "94. الشرح", "95. التين", "96. العلق", "97. القدر", "98. البينة", "99. الزلزلة", "100. العاديات", "101. القارعة", "102. التكاثر", "103. العصر", "104. الهمزة", "105. الفيل", "106. قريش", "107. الماعون", "108. الكوثر", "109. الكافرون", "110. النصر", "111. المسد", "112. الإخلاص", "113. الفلق", "114. الناس" ]; this.uiSurahFromSelector = $('#jsqari-ui-surah-from-selector'); this.uiAyahFromSelector = $('#jsqari-ui-ayah-from-selector'); this.uiSurahToSelector = $('#jsqari-ui-surah-to-selector'); this.uiAyahToSelector = $('#jsqari-ui-ayah-to-selector'); this.uiRepeatAyahSelector = $('#jsqari-ui-repeat-ayah-selector'); this.uiRepeatSectionSelector = $('#jsqari-ui-repeat-section-selector'); this.uiReciterSelector = $('#jsqari-ui-reciter-selector'); this.uiCurrentPlaying = $('#jsqari-ui-current-playing'); }; JSQari.prototype = { init: function () { var _this = this; this.jsqariSurahFrom = this.uiSurahFromSelector.val(); this.jsqariAyahFrom = this.uiAyahFromSelector.val(); this.jsqariSurahTo = this.uiSurahToSelector.val(); this.jsqariAyahTo = this.uiAyahToSelector.val(); this.jsqariRepeatAyah = this.uiRepeatAyahSelector.val(); this.jsqariRepeatSection = this.uiRepeatSectionSelector.val(); this.jsqariReciter = this.uiReciterSelector.val(); this.jsqariBasmalahPlayed = true; this.jsqariPlayer.jPlayer({ //ready: function () { // $(_this.jsqariPlayer).jPlayer("setMedia", { // mp3: "http://www.everyayah.com/data/Minshawy_Murattal_128kbps/001002.mp3" // }); //}, ended: function () { _this.handleJSQariAyahEnd(); }, timeupdate: function (event) { if ((event.jPlayer.status.paused == true) && (event.jPlayer.status.srcSet == true)) { _this.resetFlags(); } }, solution: "flash, html", swfPath: "" }); // set up event handlers this.uiSurahFromSelector.change(function () { _this.jsqariSurahFrom = parseInt($(this).val()); _this.handleSurahFromChange(); _this.modifySelectors(); _this.updateUI(); _this.setBasmalahStatus(); _this.setMediaFile(); }); this.uiAyahFromSelector.change(function () { _this.jsqariAyahFrom = parseInt($(this).val()); _this.handleAyahFromChange(); _this.modifySelectors(); _this.updateUI(); _this.setBasmalahStatus(); _this.setMediaFile(); }); // set up event handlers this.uiSurahToSelector.change(function () { _this.jsqariSurahTo = parseInt($(this).val()); _this.handleSurahToChange(); _this.handleToChange(); _this.modifySelectors(); _this.updateUI(); }); this.uiAyahToSelector.change(function () { _this.jsqariAyahTo = parseInt($(this).val()); _this.handleToChange(); _this.modifySelectors(); _this.updateUI(); }); this.uiRepeatAyahSelector.change(function () { _this.jsqariRepeatAyah = parseInt($(this).val()); //_this.jsqariRepeatAyahCurr = $(this).val(); //_this.setBasmalahStatus(); //_this.setMediaFile(); }); this.uiRepeatSectionSelector.change(function () { _this.jsqariRepeatSection = $(this).val(); //_this.jsqariRepeatSectionCurr = $(this).val(); //_this.setBasmalahStatus(); //_this.setMediaFile(); }); this.uiReciterSelector.change(function () { _this.jsqariReciter = $(this).val(); _this.setBasmalahStatus(); _this.setMediaFile(); }); this.setMediaFile(); }, // CONTROLLER methods handleSurahFromChange: function () { if (this.jsqariPlayer.data('jPlayer').status.paused == false) { this.jsqariPlayer.jPlayer("stop"); } this.jsqariAyahFrom = 1; this.jsqariSurahCurr = this.jsqariSurahFrom; this.jsqariAyahCurr = 1; if (this.jsqariSurahTo <= this.jsqariSurahFrom) { // alert("here") // this.jsqariAyahCurr = 1; // this.jsqariSurahCurr = this.jsqariSurahFrom; this.jsqariSurahTo = this.jsqariSurahFrom; this.jsqariAyahTo = this.jsqariAyahFrom; } }, handleAyahFromChange: function () { adjustmoshaf(); if (this.jsqariPlayer.data('jPlayer').status.paused == false) { this.jsqariPlayer.jPlayer("stop"); } if (this.jsqariSurahTo == this.jsqariSurahFrom) { if (this.jsqariAyahTo < this.jsqariAyahFrom) { this.jsqariAyahTo = this.jsqariAyahFrom; } } this.jsqariAyahCurr = this.jsqariAyahFrom; //toTop('Ayaimg' + this.jsqariAyahCurr) }, handleSurahToChange: function () { if (this.jsqariSurahTo == this.jsqariSurahFrom) { this.jsqariAyahTo = this.jsqariAyahFrom; } else { this.jsqariAyahTo = 1; } }, handleToChange: function () { if (this.jsqariPlayer.data('jPlayer').status.paused == false) { if ((this.jsqariSurahCurr > this.jsqariSurahTo) || ((this.jsqariSurahCurr == this.jsqariSurahTo) && (this.jsqariAyahCurr > this.jsqariAyahTo))) { this.jsqariPlayer.jPlayer("stop"); this.resetFlags(); } } }, modifySelectors: function () { this.modifyAyahFromSelector(); this.modifySurahToSelector(); this.modifyAyahToSelector(); }, modifyAyahFromSelector: function () { this.uiAyahFromSelector.children().remove(); var surahAyahNumber = this.surahAyahs[this.jsqariSurahFrom]; for (i = 1; i <= surahAyahNumber; i++) { this.uiAyahFromSelector.append(''); } }, modifySurahToSelector: function () { this.uiSurahToSelector.children().remove(); for (i = this.jsqariSurahFrom; i <= 114; i++) { this.uiSurahToSelector.append(''); } }, modifyAyahToSelector: function () { var surahAyahNumber = this.surahAyahs[this.jsqariSurahTo]; var j; if (this.jsqariSurahTo == this.jsqariSurahFrom) { j = this.jsqariAyahFrom; } else { j = 1; } this.uiAyahToSelector.children().remove(); for (i = j; i <= surahAyahNumber; i++) { this.uiAyahToSelector.append(''); } }, handleJSQariAyahEnd: function (event) { if ((this.jsqariSurahCurr == this.jsqariSurahTo) && (this.jsqariAyahCurr == this.jsqariAyahTo) && (this.jsqariRepeatAyahCurr == this.jsqariRepeatAyah)) { this.jsqariRepeatAyahCurr = 1; this.jsqariSurahCurr = this.jsqariSurahFrom; this.jsqariAyahCurr = this.jsqariAyahFrom; this.setBasmalahStatus(); this.setMediaFile(); //Check Section Repeat if (this.jsqariRepeatSection == "Infinite") { this.jsqariPlayer.jPlayer("play"); } else if (this.jsqariRepeatSectionCurr < this.jsqariRepeatSection) { this.jsqariRepeatSectionCurr++; this.jsqariPlayer.jPlayer("play"); } else { //Reset data this.jsqariRepeatSectionCurr = 1; } } else if (this.jsqariRepeatAyahCurr < this.jsqariRepeatAyah) { if (this.jsqariAyahCurr == 0) { this.jsqariAyahCurr = 1; } else { this.jsqariRepeatAyahCurr++; } this.setMediaFile(); this.jsqariPlayer.jPlayer("play"); } else { //Move to next Ayah if (this.jsqariAyahCurr == 0) { this.jsqariAyahCurr = 1; } else { this.jsqariRepeatAyahCurr = 1; this.jsqariAyahCurr = parseInt(this.jsqariAyahCurr) + 1; if (this.jsqariAyahCurr > this.surahAyahs[this.jsqariSurahCurr]) { this.jsqariAyahCurr = 1; this.jsqariSurahCurr = parseInt(this.jsqariSurahCurr) + 1; if (this.jsqariSurahCurr > 114) { this.jsqariSurahCurr = 1; } this.setBasmalahStatus(); } } this.setMediaFile(); this.jsqariPlayer.jPlayer("play"); } //this.updateUI(); }, // VIEW functions handleCurrChange: function (isBasmalah) { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// document.getElementById("frm_Man").src = "https://archive.org/download/Quran4u_Surah_Maany/w-" + this.jsqariSurahCurr + ".htm"; document.getElementById("frm_Moyassar").src = "https://archive.org/download/Quran4u_Tafsir_Page_Part_Surah_Moyassar/taf-sur" + this.jsqariSurahCurr + ".htm"; // } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if ((isBasmalah == true) || (this.jsqariAyahCurr < 1)) { // this.uiCurrentPlaying.val('بسم الله الرحمن الرحيم'); this.jsqariAyahCurr = 1 this.uiCurrentPlaying.val(this.surahNames[this.jsqariSurahCurr] + ' : ' + this.jsqariAyahCurr); } else { this.uiCurrentPlaying.val(this.surahNames[this.jsqariSurahCurr] + ' : ' + this.jsqariAyahCurr); } }, updateUI: function () { this.uiSurahFromSelector.val(this.jsqariSurahFrom); this.uiAyahFromSelector.val(this.jsqariAyahFrom); this.uiSurahToSelector.val(this.jsqariSurahTo); this.uiAyahToSelector.val(this.jsqariAyahTo); this.uiRepeatAyahSelector.val(this.jsqariRepeatAyah); if (this.jsqariRepeatSection == 0) { this.uiRepeatSectionSelector.val("Infinite"); } else { this.uiRepeatSectionSelector.val(this.jsqariRepeatSection); } //this.uiCurrentPlaying.val(this.surahNames[this.jsqariSurahCurr] + ':' + this.jsqariAyahCurr); }, // API functions // play the surah provided playSurah: function (surahNumber) { return this.playSurahAyah(surahNumber, 1, false); }, // play from the surah/ayah provided. If endOfQuran is true then it plays to the end of the Quran // if it is false then plays to the end of the surah playSurahAyah: function (surahNumber, ayahNumber, endOfQuran) { if (this.jsqariPlayer.data('jPlayer').status.paused == false) { this.jsqariPlayer.jPlayer("stop"); } // check surah number surahNumberParsed = parseInt(surahNumber); if (isNaN(surahNumberParsed)) { alert('Surah number is not a valid number'); return false; } else if (surahNumberParsed > 114 || surahNumberParsed < 1) { alert('Not a valid surah number'); return false; } // check ayah number ayahNumberParsed = parseInt(ayahNumber); if (isNaN(ayahNumberParsed)) { alert('Ayah number is not a valid number'); return false; } else if (ayahNumberParsed > this.surahAyahs[surahNumberParsed] || ayahNumberParsed < 1) { alert('Not a valid ayah number'); return false; } this.jsqariSurahFrom = surahNumberParsed; this.jsqariAyahFrom = ayahNumberParsed; this.jsqariSurahCurr = this.jsqariSurahFrom; this.jsqariAyahCurr = this.jsqariAyahFrom; if (endOfQuran == false) { this.jsqariSurahTo = this.jsqariSurahFrom; this.jsqariAyahTo = this.surahAyahs[surahNumberParsed]; } else { this.jsqariSurahTo = 114; this.jsqariAyahTo = this.surahAyahs[114] } this.setBasmalahStatus(); this.modifySelectors(); this.updateUI(); this.setMediaFile(); this.jsqariPlayer.jPlayer("play"); }, // set the from surah/ayah and to surah/ayah and play playSection: function (surahNumber, ayahNumber, surahNumberTo, ayahNumberTo) { this.setFromToPosition(surahNumber, ayahNumber, surahNumberTo, ayahNumberTo); this.play(); }, // set the from surah/ayah and to surah/ayah setFromToPosition: function (surahNumber, ayahNumber, surahNumberTo, ayahNumberTo) { this.setFromPosition(surahNumber, ayahNumber); this.setToPosition(surahNumberTo, ayahNumberTo); }, // play from this surah/ayah setFromPosition: function (surahNumber, ayahNumber) { // check surah number surahNumberParsed = parseInt(surahNumber); if (isNaN(surahNumberParsed)) { alert('Surah number is not a valid number'); return false; } else if (surahNumberParsed > 114 || surahNumberParsed < 1) { alert('Not a valid surah number'); return false; } // check ayah number ayahNumberParsed = parseInt(ayahNumber); if (isNaN(ayahNumberParsed)) { alert('Ayah number is not a valid number'); return false; } else if (ayahNumberParsed > this.surahAyahs[surahNumberParsed] || ayahNumberParsed < 1) { alert('Not a valid ayah number'); return false; } if (this.jsqariSurahFrom != surahNumberParsed) { this.jsqariSurahFrom = surahNumberParsed; this.handleSurahFromChange(); } this.jsqariAyahFrom = ayahNumberParsed; this.handleAyahFromChange(); this.modifySelectors(); this.setBasmalahStatus(); this.setMediaFile(); this.updateUI(); }, // play to this surah/ayah setToPosition: function (surahNumber, ayahNumber) { // check surah number surahNumberParsed = parseInt(surahNumber); if (isNaN(surahNumberParsed)) { alert('Surah number is not a valid number'); return false; } else if (surahNumberParsed > 114 || surahNumberParsed < 1) { alert('Not a valid surah number'); return false; } // check ayah number ayahNumberParsed = parseInt(ayahNumber); if (isNaN(ayahNumberParsed)) { alert('Ayah number is not a valid number'); return false; } else if (ayahNumberParsed > this.surahAyahs[surahNumberParsed] || ayahNumberParsed < 1) { alert('Not a valid ayah number'); return false; } else if ((surahNumberParsed < this.jsqariSurahFrom) || ((surahNumberParsed == this.jsqariSurahFrom) && (ayahNumberParsed < this.jsqariAyahFrom))) { alert('To Ayah is before From Ayah'); return false; } if (this.jsqariSurahTo != surahNumberParsed) { this.jsqariSurahTo = surahNumberParsed; this.handleSurahToChange(); } this.jsqariAyahTo = ayahNumberParsed; this.handleToChange(); this.modifySelectors(); this.updateUI(); }, // set how many times the section (from - to) should be repeated. A value of 0 sets the repeat to be infinite setRepeatSection: function (repeatNumber) { // check surah number repeatNumberParsed = parseInt(repeatNumber); if (isNaN(repeatNumberParsed)) { alert('Repeat Surah number is not a valid number'); return false; } else if (repeatNumberParsed == 0) { this.jsqariRepeatSection = "Infinite"; } else { this.jsqariRepeatSection = repeatNumberParsed; } this.updateUI(); }, // set how many times an ayah should be repeated setRepeatAyah: function (repeatNumber) { // check surah number repeatNumberParsed = parseInt(repeatNumber); if (isNaN(repeatNumberParsed) || repeatNumberParsed == 0) { alert('Repeat Surah number is not a valid number'); return false; } else { this.jsqariRepeatAyah = repeatNumberParsed; } this.updateUI(); }, play: function () { this.setBasmalahStatus(); //this.updateUI(); this.setMediaFile(); this.jsqariPlayer.jPlayer("play"); }, stop: function () { this.jsqariPlayer.jPlayer("stop"); this.resetFlags(); }, pause: function () { this.jsqariPlayer.jPlayer("pause"); this.resetFlags(); }, // sets the play mode (legacy API method) // possible values are continious, repeatayah, singleayah, surah, repeatsurah setPlayMode: function (pMode) { if (pMode == 'continious') { // go to next ayah and play again this.jsqariSurahTo = 114; this.jsqariAyahTo = this.surahAyahs[114]; this.jsqariRepeatAyah = 1; this.jsqariRepeatSection = 1; } else if (pMode == 'repeatayah') { this.jsqariSurahTo = this.jsqariSurahCurr; this.jsqariAyahTo = this.jsqariAyahCurr; this.jsqariSurahFrom = this.jsqariSurahCurr; this.jsqariAyahFrom = this.jsqariAyahCurr; this.jsqariRepeatAyah = 1; this.jsqariRepeatSection = "Infinite"; } else if (pMode == 'singleayah') { this.jsqariSurahTo = this.jsqariSurahCurr; this.jsqariAyahTo = this.jsqariAyahCurr; this.jsqariSurahFrom = this.jsqariSurahCurr; this.jsqariAyahFrom = this.jsqariAyahCurr; this.jsqariRepeatAyah = 1; this.jsqariRepeatSection = 1; } else { var wasPlaying = false; if (pMode == 'surah') { if (this.jsqariPlayer.data('jPlayer').status.paused == false) { this.jsqariPlayer.jPlayer("stop"); wasPlaying = true; } this.jsqariSurahFrom = this.jsqariSurahCurr; this.jsqariSurahTo = this.jsqariSurahCurr; this.jsqariAyahTo = this.surahAyahs[this.jsqariSurahFrom]; this.jsqariAyahFrom = 1; this.jsqariSurahCurr = this.jsqariSurahFrom; this.jsqariAyahCurr = 1; this.jsqariRepeatAyah = 1; this.jsqariRepeatSection = 1; } else if (pMode == 'repeatsurah') { if (this.jsqariPlayer.data('jPlayer').status.paused != false) { this.jsqariSurahCurr = this.jsqariSurahFrom; this.jsqariAyahCurr = 1; } this.jsqariSurahFrom = this.jsqariSurahCurr; this.jsqariSurahTo = this.jsqariSurahCurr; this.jsqariAyahTo = this.surahAyahs[this.jsqariSurahFrom]; this.jsqariAyahFrom = 1; this.jsqariRepeatAyah = 1; this.jsqariRepeatSection = "Infinite"; } if (wasPlaying == true) { this.play(); } } this.modifySelectors(); this.updateUI(); }, // 'PRIVATE' functions setMediaFile: function () { //document.getElementById("Ayaimg1").src = "https://archive.org/download/Quran4u_Quran_Page_Ayah/10" + this.pad(this.jsqariSurahCurr, 3) + this.pad(this.jsqariAyahCurr, 3) + ".jpg" // document.getElementById("Ayaimg1").src = get_page_ayah_source(this.jsqariSurahCurr) + "10" + this.pad(this.jsqariSurahCurr, 3) + this.pad(this.jsqariAyahCurr, 3) + '.jpg'; document.getElementById("Ayaimg1").src = "https://archive.org/download/Quran_PageAyah/10" + this.pad(this.jsqariSurahCurr, 3) + this.pad(this.jsqariAyahCurr, 3) + '.jpg'; // handle basmalah /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// document.getElementById("surahNumberCurr").value = this.jsqariSurahCurr; document.getElementById("ayahNumberCurr").value = this.jsqariAyahCurr; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (this.jsqariAyahCurr == 0) { document.getElementById("frm_Taf").src = "https://archive.org/download/Quran4u_Tafsir_Ayah_Jal/" + this.pad(this.jsqariSurahCurr, 3) + '001.html'; } ; if (this.jsqariAyahCurr > 0) { document.getElementById("frm_Taf").src = "https://archive.org/download/Quran4u_Tafsir_Ayah_Jal/" + this.pad(this.jsqariSurahCurr, 3) + this.pad(this.jsqariAyahCurr, 3) + '.html'; } ; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// document.getElementById("surahNumberFrom").value = this.jsqariSurahCurr; document.getElementById("ayahNumberFrom").value = this.jsqariAyahCurr; if (this.jsqariAyahCurr == 0) { this.jsqariAyahCurr = 1 } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var tempSurah = false; var tempSurahNumber; if (!this.jsqariBasmalahPlayed) { this.handleCurrChange(true); tempSurah = true; tempSurahNumber = this.jsqariSurahCurr; this.jsqariSurahCurr = 1; this.jsqariAyahCurr = 1; this.jsqariBasmalahPlayed = true; } else { this.handleCurrChange(false); } // var base = 'http://www.everyayah.com/data/'; var mp3file = this.jsqariReciter + this.pad(this.jsqariSurahCurr, 3) + this.pad(this.jsqariAyahCurr, 3) + '.mp3'; if (tempSurah) { this.jsqariSurahCurr = tempSurahNumber; this.jsqariAyahCurr = 0; } //alert(mp3file); this.jsqariPlayer.jPlayer("setMedia", { mp3: mp3file }); //this.handleCurrChange(); }, setBasmalahStatus: function () { if (this.jsqariAyahCurr == 1 && (this.jsqariSurahCurr != 1 && this.jsqariSurahCurr != 9)) { this.jsqariBasmalahPlayed = false; } else { this.jsqariBasmalahPlayed = true; } }, pad: function (number, length) { var str = '' + number; while (str.length < length) { str = '0' + str; } return str; }, resetFlags: function () { this.jsqariRepeatAyahCurr = 1; this.jsqariRepeatSectionCurr = 1; this.jsqariSurahCurr = this.jsqariSurahFrom; this.jsqariAyahCurr = this.jsqariAyahFrom; this.setBasmalahStatus(); this.setMediaFile(); } } function scrollFunc(iimg) { if (document.getElementById(iimg)) { var docPos = f_scrollTop(); window.scrollTo(0, docPos); } ; } ; function adjustmoshaf() { var est = document.getElementById("Ayaimg1"); // ggggggg window.location = '#Here'; if (est) { var docPos = f_scrollTop(); est.scrollIntoView(); window.scrollTo(0, docPos) toTop("Ayaimg1"); } ; } ; function f_scrollTop() { return f_filterResults( window.pageYOffset ? window.pageYOffset : 0, document.documentElement ? document.documentElement.scrollTop : 0, document.body ? document.body.scrollTop : 0 ); } ; function scrollDivDown(id, step) { document.getElementById(id).scrollTop += step } ; function toTop(id) { document.getElementById(id).scrollTop = 0 } ; //------------------------------------------------------------------------------------------------ function createimage1(bbase, surah_num, ayah_num, ddiv) { imgg.id = "Ayaimg" + ayah_num; imgg.src = (bbase + surah_num + '_' + ayah_num + '.gif'); document.getElementById(ddiv).innerHTML = document.getElementById(ddiv).innerHTML + "جارى تحميل الآية - إنتظر من �?ضلك
" }; //----------------------------------------------------------------------------------------------- function createimage(bbase, surah_num, ayah_num, ddiv) { var divtest = document.createElement("div"); divtest.innerHTML = "جارى تحميل الآية - إنتظر من �?ضلك
" document.getElementById(ddiv).appendChild(divtest); } //--------------------------------------------------------------------------------------------------- function scrollIntoViewIfOutOfView(el) { var topOfPage = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; var heightOfPage = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; var elY = 0; var elH = 0; if (document.layers) { // NS4 elY = el.y; elH = el.height; } else { for (var p = el; p && p.tagName != 'body'; p = p.offsetParent) { elY += p.offsetTop; } elH = el.offsetHeight; } if ((topOfPage + heightOfPage) < (elY + elH)) { el.scrollIntoView(false); } else if (elY < topOfPage) { el.scrollIntoView(true); } } function ClearDiv(hdiv) { document.getElementById(hdiv).innerHTML = ""; if ($('#surahNumber').val() > 1) { document.getElementById(hdiv).innerHTML = "
"; } ; if ($('#surahNumber').val() == 9) { document.getElementById(hdiv).innerHTML = "
"; } ; } ; function preloadimg(myimgsrc) { if (document.images) { preload_image = new Image(); preload_image.src = "myimgsrc"; } ; } ; function f_filterResults(n_win, n_docel, n_body) { var n_result = n_win ? n_win : 0; if (n_docel && (!n_result || (n_result > n_docel))) n_result = n_docel; return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result; }; function loadhtml2div(url, target) { document.getElementById(target).innerHTML = '





جارى تحميل السورة - أذكر الله

'; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } if (req != undefined) { req.onreadystatechange = function () { loadhtml2divDone(url, target); }; req.open("GET", url, true); req.send(""); } } function loadhtml2divDone(url, target) { if (req.readyState == 4) { // only if req is "loaded" if (req.status == 200) { // only if "OK" document.getElementById(target).innerHTML = req.responseText; } else { document.getElementById(target).innerHTML = " Error:\n" + req.status + "\n" + req.statusText; } } } function load(name, div) { loadhtml2div(name, div); return false; } function loadhtmlfile(surah_num, ddiv) { loadhtml2div(('Surah_Html/' + surah_num + '.htm'), ddiv); return false; }; function opentafsir() { var ourayah1 = document.getElementById("ayahNumber").value var oursurah1 = document.getElementById("surahNumber").value var width = 660; var height = 500; var x = (800 - width) / 2; var y = (600 - height) / 2; if (screen) { y = (screen.availHeight - height) / 2; x = (screen.availWidth - width) / 2; } window.open('Quran-Ayah-Tafseer.aspx?Surah=' + oursurah1 + '&Ayah=' + ourayah1, 'newWin', 'width=' + width + ',height=' + height + ',screenX=' + x + ',scrollbars=yes,screenY=' + y + ',top=' + y + ',left=' + x) }; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function createCookie(name, value, days) { if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); } else var expires = ""; document.cookie = escape(name) + "=" + escape(value) + expires + "; path=/"; } function readCookie(name) { var nameEQ = escape(name) + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length, c.length)); } return null; } function eraseCookie(name) { createCookie(name, "", -1); } //---------------------------------------------------------------------------------------------------------------------- function save_it() { if (are_cookies_enabled() == true) { var finalsurah = document.getElementById("surahNumberCurr").value; var finalayah = document.getElementById("ayahNumberCurr").value var finalreciter = document.getElementById('jsqari-ui-reciter-selector').selectedIndex; createCookie('ayah_lastsurah', finalsurah, '365'); createCookie('ayah_lastayah', finalayah, '365'); createCookie('ayah_reciternum', finalreciter, '365'); } else { alert("المتصفح المستعمل لايقبل الحفظ - Please Allow cookies") } }; //----------------------------------------------------------------- function are_cookies_enabled() { var cookieEnabled = (navigator.cookieEnabled) ? true : false; if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled) { document.cookie = "testcookie"; cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false; } return (cookieEnabled); } function del_it() { eraseCookie('ayah_lastsurah'); eraseCookie('ayah_lastayah'); eraseCookie('ayah_reciternum'); }; //--------------------------------------------------------------------------------------------------------------------------------------------------------------- function get_it() { surahAyahss = [0, 7, 286, 200, 176, 120, 165, 206, 75, 129, 109, 123, 111, 43, 52, 99, 128, 111, 110, 98, 135, 112, 78, 118, 64, 77, 227, 93, 88, 69, 60, 34, 30, 73, 54, 45, 83, 182, 88, 75, 85, 54, 53, 89, 59, 37, 35, 38, 29, 18, 45, 60, 49, 62, 55, 78, 96, 29, 22, 24, 13, 14, 11, 11, 18, 12, 12, 30, 52, 52, 44, 28, 28, 20, 56, 40, 31, 50, 40, 46, 42, 29, 19, 36, 25, 22, 17, 19, 26, 30, 20, 15, 21, 11, 8, 8, 19, 5, 8, 8, 11, 11, 8, 3, 9, 5, 4, 7, 3, 6, 3, 5, 4, 5, 6]; surahNamess = ["", "1. الفاتحة", "2. البقرة", "3. آل عمران", "4. النساء", "5. المائدة", "6.الأنعام", "7. الأعراف", "8. الأنفال", "9. التوبة", "10. يونس", "11. هود", "12. يوسف", "13. الرعد", "14. إبراهيم", "15. الحجر", "16. النحل", "17. الإسراء", "18. الكهف", "19. مريم", "20. طه", "21. الأنبياء", "22. الحج", "23. المؤمنون", "24. النور", "25. الفرقان", "26. الشعراء", "27. النمل", "28. القصص", "29. العنكبوت", "30. الروم", "31. لقمان", "32. السجدة", "33. الأحزاب", "34. سبأ", "35. فاطر", "36. يس", "37. الصافات", "38. ص", "39. الزمر", "40. غافر", "41. فصلت", "42. الشورى", "43. الزخرف", "44. الدخان", "45. الجاثية", "46. الأحقاف", "47. محمد", "48. الفتح", "49. الحجرات", "50. ق", "51. الذاريات", "52. الطور", "53. النجم", "54. القمر", "55. الرحمن", "56. الواقعة", "57. الحديد", "58. المجادلة", "59. الحشر", "60. الممتحنة", "61. الصف", "62. الجمعة", "63. المنافقون", "64. التغابن", "65. الطلاق", "66. التحريم", "67. الملك", "68. القلم", "69. الحاقة", "70. المعارج", "71. نوح", "72. الجن", "73. المزمل", "74. المدثر", "75. القيامة", "76. الإنسان", "77. المرسلات", "78. النبأ", "79. النازعات", "80. عبس", "81. التكوير", "82. الإنفطار", "83. المطففين", "84. الإنشقاق", "85. البروج", "86. الطارق", "87. الأعلى", "88. الغاشية", "89. الفجر", "90. البلد", "91. الشمس", "92. الليل", "93. الضحى", "94. الشرح", "95. التين", "96. العلق", "97. القدر", "98. البينة", "99. الزلزلة", "100. العاديات", "101. القارعة", "102. التكاثر", "103. العصر", "104. الهمزة", "105. الفيل", "106. قريش", "107. الماعون", "108. الكوثر", "109. الكافرون", "110. النصر", "111. المسد", "112. الإخلاص", "113. الفلق", "114. الناس" ]; if (document.cookie.indexOf("ayah_lastsurah") >= 0) { var savedsurah = Math.floor(readCookie('ayah_lastsurah')); var savedayah = Math.floor(readCookie('ayah_lastayah')); var savedrecieternum = readCookie('ayah_reciternum'); // alert(savedsurah + "-" + savedayah + " - " + savedrecieternum) document.getElementById('jsqari-ui-reciter-selector').selectedIndex = savedrecieternum; jsQari.jsqariReciter = document.getElementById('jsqari-ui-reciter-selector').value; document.getElementById("jsqari-ui-surah-from-selector").selectedIndex = savedsurah - 1; var kkk = document.getElementById("jsqari-ui-surah-to-selector"); var ooo = document.getElementById('jsqari-ui-ayah-from-selector') var uuu = document.getElementById('jsqari-ui-ayah-to-selector') ooo.innerHTML = ""; uuu.innerHTML = ""; kkk.innerHTML = ""; var surahAyahNumber = surahAyahss[savedsurah]; for (i = 1; i <= surahAyahNumber; i++) { option = document.createElement('option'); option.value = option.text = i; ooo.add(option); } for (i = 1; i <= surahAyahNumber; i++) { option = document.createElement('option'); option.value = option.text = i; uuu.add(option); } for (i = savedsurah; i <= 114; i++) { option = document.createElement('option'); option.value = option.text =surahNamess[i]; kkk.add(option); } ooo.selectedIndex = savedayah -1; uuu.selectedIndex = savedayah - 1; kkk.selectedIndex = 0; jsQari.setFromPosition(savedsurah, savedayah); }; }; function play_next() { this.jsqariSurahCurr = document.getElementById("surahNumberCurr").value; this.jsqariAyahCurr = Math.floor(document.getElementById("ayahNumberCurr").value) + 1; jsQari.setFromPosition(this.jsqariSurahCurr, this.jsqariAyahCurr); jsQari.play() } function play_prev() { this.jsqariSurahCurr = document.getElementById("surahNumberCurr").value; this.jsqariAyahCurr = Math.floor(document.getElementById("ayahNumberCurr").value) - 1; jsQari.setFromPosition(this.jsqariSurahCurr, this.jsqariAyahCurr); jsQari.play() }