var sura_no; var Aya_no; var selectedmoshah; var JSQari = function () { this.jsqariPlayer = $("#jquery_jplayer_1"); this.jsqariPart; this.jsqaripage; this.jsqariReciter; this.jsqariMode; this.surahAyahstart = [0, 1, 22, 42, 62, 82, 102, 122, 142, 162, 182, 202, 222, 242, 262, 282, 302, 322, 342, 362, 382, 402, 422, 442, 462, 482, 502, 522, 542, 562, 582]; this.surahAyahs = [0, 21, 41, 61, 81, 101, 121, 141, 161, 181, 201, 221, 241, 261, 281, 301, 321, 341, 361, 381, 401, 421, 441, 461, 481, 501, 521, 541, 561, 581, 604]; this.uiPartSelector = $('#jsqari-ui-surah-selector'); this.uiPageSelector = $('#jsqari-ui-ayah-selector'); this.uiReciterSelector = $('#jsqari-ui-reciter-selector'); this.uiModeSelector = $('#jsqari-ui-mode-selector'); }; JSQari.prototype = { init: function () { var _this = this; this.jsqariPart = this.uiPartSelector.val(); this.jsqaripage = this.uiPageSelector.val(); this.jsqariReciter = this.uiReciterSelector.val(); this.jsqariMode = this.uiModeSelector.val(); this.jsqariPlayer.jPlayer({ // ready: function () { // document.getElementById('3').src = 'Play.gif'; // $(_this.jsqariPlayer).jPlayer("setMedia", { // mp3: "http://www.quran4u.net/quran/abdelbasit_Pages/001.mp3" // }); // }, ended: function () { _this.handlejsqaripageEnd(); }, swfPath: "" }); // set up event handlers this.uiPartSelector.change(function () { _this.jsqariPart = $(this).val(); _this.handleSurahChange(); _this.setMediaFile(); }); this.uiPageSelector.change(function () { _this.jsqaripage = $(this).val(); _this.setMediaFile(); }); this.uiReciterSelector.change(function () { _this.jsqariReciter = $(this).val(); _this.setMediaFile(); }); this.uiModeSelector.change(function () { _this.jsqariMode = $(this).val(); _this.setMediaFile(); }); this.setMediaFile(); }, // CONTROLLER methods handleSurahChange: function () { //------------------------------------------------------ Gamal ----------------------------------------------------------------------- this.jsqaripage = this.surahAyahstart[this.jsqariPart]; this.uiPageSelector.children().remove(); var surahAyahNumber = this.surahAyahs[this.jsqariPart]; for (i = this.jsqaripage; i <= surahAyahNumber; i++) { this.uiPageSelector.append(''); } }, handlejsqaripageEnd: function (event) { document.getElementById('3').src = 'Play.gif'; if (this.jsqariMode == 'continious') { // go to next ayah and play again this.jsqaripage = parseInt(this.jsqaripage) + 1; if (this.jsqaripage > this.surahAyahs[this.jsqariPart]) { this.jsqaripage = 1; this.jsqariPart = parseInt(this.jsqariPart) + 1; if (this.jsqariPart > 30) { this.jsqariPart = 1; } this.handleSurahChange(); } this.setMediaFile(); this.jsqariPlayer.jPlayer("play"); } else if (this.jsqariMode == 'repeatayah') { // play again this.jsqariPlayer.jPlayer("play"); } this.updateUI(); }, // VIEW functions updateUI: function () { this.uiPartSelector.val(this.jsqariPart); this.uiPageSelector.val(this.jsqaripage); }, // API functions playSurah: function (surahNumber) { return this.playSurahAyah(surahNumber, 1); }, playSurahAyah: function (surahNumber, ayahNumber) { // check surah number surahNumberParsed = parseInt(surahNumber); if (isNaN(surahNumberParsed)) { alert('إكتب رقم الجزء ورقم الآية'); return false; } else if (surahNumberParsed > 114 || surahNumberParsed < 1) { alert('إكتب رقم الجزء ورقم الآية'); return false; } // check ayah number ayahNumberParsed = parseInt(ayahNumber); if (isNaN(ayahNumberParsed)) { alert('رقم الصفحة غير صحيح'); return false; } else if (ayahNumberParsed > this.surahAyahs[surahNumberParsed] || ayahNumberParsed < 1) { alert('رقم الصفحة غير صحيح'); return false; } if (this.jsqariPart != surahNumberParsed) { this.jsqariPart = surahNumberParsed; this.handleSurahChange(); } this.jsqaripage = ayahNumberParsed; this.updateUI(); this.setMediaFile(); this.jsqariPlayer.jPlayer("play"); }, // 'PRIVATE' functions setMediaFile: function () { //------------------------------------------------------------------------------------------------------------------------------------------------------------------------- var surahAyahsss = [0, 21, 41, 61, 81, 101, 121, 141, 161, 181, 201, 221, 241, 261, 281, 301, 321, 341, 361, 381, 401, 421, 441, 461, 481, 501, 521, 541, 561, 581, 604]; var surahAyahsssa = [0, 1, 22, 42, 62, 82, 102, 122, 142, 162, 182, 202, 222, 242, 262, 282, 302, 322, 342, 362, 382, 402, 422, 442, 462, 482, 502, 522, 542, 562, 582]; if (this.jsqaripage < surahAyahsss[this.jsqariPart]) { document.getElementById('6').style.width = "60px"; } ; if (this.jsqaripage >= surahAyahsss[this.jsqariPart]) { document.getElementById('6').style.width = "0px"; } ; if (parseInt(this.jsqaripage) <= parseInt(surahAyahsssa[this.jsqariPart])) { document.getElementById('2').style.width = "0px"; } ; if (parseInt(this.jsqaripage) > parseInt(surahAyahsssa[this.jsqariPart])) { document.getElementById('2').style.width = "60px"; } ; //------------------------------------------------------------------------------------------------------------------------------------------------------------- document.getElementById('3').src = 'Play_On.gif'; document.getElementById('4').src = 'Pause.gif'; document.getElementById('5').src = 'Stop.gif'; //---------------------------- Gamal ------------------------------------------------------- document.getElementById("surahNumber").value = this.jsqariPart document.getElementById("ayahNumber").value = this.jsqaripage //alert(this.jsqaripage) document.getElementById("booklet").src = "Booklet-param-hefs-taj.html?" + this.jsqariPart + "&" + this.jsqaripage // alert(this.jsqariPart +"-" + this.jsqaripage) //var base = 'http://www.everyayah.com/data/'; var base = ''; // var mp3file = base + this.jsqariReciter + this.pad(this.jsqaripage, 3) + '.mp3'; var selrec = document.getElementById("jsqari-ui-reciter-selector").selectedIndex this.jsqariReciter = document.getElementById("jsqari-ui-reciter-selector").value if (selrec < warsh_number) { var mp3file = base + this.jsqariReciter + this.pad(this.jsqaripage, 3) + '.mp3'; } if (selrec > warsh_number -1) { var mp3file = base + this.jsqariReciter + this.jsqaripage + '.mp3'; } this.jsqariPlayer.jPlayer("setMedia", { mp3: mp3file }); //--------------------------------------------------------------------------------------------------------- //document.getElementById("frm_Taf").src = "Quran-Page-Tafseer.aspx?p=" + this.jsqaripage; document.getElementById("frm_Man").src = "https://archive.org/download/Quran4u_Maany_Surah_Part_Page/wp-" + this.jsqaripage + ".htm"; document.getElementById("frm_Taf").src = "https://archive.org/download/Quran4u_Tafsir_Jal_Surah_Page_Part/jal" + this.jsqaripage + ".htm"; document.getElementById("frm_moyassar").src = "https://archive.org/download/Quran4u_Tafsir_Page_Part_Surah_Moyassar/taf-" + this.jsqaripage + ".htm"; // document.getElementById("frm_kath").src = "Tafsir_Page_Kath/katheer-p" + this.jsqaripage + ".htm"; }, pad: function (number, length) { var str = '' + number; while (str.length < length) { str = '0' + str; } return str; } } function Img_border_On(iid) { document.getElementById(iid).border = '1'; } function Img_border_Off(iiid) { document.getElementById(iiid).border = '0'; } function play_next() { //alert (kk.val()) document.getElementById("ayahNumber").value = parseInt(document.getElementById("ayahNumber").value) + 1 jsQari.playSurahAyah($('#surahNumber').val(), $('#ayahNumber').val()); } 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; } // alert('Quran-Ayah-Tafseer.aspx?Surah=' + oursurah1 + '&Ayah=' + ourayah1) window.open('Quran-Page-Tafseer.aspx?p=' + 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) { //change_moshaf() var finalsurah = document.getElementById('jsqari-ui-surah-selector').selectedIndex; var finalayah = document.getElementById('jsqari-ui-ayah-selector').selectedIndex; var finalreciter = document.getElementById('jsqari-ui-reciter-selector').selectedIndex; var moshaftype = document.getElementById('moshaf_type').selectedIndex createCookie('pageall_lastsurah', finalsurah, '365'); createCookie('pageall_lastayah', finalayah, '365'); createCookie('pageall_reciternum', finalreciter, '365'); createCookie('pageall_moshaf', moshaftype, '365'); var oursurah = document.getElementById("surahNumber").value var ourayah = document.getElementById("ayahNumber").value createCookie('pageall_ayah', ourayah, '365'); createCookie('pageall_surah', oursurah, '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('pageall_lastsurah'); eraseCookie('pageall_lastayah'); eraseCookie('pageall_reciternum'); }; function get_it() { // alert(readCookie('pageall_lastsurah') + " - " + readCookie('pageall_lastayah') + " - " + readCookie('pageall_reciternum')); if (document.cookie.indexOf("pageall_lastsurah") >= 0) { var savedsurah = readCookie('pageall_lastsurah'); var savedayah = readCookie('pageall_lastayah'); var savedrecieternum = readCookie('pageall_reciternum'); var savedmos = readCookie('pageall_moshaf'); var savedsurahhh = readCookie('pageall_surah'); var savedayahhh = readCookie('pageall_ayah'); document.getElementById('jsqari-ui-reciter-selector').selectedIndex = savedrecieternum; jsQari.jsqariReciter = document.getElementById('jsqari-ui-reciter-selector').value; document.getElementById('moshaf_type').selectedIndex = savedmos; //* selectedmoshah = document.getElementById("moshaf_type").selectedIndex if (selectedmoshah == 0) { document.getElementById("Aya-img").src = 'https://archive.org/download/Quran4u_Quran_tjwd_small/' + padd(this.jsqaripage, 3) + '.gif'; }; if (selectedmoshah == 1) { document.getElementById("Aya-img").src = 'https://archive.org/download/Quran4u_Quran_Warsh/' + this.jsqaripage + '.gif'; }; if (selectedmoshah == 2) { document.getElementById("Aya-img").src = 'https://archive.org/download/Quran4u_Quran_Qaloon/' + padd(this.jsqaripage, 3) + '.jpg'; }; //* //* document.getElementById("surahNumber").value = savedsurahhh; document.getElementById("ayahNumber").value = savedayahhh; // change_moshaf() jsQari.playSurahAyah($('#surahNumber').val(), $('#ayahNumber').val()) jsQari.jsqariPlayer.jPlayer('stop'); } } function padd(number, length) { var str = '' + number; while (str.length < length) { str = '0' + str; } return str; } function change_moshaf() { //disab() // var selectedmoshah2 = document.getElementById("moshaf_type").selectedIndex // if (selectedmoshah2 == 0) // { // // document.getElementById("jsqari-ui-reciter-selector").selectedIndex = 0 // } // if (selectedmoshah2 == 1) // { // document.getElementById("jsqari-ui-reciter-selector").selectedIndex = 36 // } // if (selectedmoshah2 == 2) // { // document.getElementById("jsqari-ui-reciter-selector").selectedIndex = 43 // } jsQari.playSurahAyah($('#surahNumber').val(), $('#ayahNumber').val()) jsQari.jsqariPlayer.jPlayer('stop'); document.getElementById('Aya-img').focus() } function disab() { //* var op if (selectedmoshah == 0) { op = document.getElementById("jsqari-ui-reciter-selector").getElementsByTagName("option"); for (var i = 0; i < 50; i++) { op[i].disabled = false; } for (var i = 36; i < 50; i++) { op[i].disabled = true; } } //* //* else if (selectedmoshah == 1) { op = document.getElementById("jsqari-ui-reciter-selector").getElementsByTagName("option"); for (var i = 0; i < 50; i++) { op[i].disabled = true; } for (var i = 36; i < 42; i++) { op[i].disabled = false; } } //* else if (selectedmoshah == 2) { op = document.getElementById("jsqari-ui-reciter-selector").getElementsByTagName("option"); for (var i = 0; i < 50; i++) { op[i].disabled = true; } for (var i = 41; i < 50; i++) { op[i].disabled = false; } //* } } function isOdd(value) { if (value % 2 == 0) return false; else return true; }