var isSticy = true; var sticyBackground = ''; //handle ESC - Musa Sheikh $(window).keyup(function (e) { var popupHeight = 0 - $('#popup').outerHeight(true); if (e.keyCode == 27) { var overlay = $('#overlay'); //overlay.animate({ // 'opacity': 0 //}, 500); $('#popup').animate({ 'top': popupHeight + 'px' }, 500, function () { overlay.remove(); $(this).remove(); }); $('body').css('overflow-y', 'auto'); } }); $(window).resize(function () { $("#mobile_menu").hide(); var factor = 200; if ($(window).width() <= 768 && $(window).width() <= 1024) { factor = 395; } if ($("#mobile_menu").hasClass("opend")) { $("body").css("overflow-y", ""); $("#mobile_menu").css('display', 'block'); var l = -1 * factor; $("#mobile_menu").css('left', l); $("#mobile_menu").removeClass("opend"); // $("#page").css("left", "") $("#page").css('left', '0px'); } if ($(window).width() >= 1024) { //IntialieStickeyMenu(); } else { $("#header_div").removeClass("fixedM"); $('#container').css('top', '0px'); } }); var playlistcounter = 0; function live(e) { playlistcounter = 1; var listdata var listdatatitle var listimages var co = 1; $(".file_info").each(function () { listimages += "##" + $(this).find("img").attr('src'); }); $('.play').each(function () { $(this).attr("id", "sawt" + $(this).attr('data-src')); if ($(e).attr('data-src') == $(this).attr("data-src")) { playlistcounter = co; } co++; listdata += "##"+ $(this).attr("data-src"); listdatatitle += "##"+ $(this).attr("data-title"); }); if (playlistcounter < 2) { $('#defult_iframe', window.parent.document).contents().find('.nextbtn, .prevbtn').addClass('alpha-effect'); } localStorage.setItem("alist", listdata); localStorage.setItem("alisttitle", listdatatitle); localStorage.setItem("alistcount", 0); localStorage.setItem("listimagess", listimages); var elementId = $(e).attr('id'); var data_src = $(e).attr('data-src'); var site_iframe = $('iframe#Site_Iframe', parent.document); var parent_iframe = site_iframe.parent(); if (window.innerWidth > 1024 && document.documentElement.clientWidth >1024) { var defult_iframe = parent_iframe.find('#defult_iframe'); } else { var defult_iframe = $('#defult_iframe'); } var play_icon = defult_iframe.contents().find('.player_icon'); var abacast = defult_iframe.contents().find('.abacast'); var abacast_container = defult_iframe.contents().find('.abacast'); var currProgram = $('.broadcast_now').find('.program').text(); //console.log(defult_iframe); function animateIfOpened() { $(play_icon).animate({ bottom: "52", }, { duration: 400, queue: false }); $(abacast).animate({ bottom: '0' }, { duration: 400, queue: false }, function () { defult_iframe.css('height', '62px') }); } function animateIfClosed() { $(play_icon).animate({ bottom: "0", }, { duration: 400, queue: false }); $(abacast).animate({ bottom: '-52' }, { duration: 400, queue: false }, function () { iframe.css('height', '62px'); }); } //if (defult_iframe.hasClass('default_playing_opened')) { defult_iframe.attr('data-src', data_src); play_icon.addClass('playing'); defult_iframe.contents().find('audio').remove(); if (elementId == "live_stream") { $(defult_iframe).attr('src', "/iframeLivestream?v=" + getLiveStreamingLink() + "&default=false&trackTitle=" + $('.broadcast_now').find('.program').text()); $('.song-playing').remove(); $('.current-playing-link').removeClass('current-playing-link'); $('.play').find('img').show(); } else if (elementId == '88-fm') { $(defult_iframe).attr('src', "/iframeLivestream?v=http://ruby.streamguys.com:8120/sar-qatar-2&default=false&trackTitle=اذاعة 88.0&fm_88=true"); $('.song-playing').remove(); $('.current-playing-link').removeClass('current-playing-link'); $('.play').find('img').show(); } else { localStorage.setItem("currCount", playlistcounter); var trackThumb = $(e).attr('data-thumb'); var trackTitle = $(e).attr('data-title'); $('.current-playing-link').removeClass('current-playing-link'); $('.song-playing').remove(); $('.play').find('img').show(); //$(e).find('img').hide(); //$(e).find('a').first().append("") $(e).addClass('current-playing-link'); $(defult_iframe).attr('src', "/iframeLivestream?v=" + data_src + "&default=false&trackThumb=" + trackThumb + "&trackTitle=" + trackTitle + '&playlistcounter=' + playlistcounter); } //if (play_icon.hasClass('opened')) { // play_icon.removeClass('opened').addClass('closed'); // // defult_iframe.removeClass('default_playing_opened').addClass('default_playing_closed'); // //iframe.css('height', '114px'); // // defult_iframe.css('height', '114px'); // // animateIfOpened(); //} //else if (play_icon.hasClass('closed')) { // play_icon.removeClass('closed').addClass('opened'); // // defult_iframe.removeClass('default_playing_closed').addClass('default_playing_opened'); // // animateIfClosed //} //} } var jgeturl = decodeURI(location.href); parent.window.history.replaceState("", "", jgeturl); $(document).ready(function () { appendIframe(); // play song on click on download icon(iphone/ipad) if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i))) { if (document.cookie.indexOf("iphone_redirect=false") == -1) { $(document).on('click','.down',function(){ live($(this).parent().find('.play')); return false; }); $(document).on('click','.halqat_download',function(){ live($(this).parent().parent().find('.play')); return false; }); $(document).on('click', '.halqat_download', function () { live($(this).parent().parent().find('.play')); return false; }); $(document).on('click', '.halqat_download', function () { live($(this).parent().parent().find('.play')); return false; }); $(document).on('click', '.play-down', function () { live($(this)); return false; }); } } //alert(location.pathname); //console.log(location.pathname); //var pathName = location.href+'?sawt=1'; //window.history.pushState("", "", pathName + '&ss=s'); $(document).click(function () { if (!jQuery(event.target).hasClass('menu_label_up')) { $('header .share_icons_menu ul').hide(); $('.share_icons_menu .menu_label').removeClass('menu_label_up'); } }); //$('iframe#Site_Iframe').load(function () { // var a = $('iframe#Site_Iframe', parent.document); // var b = a.parent(); // b.find('#defult_iframe').show(); //}); FileUpload("#form_file", "#form_file", ".fileinputs", "#attach-option", ".attached-file"); FileUpload("#form_audio", "#form_audio", ".fileinputs2", "#attach-option2", ".attached-file2"); delete_file(".delete-file", "#form_file", ".attached-file"); delete_file(".delete-file2", "#form_audio", ".attached-file2"); IntializeDropBox('.share', '.share_this'); IntializeDropBox('.menu_label', 'header .share_icons_menu ul'); toggleSelectedSongs(); IntializeDropBox('.show-sharing', '.share_this'); $('.menu_label').on("click", function () { $('header .share_icons_menu ul').slideToggle(); $(".menu_label").toggleClass("menu_label_up"); }); $('.share-list').on("click", function () { $('.share_sec').hide(); $('.bubble-cont').hide(); $(this).parentsUntil('.block').prev().parent().next().next().show(); }); $('.share').on("click", function () { $(this).parent().find('.share_this').stop().slideToggle(); }); $('.close_msg,.confirm_btn').on("click", function () { $('#overlay_form').hide(); $('body').css('overflow-y', 'auto'); }); // Change add to playlist Icon on click $('.add').on("click", function () { var song_id = $(this).attr('data-song-id'); var parent = $(this); if (!sessionStorage.PlaylistName) { if ($(this).find('.add-playlist-popoup').length < 1) { $(this).css('position', 'relative'); $('.add-playlist-popoup').remove(); $(this).append('
'); } $("#playlist-popup-btn").on("click", function () { if ($("#playlist-popup-name").val()) { sessionStorage.PlaylistName = $("#playlist-popup-name").val(); addToPlaylist(song_id); parent.find($('.ico')).attr("src", "/Content/images/addList_cr.png"); } $('.add-playlist-popoup').remove(); return false; }); } if (typeof sessionStorage.PlaylistName != "undefined" && sessionStorage.PlaylistName != 0) { addToPlaylist(song_id); parent.find($('.ico')).attr("src", "/Content/images/addList_cr.png"); } $('.added').hide(); $(this).parentsUntil('.container_jlsat > div').prev().next().next().show(); }); BindAddToPlaylistAction(); $('.MostplayedAdd').on("click", function () { var song_id = $(this).attr('data-song-id'); var parent = $(this); if (!sessionStorage.PlaylistName) { if ($(this).find('.add-playlist-popoup').length < 1) { $(this).css('position', 'relative'); $('.add-playlist-popoup').remove(); $(this).append('
'); } $("#playlist-popup-btn").on("click", function () { if ($("#playlist-popup-name").val()) { sessionStorage.PlaylistName = $("#playlist-popup-name").val(); addToPlaylist(song_id); parent.find($('.Add')).attr("src", "/Content/images/addList_cr.png"); } $('.add-playlist-popoup').remove(); return false; }); } if (typeof sessionStorage.PlaylistName != "undefined" && sessionStorage.PlaylistName != '') { addToPlaylist(song_id); $(this).find($('.Add')).attr("src", "/Content/images/addList_cr.png"); } }); $('.Add-ToMyList, .add-list').on("click", function () { var song_id = $(this).attr('data-song-id'); var parent = $(this); if (!sessionStorage.PlaylistName) { if ($(this).find('.add-playlist-popoup').length < 1) { $(this).css('position', 'relative'); $('.add-playlist-popoup').remove(); $(this).append('
'); } $("#playlist-popup-btn").on("click", function () { if ($("#playlist-popup-name").val()) { sessionStorage.PlaylistName = $("#playlist-popup-name").val(); addToPlaylist(song_id); parent.find($('.ico')).attr("src", "/Content/images/addList_cr.png"); } $('.add-playlist-popoup').remove(); return false; }); } if (typeof sessionStorage.PlaylistName != "undefined" && sessionStorage.PlaylistName != '') { addToPlaylist(song_id); $(this).find($('.ico')).attr("src", "/Content/images/addList_cr.png"); } }); //$('.add-list').on("click", function () { // $(this).parentsUntil('.block').prev().parent().next().show(); //}); //Draw header\footer menu and items DrawSiteMap('header'); DrawSiteMap('footer'); //IntializeStickeyMenu(); customCss(); IntializeSlider(); $('#freq').scrollbox(); IntializeAlbumThumbnails(); tabMobileSlider(); /*$('.image img').click(function () { LoadPhotoAlbumSlider($(this).attr('data-id')); });*/ $("#tabs").tabs(); $(document).on('click', '#go-back', function () { $("#mobile_menu").hide(); $("#page").animate({ left: 0 }) }); //$('#tb-2').click(function () { // equalHeight($("#tabs-1 .singer_name")); //}); $('#tb-2').click(function () { equalHeight($("#tabs-2 .tabs_cont ")); }); $('#tb-3').click(function () { equalHeight($("#tabs-3 .concert_label")); equalHeight($("#tabs-3 .tabs_cont")); }); //$('.broadcast_now').click(function () { // $('.abacast').html(''); // $('.abacast').show(); // var vid = document.getElementById("current-abacast"); // vid.play(0); // $('.broadcast_now').hide(); //}); //$('#live_stream > img').click(function () { // $(this).hide(); // //var cur_audio = document.getElementById('schedule-abacast'); // $('.schedule_stream').html(''); // $('.schedule_stream').show(); // $(this).parent().hide(); // var vid = document.getElementById("current-abacast2"); // vid.play(0); //}); $('#responsiveAlbums .item').click(function () { LoadPhotoAlbumSlider($(this).attr('data-id'), 1); }); $('#programs_news').click(function () { equalHeight($(".guest_title")); }); //equalHeight($("#tabs-1 .tabs_cont ")); equalHeight($("#tabs-1 .singer_name")); equalHeight($(".container_jlsat div .concert_title ")); equalHeight($("#programNews .tabs_cont ")); IntializeImageHover("prog_video", "video_discription"); BuildCharactersSlider(); //$("#programs_blocks .block").each(function () { // if ($(this).find($('#programs_blocks .block .program_summery')).height() > $(this).find($('#programs_blocks .block .summary-cont')).height()) // { $(this).find($('.show-more')).show(); } //}); //$("#others .block").each(function () { // if ($(this).find($('#others .block .program_summery')).height() > $(this).find($('#others .block #other-summary')).height()) // { $(this).find($('.show-more')).show(); } //}); $(".nav li a").each(function () { if ($(this).next().length > 0) { $(this).addClass("parent"); } ; }); var $menu = $('nav#menu'), $html = $('html, body'); $menu.mmenu({ dragOpen: true }); var $anchor = false; $menu.find('li > a').on( 'click', function (e) { $anchor = $(this); } ); var api = $menu.data('mmenu'); adjustMenu(); control_audio(); //PlayAudio_concert(); submenu(); select_Search(); equalHeight($("#glsat .container_jlsat div .title_guset "), true); equalHeight($(".session_det ")); equalHeight($(".guest_title")); if ($('#C7A578F7-99FE-47A3-978A-B4DDE805837F').length == 0) { $('#tb-3-home,#tabs-3').remove() } /*******/ $("#mobile_menu").css("left", -1 * parseInt($("#mobile_menu").css("width").split("px")[0])) $("#toggleMenu").bind("click", function () { $("#mobile_menu").show(); if (!$("#mobile_menu").hasClass("opend")) { //$("#mobile_menu").css("left", ""); $("#mobile_menu").animate({ left: 0 }) $("#mobile_menu").addClass("opend"); $("body").css("overflow-y", "hidden"); // $("#page").css("left", parseInt($("#mobile_menu").css("width").split("px")[0])) $("#page").animate({ left: parseInt($("#mobile_menu").css("width").split("px")[0]) }) } else { //$("#mobile_menu").css("left", -1 * parseInt($("#mobile_menu").css("width").split("px")[0])) $("body").css("overflow-y", ""); $("#mobile_menu").css('display', 'block'); $("#mobile_menu").animate({ left: -1 * parseInt($("#mobile_menu").css("width").split("px")[0]) }) $("#mobile_menu").removeClass("opend"); // $("#page").css("left", "") $("#page").animate({ left: 0 }) } }); /******/ $('.radio_slider').append($('#freq')); $('.scroll-text ul').show(); //freq 88 tooltip $('.radio_freq').tooltip(); $('.Voice').tooltip(); $('.YourList').tooltip(); var EmbedLink = $("#video").attr("data-src"); youtube_parser(EmbedLink); $('#form_types').change(function () { if ($('#form_types').val() === 'b781c60f-ac92-40d8-ab98-8d917dca79cd') { $('#other').slideDown(); $('span#validation-other').show(); } else { $('#other').slideUp(); $('input#othercategory').val(''); $('span#validation-other').hide(); } }); function delete_file(x, y, z) { $(x).on("click", function () { $(y).val(""); $(z).attr("title", ""); $(this).parent().hide(); }); } //AutoComplete /* Text search Auto complete Ajax call */ var ResultKeyword = ''; var timer = null; $("#searchtxt, #txtSearch2").keyup(function () { if (timer) {// if timer is already defined then clear timeout clearTimeout(timer); } var inputId = $(this).prop("id"); var postData = { searchedText: $(this).val() }; if (postData.searchedText.length >= 3) { //if (postData.searchedText != ResultKeyword) { ResultKeyword = postData.searchedText; timer = setTimeout(function () { AutoComplete(postData, inputId); }, 500); //} } else { $("#" + inputId + "-results").hide(); } }); //$(".autoComplete-item").on('click', function () { // window.location = "/search?searchedText=" + $.trim($(this).val()); //}); if ($('#placeholder_banner iframe').length > 0) { var youtube_home = $('#placeholder_banner iframe').attr('src'); $('#placeholder_banner iframe').attr('src', youtube_home + '?wmode=opaque'); } if (sessionStorage.PlaylistCount) { $('.playlist-count').html(sessionStorage.PlaylistCount); } }); $(window).load(function () { equalHeight($("a.guest_title")); ShowPopupImage(); }); function select_Search() { $(".search_input").keydown(function () { $(".clear_search").show(); }); $("body").click(function () { $(".clear_search").hide(); }); $(".clear_search").click(function () { $(".search_input").val(""); }); $(".search_select").click(function () { $("#sectionsDDL").slideToggle(); }); } // Function to be called for autoComplete. function AutoComplete(postData, inputId) { $.ajax({ url: '/autocomplete', data: postData, success: function (data) { //Draw the dropdown div var result_text = ''; $("#" + inputId + "-results").html(result_text); $("#" + inputId + "-results").show(); } }); } function submenu() { $(".subMenu").prev('a').bind("click", function () { if ($(this).next(".subMenu").is(":visible")) { $(this).next(".subMenu").fadeOut(); } else { $(this).next(".subMenu").fadeIn(); } }); } // this function for close popup slider on home page function closeSlider() { $(".web_dialog_overlay").hide(); } function DrawSiteMap(container) { $('[data-id="C980C3DD-7D87-45E1-A9A0-1CF2113F5435"]').remove(); var mainMenuItems = $(container + " #mainMenu"); $.each(mainMenuItems.find("li"), function (i, listItem) { var childItems = mainMenuItems.find("[parentId='" + listItem.id + "']"); if (childItems.length != 0 && mainMenuItems.find("[id='" + listItem.id + "']").find("ul").length == 0) { mainMenuItems.find("[id='" + listItem.id + "']").addClass('parent'); mainMenuItems.find("[id='" + listItem.id + "']").find('a').addClass('parent_text'); mainMenuItems.find("[id='" + listItem.id + "']").append("").find("ul").append(childItems); } }); if (container == 'header') { //mainMenuItems.find("[id='CC7DBAA4-7308-41FF-9A05-6D5C281C504C']").remove(); mainMenuItems.find("[id='306921C6-0924-406F-A032-64D3743375F2']").css('position', 'relative'); } } //modify css for some inner pages function customCss() { $(".guest_videos .guest_video").last().css("margin-bottom", "0px"); } function IntializeSlider() { $(".flexslider").hover(function () { $(" ul.flex-direction-nav").fadeToggle(); }); var flex = $('.flexslider').flexslider({ animation: "slide", slideshowSpeed: 7000, video: true, prevText: "", nextText: "", keyboard: false, reverse: true }); $('.flexslider_thumb').flexslider({ animation: "slide", controlNav: "thumbnails", slideshow: false, startAt: 0, animationLoop: false }); } function tabMobileSlider() { $(".owl-carousel").owlCarousel({ center: true, loop: true, autoWidth: true, margin: 20, nav: true, lazyLoad: true, responsive: { 320: { items: 2, width: 340, height: 200 }, 600: { items: 3, width: 340, height: 200 }, 768: { items: 3, width: 340, height: 200 }, 1024: { items: 3, width: 340, height: 200 } } }); } function BuildCharactersSlider() { if ($('#charactersSlider').length == 0) { return; } var letters = ['أ', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي']; $('#charactersSlider').append('
 
