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 = '
';
$.each(data, function (key, value) {
if (value != "") {
var linkText = value.split(":")[0].split(' ').slice(0, 4); // take only first 4 words from the result
if (value.split(":")[0].split(' ').length > 4) { // if the result is longer than than 4 words
var hrefText = linkText.join(' ') + ' ...'; // add dots to indicate that its shortened
}
else {
var hrefText = linkText.join(' ');
}
result_text += '