'); $('#charactersSlider').append('
 
'); for (var i = letters.length - 1; i >= 0; i--) { $('#charactersSlider').append('
' + letters[i] + '
'); } var bx = $('#charactersSlider').bxSlider({ pager: false, minSlides: 2, slideWidth: 50, slideMargin: 0, infiniteLoop: false, auto: false, autoDirection: 'back', startSlide: 5, controls: false, maxSlides: 5 }); $('#slider-next').click(function () { bx.goToNextSlide(); return false; }); $('#slider-prev').click(function () { bx.goToPrevSlide(); return false; }); } function BuildDaysSlider() { if ($('#daysSlider').length == 0) { return; } var letters = ['الاحد ', 'الاثنين', 'الثلاثاء', 'الاربعاء', 'الخميس', 'الجمعه', 'السبت', 'الاحد', 'الاثنين', 'الثلاثاء', 'الاربعاء', 'الخميس', 'الجمعه', 'السبت', 'الاحد', 'الاثنين', 'الثلاثاء', 'الاربعاء', 'الخميس', 'الجمعه', ' السبت']; for (var i = letters.length - 1; i >= 0; i--) { $('#daysSlider').append('
' + letters[i] + '' + '30/5' + '
'); } var innerElementsCount = $('#daysSlider .bxslide').length; var maxSlides = 7; var slideWidth = 117; var scrnWidth = screen.width; if (scrnWidth >= 768 && scrnWidth < 1024) { maxSlides = 7; slideWidth = 87; } else if (scrnWidth <= 480) { maxSlides = 3; } var startSlide = Math.ceil((parseInt(innerElementsCount) / maxSlides) - 1); var bx_schedule = $('#daysSlider').bxSlider({ pager: false, minSlides: 3, slideWidth: slideWidth, slideMargin: 1, infiniteLoop: false, auto: false, autoDirection: 'back', startSlide: startSlide, controls: false, maxSlides: maxSlides }); $('#days-next').click(function () { bx_schedule.goToNextSlide(); return false; }); $('#days-prev').click(function () { bx_schedule.goToPrevSlide(); return false; }); } function popup_banner() { var scroll_y = $(document).scrollTop(); $('.popup_wrapper').css('top', (scroll_y + 30)); if ($("#popup").length <= 0 && $("#popup_content").length <= 0) { return; } var overlay = $('
'); var speed = 500; $('body').prepend(overlay); screenHeight = $(window).height(); screenWidth = $(window).width(); popupWidth = $('#popup').outerWidth(true); popupHeight = $('#popup').outerHeight(true); leftPosition = (screenWidth / 2) - (popupWidth / 2); topPosition = (screenHeight / 2) - (popupHeight / 2); if (scroll_y > 0) { topPosition = topPosition + scroll_y; } $('#popup').css({ 'left': leftPosition + 'px', 'top': topPosition + 'px' }); $('#popup').show().animate({ 'top': topPosition }, speed); //overlay.animate({ // 'opacity': 0.7 //}, speed); $('body').css('overflow-y', 'hidden'); $('#popup_close').click(function () { //overlay.animate({ // 'opacity': 0 //}, speed); $('#popup').animate({ 'top': -popupHeight + 'px' }, speed, function () { overlay.remove(); $(this).remove(); }); $('body').css('overflow-y', 'auto'); }); } function ShowPopupImage() { var hidepopup = GetCookie('hidepopup'); if (hidepopup == null || hidepopup != 'true') popup_banner(); } function SetPopupVisibilityCookie(checkbox) { document.cookie = "hidepopup=" + checkbox.checked; } function GetCookie(cname) { var name = cname + "="; var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i]; while (cookie.charAt(0) == ' ') cookie = cookie.substring(1); if (cookie.indexOf(name) == 0) return cookie.substring(name.length, cookie.length); } return null; } function FileUpload(x, y, z, w, m) { $(x).change(function () { if ($(y).val() == "") { return; } $(w).show(); var Val = $(y).val(); $(m).attr("title", Val); }); } function show_msg() { //if ($('#YourInfo form').valid() == true) { // $(this).attr('disabled', 'disabled'); $('#overlay_form').show(); screenHeight = $(window).height(); screenWidth = $(window).width(); popupWidth = $('#msg_container').outerWidth(); popupHeight = $('#msg_container').outerHeight(); leftPosition = (screenWidth / 2) - (popupWidth / 2); topPosition = (screenHeight / 2) - (popupHeight / 2); $('#msg_container').css({ 'left': leftPosition + 'px', 'top': topPosition + 'px' }); //} } function adjustMenu() { $("#mobile_menu").html($("#main_menu_nav").html()); $("#mobile_menu").prepend('
'); $('#mobile_menu #mainMenu').prepend('
  • الصفحة الرئيسية
  • '); $('#mobile_menu #mainMenu').append(''); $('#mobile_menu #mainMenu').append(''); $('#mobile_menu #mainMenu').append('
  • '); $('#mobile_menu #mainMenu').append('
  • '); $("#mobile_menu").find("#mainMenu").fadeIn(); } //function IntializeStickeyMenu() { // if ($(window).width() > 1024) { // $(document).scroll(function () { // if ($(this).scrollTop() > 75) { // if (isSticy) { // $("#header_div").addClass("fixedM"); // $(".fixedM").slideDown(500); // $('#container').css('top', '171px'); // if (sticyBackground != '') { // $('.fixedM').css('background-image', 'url("' + sticyBackground + '")'); // } // } // isSticy = false; // } else { // if (!isSticy) { // $("#header_div").removeClass("fixedM"); // $('#container').css('top', '0px'); // if (sticyBackground != '') { // $('.fixedM').css('background-image', 'url("' + sticyBackground + '")'); // } // } // isSticy = true; // } // }); // } //} $(document).scroll(function () { if ($(window).width() > 1024) { if ($(this).scrollTop() > 75) { if (isSticy) { $("#header_div").addClass("fixedM"); $(".fixedM").slideDown(500); $('#container').css('top', '171px'); if (sticyBackground != '') { $('.fixedM').css('background-image', 'url("' + sticyBackground + '")'); } else { $('#header_div').css('background-image', 'url(/content/images/header-background.png)'); //url(/content/images/header-background.png) } } isSticy = false; } else { if (!isSticy) { $("#header_div").removeClass("fixedM"); $('#container').css('top', '0px'); $('#header_div').css('background-image', 'none'); //if (sticyBackground != '') { // $('#header_div').css('background-image', 'url("' + sticyBackground + '")'); //} else { // $('#header_div').css('background-image', 'none'); // //url(/content/images/header-background.png) //} } isSticy = true; } } }); function ShowSearchBox() { $('#search').mouseover(function (event) { event.stopPropagation(); $('.search_text').show(); }); $('.txt_box').click(function (event) { event.stopPropagation(); }); $(document).click(function () { $('.search_text').hide(); }); } function GetPreviousPhotoAlbum() { var el = $(".images_slider .images_holder .image.active"); var tarIndex = el.index() - 1; var currentIndex = tarIndex + 1; var nextIndex = currentIndex + 1; var prevIndex = currentIndex - 1; el.removeClass("active"); $(".images_slider .images_holder .image.next_slider").removeClass("next_slider"); $(".images_slider .images_holder .image.prev_slider").removeClass("prev_slider"); $(".images_slider .images_holder .image").eq(currentIndex - 1).addClass("active"); $(".images_slider .images_holder .image").eq(nextIndex - 1).addClass("next_slider"); $(".images_slider .images_holder .image").eq(prevIndex - 1).addClass("prev_slider"); $(".title_place").html($(".images_slider .images_holder .image.active img").attr("title")); } function GetNextPhotoAlbum() { var el = $(".images_slider .images_holder .image.active"); var tarIndex = el.index() + 1; if (tarIndex == $(".images_slider .images_holder .image").length - 1) { var currentIndex = $(".images_slider .images_holder .image").length - 2; var nextIndex = currentIndex + 1; var prevIndex = currentIndex - 1; $(".images_slider .images_holder .image").eq(prevIndex).removeClass("prev_slider"); $(".images_slider .images_holder .image").eq(currentIndex).removeClass("active").addClass("prev_slider"); $(".images_slider .images_holder .image").eq(nextIndex).removeClass("next_slider").addClass("active"); $(".images_slider .images_holder .image").eq(0).addClass("next_slider"); } else if (tarIndex >= $(".images_slider .images_holder .image").length) { var currentIndex = $(".images_slider .images_holder .image").length - 1; var nextIndex = 0; var prevIndex = currentIndex - 1; $(".images_slider .images_holder .image").eq(prevIndex).removeClass("prev_slider"); $(".images_slider .images_holder .image").eq(currentIndex).removeClass("active").addClass("prev_slider"); $(".images_slider .images_holder .image").eq(nextIndex).removeClass("next_slider").addClass("active"); $(".images_slider .images_holder .image").eq(1).addClass("next_slider"); } else { var currentIndex = tarIndex - 1; var nextIndex = tarIndex; var prevIndex = currentIndex - 1; el.removeClass("active"); $(".images_slider .images_holder .image").eq(nextIndex).removeClass("next_slider"); $(".images_slider .images_holder .image").eq(prevIndex).removeClass("prev_slider"); $(".images_slider .images_holder .image").eq(currentIndex).addClass("prev_slider"); $(".images_slider .images_holder .image").eq(nextIndex + 1).addClass("next_slider"); $(".images_slider .images_holder .image").eq(nextIndex).addClass("active"); } $(".title_place").html($(".images_slider .images_holder .image.active img").attr("title")); } function IntializeAlbumThumbnails() { if ($(".images_slider").length <= 0) { return; } $(".images_slider > li.images_holder > .image").each(function (i) { switch (i) { case 0: $(this).addClass('prev_slider'); break; case 1: $(this).addClass('active'); break; case 2: $(this).addClass('next_slider'); break; default: break; } }); $("#showTitle").html($(".active").find("img").attr("title")); } function IntializeImageHover(imageClass, descriptionClass) { $("." + imageClass).hover(function () { $(this).find("." + descriptionClass).css("display", "block").slideDown(); }, function () { $("." + descriptionClass).css("display", "none").slideUp(); }); } function control_audio() { document.addEventListener('play', function (e) { var audios = document.getElementsByTagName('audio'); for (var i = 0, len = audios.length; i < len; i++) { if (audios[i] != e.target) { audios[i].pause(); } } }, true); } function updateSource(audioID, containerId, currentAudioObj, uniqueId) { //By Ahmad Shraira $('.file_info').removeClass('activeactive'); $('#audioID' + audioID).addClass('activeactive'); var mainContainer = $(currentAudioObj).parent().parent().parent().parent(); $('.audio-player').each(function () { $(this).remove(); }); $('.audio-hm-sahrat').each(function () { $(this).hide(); }); $('.audio-dyof').each(function () { $(this).hide(); }); var playIcon = $(".jlsat_audio .play"); $(playIcon).parent().parent().find('audio').hide(); $(playIcon).parent().parent().find('.loadingIcon').hide(); $(playIcon).parent().show(); $(currentAudioObj).parent().hide(); $('.down').addClass('pl-down'); var audioSrc = audioID; if (uniqueId) { audioID = audioID + uniqueId; } var sahratDiv = $(currentAudioObj).parent().parent().find('.audio-hm-sahrat'); sahratDiv.show(); var dyofDiv = $(currentAudioObj).parent().parent().find('.audio-dyof'); dyofDiv.show(); var html = '
    '; html += '
    '; html += ' '; html += '
    '; $(mainContainer).find('#audio_cont').append(html); //$(mainContainer).find('#audio_cont').append('
    '); var audio = document.getElementById('audio' + audioID); var source = $('#audiosource' + audioID); source.attr('src', '/file/get/' + audioSrc + '.mp3'); var loadingIcon = $('#audioPL' + audioID).closest('#audio_cont').find('.loadingIcon'); audio.load = function () { // $("#tabs-2 .play").parent().parent().find('#audio_cont audio').hide(); loadingIcon.show(); //console.log('load'); }; audio.onpause = function () { $('#audioEQ' + audioID).removeClass('equalizer-on'); }; audio.onplay = function () { var isLoaded = $('#audio' + audioID).attr('load'); if (isLoaded == 'true') { $('#audioEQ' + audioID).addClass('equalizer-on'); } $('.down').addClass('dd'); } audio.load(); //call this to just preload the audio without playing audio.oncanplay = function () { //$("#tabs-2 .play").parent().parent().find('#audio_cont audio').hide(); //$(".jlsat_audio .play").parent().parent().find('#audio_cont .loadingIcon').hide(); $('#audioPL' + audioID).show(); //$('#loadingIcon' + audioID).hide(); loadingIcon.hide(); $('#audioPL' + audioID).css('display', 'block'); $('#audioEQ' + audioID).addClass('equalizer-on'); $('#audio' + audioID).attr('load', 'true'); }; //call this to play the song right away audio.play(); } function PlayAudio_concert() { $(".les_word").bind("click", function () { $(".les_word").parent().next().hide(); $(".les_word").parent().show(); $(this).parent().hide(); $(this).parent().next().show(); }); } function equalHeight(group, isLine) { var tallest = 0; group.each(function () { thisHeight = $(this).height(); //alert(thisHeight); if (thisHeight > tallest) { tallest = thisHeight; } }); group.height(tallest); } function UpdateMediaMostCount(audioId, counterType) { $.post("/content/updatemediamostcount", { id: audioId, type: counterType }, function () { return true; }); } function IntializeDropBox(x, y) { $(x).unbind(); stButtons.locateElements(); $(x).click(function () { // $(y).hide(); $(this).find(y).stop().slideToggle(); }) } function HideTab() { $('#programs_news').hide(); } function handleKeyPress(e, txtSearchId) { var key = e.keyCode || e.which; if (key == 13) { if ($('#' + txtSearchId).val() != '' && $('#' + txtSearchId).val() != null) { window.location.href = "/search?searchedText=" + $('#' + txtSearchId).val(); } } } function Search(txtSearchId) { if ($('#' + txtSearchId).val() != '' && $('#' + txtSearchId).val() != null) { window.location.href = "/search?searchedText=" + $('#' + txtSearchId).val(); } } function HideShowMoreButton(containerId, buttonId, count) { var totalRecords = parseInt($('#' + containerId + ' #hdnTotal').val()); var pageNumber = parseInt($('#' + containerId + ' #hdnPageNo').val()); var currentRecords = pageNumber * count; if (totalRecords <= currentRecords) { $('#' + buttonId).hide(); } else { $('#' + buttonId).show(); } } function isGUID(s) { if (s && s.match(/^[a-f0-9]{8}(\-[a-f0-9]{4}){4}[a-f0-9]{8}$/i)) { return true; } else { return false; } } function youtube_parser(url) { if ($('#youtube_video').length > 0) { var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; var match = url.match(regExp); if (match && match[7].length == 11) { var VideoId = match[7]; $("#video").attr("src", "https://www.youtube.com/embed/" + VideoId); } else { alert("incorrect URL"); } } } // loads more songs in the playlist detailed page function loadMoreSongs() { var Ids = $("#songs-ids").val() // get the ids of the songs from hidden input $.ajax({ url: "/GetSongsList", data: { resources: Ids, firstLoad: false }, success: function (result) { if (result != '') { $("#MyListAudios").append(result); toggleSelectedSongs(); $("#btnMoreAudios").hide(); BindAddToPlaylistAction(); } } }); } // Add songs to browser sessionStorage function addToPlaylist(audioId) { //if (!sessionStorage.PlaylistCount || parseInt(sessionStorage.PlaylistCount) < 19) { // Check if songs count is less than 20 if (!SongsExists(audioId)) {// check if song is duplicated if (sessionStorage.PlaylistName != "undefined" && sessionStorage.PlaylistName != '') { if (sessionStorage.PlaylistSongs) { var songs = sessionStorage.PlaylistSongs + ',' + audioId; // add song to playlist with comma } else { var songs = audioId; // add song to playlist as first item } if (sessionStorage.PlaylistCount) { // if not first item var count = parseInt(sessionStorage.PlaylistCount) + 1; // increment } else { count = 1; //initialize } } else { count = 0; } sessionStorage.PlaylistSongs = songs; sessionStorage.PlaylistCount = count; $(".playlist-count").html(count); if ($("#audio-ids")) { $("#audio-ids").val($("#audio-ids").val() + ',' + sessionStorage.PlaylistSongs) // add the new song to the hidden field } } //} //else { // alert('لقد اخترت العدد الاقصى المسموح به.'); //} } //Function to toggle Add to my playlist Icon if the song is already in playlist function toggleSelectedSongs() { if (sessionStorage.PlaylistSongs) { if (sessionStorage.PlaylistSongs != "" || sessionStorage.PlaylistSongs != ',') { $(".Add-ToMyList, .MostplayedAdd, .add, .add-list").each(function (i, v) { if (sessionStorage.PlaylistSongs.indexOf($(v).attr("data-song-id")) != -1) { $(v).find('.ico').attr("src", "/Content/images/addList_cr.png"); } }); } } } // This function will check if songs exits in sessionStorage function SongsExists(audioId) { var exists = true; if (!sessionStorage.PlaylistCount || sessionStorage.PlaylistSongs.indexOf(audioId) == -1) { exists = false } return exists; } function loadMoreShareYourVoice() { var start = $("#hdn-shareyourvoice-start").val(); // get current limit value from the page $('#show-more').addClass('form-loader'); $.ajax({ url: "/GetShareYourVoice", data: { start: start, limit: 8 }, success: function (result) { if (result != '') { $($("#user-talents")).append(result); $("#hdn-shareyourvoice-start").val(parseInt($("#hdn-shareyourvoice-start").val()) + 8); // increment the limit hdn field on the page var count = (result.match(/
    /g) || []).length if (count < 8) { $("#show-more").hide(); // hide loadmore button } $('#show-more').removeClass('form-loader'); } else { $("#show-more").hide(); } } }) } function getLiveStreamingLink() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); var link = 'https://streaming.radio.co/sec5a4b9e1/listen'; if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { link = 'https://streaming.radio.co/sec5a4b9e1/listen'; } return link; } function appendIframe() { if (window.self === window.top) { // if(!$('body').hasClass('body-iframe-parent')){ //if ($('frame[name="topframe"]').length == 0 && $('frame[name="bottomframe"]').length == 0) { //alert($('frame[name="topframe"]').length); //var fs = document.createElement('frameset'), var f1 = document.createElement('iframe'), iframe_container = document.createElement('div'), f_bottom = document.createElement('iframe'); //fs.frameBorder = 0; f1.setAttribute('frameborder', 0); f_bottom.setAttribute('frameborder', 0); iframe_container.className = "iframe-container"; f1.name = "topframe"; // f1.src = 'http://soutalkhaleej.fm/portal'; f1.src = '' + location.href; //f1.src = '' + location.href + '?sawt=1'; //f1.src = '' + location.href; f1.marginwidth = "0"; f1.marginheight = "0"; f1.noresize = "noresize"; f1.scrolling = "auto"; f1.id = "Site_Iframe"; f1.setAttribute('width', '100%'); //f1.onloadeddata = loadtheurl(f1); f_bottom.name = "bottomframe"; f_bottom.src = "/iframeLivestream?v=" + getLiveStreamingLink() + "&default=true"; f_bottom.marginwidth = "0"; f_bottom.marginheight = "0"; f_bottom.scrolling = "no"; f_bottom.frameborder = "0"; f_bottom.noresize = "noresize"; f_bottom.border = "0"; f_bottom.setAttribute('height', '75'); f_bottom.id = "defult_iframe"; // iframe_container.appendChild(f1); if (window.innerWidth > 1024 && document.documentElement.clientWidth > 1024) { iframe_container.appendChild(f1); iframe_container.setAttribute("style", "position:absolute;top:0;left:0;"); $("body").html(iframe_container); } else { f_bottom.className = "defult_iframe_mob"; $("body").append(iframe_container); } iframe_container.appendChild(f_bottom); $('.iframe-container html').addClass('html-iframe'); $("html").css('overflow', 'hidden'); } } function loadtheurl(x) { var jgeturl = decodeURI(location.href); window.history.replaceState("", "", x.src); } $(document).on('click', '#hide-play-list-popup', function () { $('.add-playlist-popoup').remove(); return false; }); function resizeIframe(obj) { obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px'; } function BindAddToPlaylistAction() { $('.Add-ToMyList').on("click", function () { //$(this).css('position', 'relative'); //$('.add-playlist-popoup').remove(); //$(this).append('
    '); var song_id = $(this).attr('data-song-id'); var parent = $(this); if (!sessionStorage.PlaylistName) { if ($(this).find('.add-playlist-popoup').length < 1) { $(this).css('position', 'relative'); $('.add-playlist-popoup').remove(); $(this).append('
    '); } $("#playlist-popup-btn").on("click", function () { if ($("#playlist-popup-name").val()) { sessionStorage.PlaylistName = $("#playlist-popup-name").val(); addToPlaylist(song_id); parent.find($('.ico')).attr("src", "/Content/images/addList_cr.png"); }; $('.add-playlist-popoup').remove(); return false; }); } if (typeof sessionStorage.PlaylistName != "undefined" && sessionStorage.PlaylistName != '') { addToPlaylist(song_id); $(this).find($('.ico')).attr("src", "/Content/images/addList_cr.png"); } }); } function LoadCaptcha() { $.ajax( { type: "Get", cache: false, url: "/CaptchaImage/ShowImageCaptcha", success: function (data) { $("#CaptchId").html(data); }, error: function (err) { } }); } function validateCapchaImage() { var isValid = false; $(".newCaptchaContiner").find(".error_v").fadeOut(); var hdnCode = $('#hdnCode').val(); var txtSubmittedCode = $("#txtSubmittedCode").val(); $.ajax({ url: '/CaptchaImage/Captcha/ValidateCaptchaImage', type: 'POST', data: JSON.stringify([hdnCode, txtSubmittedCode]), async: false, contentType: "application/json;charset=utf-8", success: function (data) { if (data == "match") {//the capcha is valid isValid = true; } else { $(".newCaptchaContiner").find(".error_v").text("الرجاء إدخال الحروف الصحيحة"); $(".newCaptchaContiner").find(".error_v").fadeIn(); LoadCaptcha(); isValid = false; } }, error: function (err) { } }); return isValid; }