//$("#homeslider").on('initialized.owl.carousel', function (event) {
// console.log("triggered");
// try {
// $("#homesliderLoader").parent().remove();
// $(".allproduct-sh-main-loader").remove();
// } catch (er) {
// }
//});
//$(window).bind("beforeunload", function () {
//
// return "Back button has disabled for this form";
//
//});
$(document).ready(function () {
// window.history.forward();
// getLastLoggedNumber();
getUserProfile();
if (isMobile) {
// var showAppModalCookie = getCookie("showAppModal");
// if (showAppModalCookie === false) {
//// $("#downloadAppModal").modal('show');
// $(".gettapp-tophead").removeClass("hidden");
// $(".main-wrap").css("top", "61px");
// hideAppModalAndBanner(48);
// }
$(".footer-player").hide();
// $(".footer-player").draggable();
}
if ((getParameterByName("ep") == "1")) {
$(".newsgoogflow-selectpcoff-subc").hide();
}
if ((getParameterByName("cmpjc") == "CMP-88")) {
try {
gtag('event', 'conversion', {'send_to': 'AW-10779280940/ur9LCOjO-f4YEKyM-5Mo'});
} catch (er) {
console.log("GTAG is not defined: " + er);
}
}
var theme = localStorage.getItem("theme");
if (theme) {
$('body').attr("class", theme + "-theme");
}
$('body').removeClass("hidden");
try {
// $("#switchTheme").trigger("click");
Noty.overrideDefaults({
callbacks: {
onTemplate: function () {
if (this.options.type === 'reply') {
this.barDom.innerHTML = '
';
// this.barDom.innerHTML += '';
this.barDom.innerHTML += '';
this.barDom.innerHTML += '
' + this.options.from + '
';
this.barDom.innerHTML += '
' + this.options.text + '
';
this.barDom.innerHTML += '

';
this.barDom.innerHTML += '
';
}
},
onClick: function () {
if (this.options.type === 'reply') {
$(".videoPopup").trigger("click");
}
}
}
});
if (theme.indexOf("black") > -1) {
// $(".btnChangeTheme").html("Light Mode");
$("#subcribemodal2").addClass("modal-subcblack-charge");
} else {
// $(".btnChangeTheme").html("Dark Mode");
}
} catch (er) {
}
// if (window.history && window.history.pushState) {
//// window.history.pushState('forward', null, './#forward');
// $(window).on('popstate', function () {
//// alert('Back button was pressed.');
// switchContent(window.location.pathname);
// });
// }
// getSearchedHistory();
$('head').append('');
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js', {
scope: '.' // <--- THIS BIT IS REQUIRED
}).then(function (reg) {
// console.log('Successfully registered service worker', reg);
}).catch(function (err) {
console.warn('Error whilst registering service worker', err);
});
}
window.addEventListener('online', function (e) {
// Resync data with server.
// console.log("You are online");
// logEvent("PWA-Online", "");
// Page.hideOfflineWarning();
// Arrivals.loadData();
}, false);
window.addEventListener('offline', function (e) {
// Queue up events for server.
// console.log("You are offline");
// logEvent("PWA-offline", "");
// Page.showOfflineWarning();
}, false);
var deferredPrompt;
$("#pwaModal").modal("hide");
window.addEventListener('beforeinstallprompt', function (event) {
// Prevent Chrome 67 and earlier from automatically showing the prompt
event.preventDefault();
// Stash the event so it can be triggered later.
deferredPrompt = event;
var showAppModalCookie = getCookie("showPWAModal");
if (showAppModalCookie === false) {
$("#pwaModal").modal("show");
hidePWAModalAndBanner(48);
}
$(document).on("click", "#btnPwa", function (e) {
// console.log("clicked");
// hide our user interface that shows our A2HS button
$("#pwaModal").modal("hide");
// Show the prompt
deferredPrompt.prompt();
// Wait for the user to respond to the prompt
deferredPrompt.userChoice.then(function (choiceResult) {
if (choiceResult.outcome === 'accepted') {
logEvent("PWA-Installed", "Installed");
// console.log("installed");
} else {
// console.log("dismissed");
logEvent("PWA-Dismissed", "cancelled");
// They dismissed, send to analytics
}
deferredPrompt = null;
});
});
});
// Check if the user is connected.
// if (navigator.onLine) {
// Arrivals.loadData();
// } else {
// // Show offline message
// Page.showOfflineWarning();
// }
// whetherApkToDownload();
var today = new Date();
var curHr = today.getHours();
if (curHr < 5) {
$(".morning-text").html("Good Night");
// console.log('good morning');
} else if (curHr < 11) {
$(".morning-text").html("Good Morning");
// console.log('good morning');
} else if (curHr < 17) {
// console.log('good afternoon');
$(".morning-text").html("Good Afternoon");
} else if (curHr < 20) {
// console.log('good evening');
$(".morning-text").html("Good Evening");
} else if (curHr < 24) {
// console.log('good Night');
$(".morning-text").html("Good Night");
} else {
// console.log('good Night');
$(".morning-text").html("Good Night");
}
getFavArtist("modal");
displayGoogleNameAndImage();
});
Date.prototype.toIsoString = function () {
var tzo = -this.getTimezoneOffset(),
dif = tzo >= 0 ? '+' : '-',
pad = function (num) {
var norm = Math.floor(Math.abs(num));
return (norm < 10 ? '0' : '') + norm;
};
return this.getFullYear() +
'-' + pad(this.getMonth() + 1) +
'-' + pad(this.getDate()) +
'T' + pad(this.getHours()) +
':' + pad(this.getMinutes()) +
':' + pad(this.getSeconds()) +
dif + pad(tzo / 60) +
':' + pad(tzo % 60);
}
// checkbox-premium modal
$(document).on("click", ".mobileUnmute", function (e) {
$(".mobileUnmute").parent().addClass("mejs__mute").removeClass("mejs__unmute");
$(".mobileUnmute").parent().hide(1000);
var player = document.getElementById('vdoPlayer');
player.setMuted(false);
player.setVolume(0.8);
// mediaStream.mute = false;
// mediaStream.volume = 0.2;
});
$(document).on("click", "#likeLiveEvent", function (e) {
// var eventId = $("#liveEventTitle").attr("eventId");
try {
if (!$("#likeLiveEvent").parent().hasClass("active") && liveEvent && sessionStorage.getItem("eventId") != liveEvent.id) {
getLikesViewsStreams(liveEvent.id, "true");
}
} catch (er) {
getLikesViewsStreams(liveEvent.id, "true");
}
});
$(document).on("click", "#liveStreamPopup", function (e) {
var eventId = $("#liveEventTitle").attr("eventId");
window.location.href = "/live";
});
$(document).on("click", ".package-li", function (e) {
$('.packages-subc li').removeClass("active");
selectedPackage = $(this).data("id");
selectedPayment = $(this).attr("payment");
otpClientTitle = $(this).attr("otpClientTitle");
$(this).addClass("active");
});
$(document).on("click", ".audioQ", function (e) {
$('.audioQ').parent().removeClass("active");
$(this).closest('li').addClass("active");
var quality = $(this).attr('data-src');
// console.log(quality);
$('.footer-player').find('audio').each(function () {
var _player;
if (typeof (this.player) === 'undefined') {
_player = this;
} else {
_player = this.player;
}
var currentTime = _player.getCurrentTime();
$("#audioPlayer").attr("src", quality);
$("#audioPlayer_html5").attr("src", quality);
_player.setSrc(quality);
_player.setCurrentTime(currentTime);
_player.play();
});
// $("#audioPlayer").attr("src", quality);
// $("#audioPlayer_html5").attr("src", quality);
});
// checkbox-premium modal
//$(document).on("change", ".check-primum input[type='radio']", function (e) {
// $('.price-select-primum li').removeClass("active");
// selectedPackage = $(this).data("id");
// selectedPayment = $(this).attr("payment");
// if ($(this).is(":checked")) {
// $(this).closest('.price-select-primum li').addClass("active");
// } else {
// $(this).closest('.price-select-primum li').removeClass("active");
// }
//});
//$(function () {
// var charLimit = 1;
// $(".pincode").keydown(function (e) {
// console.log("herer");
// var keys = [8, 9, /*16, 17, 18,*/ 19, 20, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 144, 145];
//
// if (e.which == 8 && this.value.length == 0) {
// $(this).prev('.inputs').focus();
// } else if ($.inArray(e.which, keys) >= 0) {
// return true;
// } else if (this.value.length >= charLimit) {
// $(this).next('.inputs').focus();
// return false;
// } else if (e.shiftKey || e.which <= 48 || e.which >= 58) {
// return false;
// }
// }).keyup(function () {
// console.log("herer");
// if (this.value.length >= charLimit) {
// $(this).next('.inputs').focus();
// return false;
// }
// });
//});
$(document).on("click", ".btnHistorySearch", function (e) {
e.preventDefault();
e.stopPropagation();
var content = $(this).data("content");
$('#searched_text').val(content.keyword);
$('#searched_text2').val(content.keyword);
searchContent(event, 'clicked');
// getVideoStreamLink(content.contentId);
});
$(document).on("click", ".openWhatsApp", function (e) {
e.preventDefault();
e.stopPropagation();
/**
* Trigger Support clevertap event
*/
// try {
//
// clevertap.event.push("Support", {
// "Chat opened": 1,
// "Platform": "WEB"
// });
// } catch (er) {
// console.log("Error logging clevertap events" + er);
// }
window.location.href = "https://wa.me/923275525655";
/**
* end trigger
*/
});
$(document).on("click", ".logout", function (e) {
e.preventDefault();
e.stopPropagation();
/**
* Trigger logout clevertap event
*/
// try {
//
// clevertap.event.push("Log Out", {
// "Logout": 1,
// "Platform": "WEB"
// });
// } catch (er) {
// console.log("Error logging clevertap events" + er);
// }
/**
* end trigger
*/
$(".dropdown-menu-right").hide();
socialLogout();
window.location.href = "/logout";
// getVideoStreamLink(content.contentId);
});
$(document).on("click", ".playSimContent", function (e) {
e.preventDefault();
e.stopPropagation();
var content = $(this).parent().parent().data("content");
// console.log(content);
replaceParameterByName("vdo", content.contentId);
// switchContent("vdo/" + content.contentId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
window.location.href = "/video/" + content.contentId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-');
// getVideoStreamLink(content.contentId);
});
$(document).on("click", ".submit-categories", function (e) {
e.preventDefault();
e.stopPropagation();
if (mainCategoriesAdded !== "" && $(".list-genre-select.active").length > 0) {
var selectedCategoriesAndTheirGenreInFormat = "";
for (var key in mainCategoriesAdded) {
if ((mainCategoriesAdded[key].length == 2) || (mainCategoriesAdded[key].length == 3 && mainCategoriesAdded[key].indexOf(",") > -1)) {
mainCategoriesAdded[key] = "";
} else {
selectedCategoriesAndTheirGenreInFormat = selectedCategoriesAndTheirGenreInFormat + mainCategoriesAdded[key] + ";";
}
}
/**
* Trigger Like/Follow Artist, Playlist, Album clevertap event
*/
// try {
//
// clevertap.event.push("Genre/Category Selection", {
// "Genre Ids": selectedCategoriesAndTheirGenreInFormat.replace(",;", ";"),
// "Platform": "WEB"
//
// });
// } catch (er) {
// console.log("Error logging clevertap events" + er);
// }
/**
* end trigger
*/
switchContent("cgenres?mainCats=" + selectedCategoriesAndTheirGenreInFormat.replace(",;", ";"));
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/cgenres?mainCats=" + selectedCategoriesAndTheirGenreInFormat.replace(",;", ";");
} else {
displayWarningNoty("Genre ka intekhab karein", false, 1500);
}
// getContentByGenre(selectedCategoriesAndTheirGenreInFormat.replace(",;", ";"));
});
$(document).on("click", ".artistToPlay", function (e) {
e.preventDefault();
e.stopPropagation();
var content = $(this).data("content");
if (!content) {
content = $(this).closest(".contentDataDiv").data("content");
}
if (!content) {
var href = $(this).attr("href");
if (href) {
window.location.href = href;
}
}
var id = content.contentId ? content.contentId : content.id;
if (!id) {
id = content.singerId === 0 ? content.starId : content.singerId;
}
switchContent("artist/" + id + "/" + content.title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
return false;
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/artist?art=" + id;
});
/*$(document).on("click", ".btnSubscribe", function (e) {
e.preventDefault();
e.stopPropagation();
// console.log('btnSubscribe');
try {
firebaseObj.analytics()
.logEvent("subscribe_clicked", {description: "" + window.location.pathname, clickCode: getParameterByName("clickcode")});
logDBEvent("subscribe_clicked", "event", "success");
} catch (er) {
}
if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
showLoginMenu();
} else {
if ($("#packgText").html().trim() == "") {
loadPackages();
}
if (isJazzUser != null || isTelenorUser != null || isUfoneUser != null) {
if (isJazzUser == true || isTelenorUser == true || isUfoneUser == true) {
$("#subcribemodal2").modal("show");
} else {
var ot_pay = getParameterByName("otherPayment");
if (ot_pay != null && ot_pay == "true") {
$(".main-tab li").removeClass("active");
$("#my-tabs1").removeClass("active").removeClass("in");
$("#OT_PAYMENT").show();
$("#OT_PAYMENT").addClass("active");
$("#my-tabs10").addClass("active").addClass("in");
} else {
window.location.href = "/account?otherPayment=true";
}
}
}
}
});*/
$(document).on("click", ".btnSubscribe", function (e) {
e.preventDefault();
e.stopPropagation();
window.location.href = "/payments";
});
$(document).on("click", ".landing-cross", function (e) {
e.preventDefault();
e.stopPropagation();
window.location.href = "/home";
});
//$(document).on("click", ".subscribeSubmit", function (e) {
// e.preventDefault();
// e.stopPropagation();
// $("#telenorConsent").modal("show");
// });
$(document).on("click", ".subscribeSubmit", function (e) {
e.preventDefault();
e.stopPropagation();
// console.log('HERE');
// if (isTelenorUser == true) {
// doubleConfirmationForUfone();
// var id = $(".packages-subc").find("li.active").attr('data-id');
// window.location.href = "/verification?id="+id;
// subscribeConfirmation();
// } else
if (isUfoneUser == true) {
doubleConfirmationForUfone();
var id = $(".packages-subc").find("li.active").attr('data-id');
window.location.href = "/verification?id=" + id;
// $("#gen_pin")[0].onclick();
} else if (isZongUser == true) {
doubleConfirmationForUfone();
var id = $(".packages-subc").find("li.active").attr('data-id');
window.location.href = "/verification?id=" + id;
// $("#gen_pin")[0].onclick();
} else {
if (userProfile && userProfile.msisdn && userProfile.isDataUser && (userProfile.isDataUser == true || userProfile.isDataUser == "true") && isJazzUser !== true && isTelenorUser !== true) {
$("#verifyModal").modal("show");
$("#subcribemodal2").modal("hide");
doubleConfirmationForUfone();
return;
}
otherPayment = false;
if (isJazzUser == true || isTelenorUser == true || isUfoneUser == true || isZongUser == true) {
if ($(".title-user") && $(".title-user").html().trim() === "LOGIN" && isToShowVerify) {
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/login";
// showLoginMenu();
$("#verifyModal").modal("show");
$("#subcribemodal2").modal("hide");
} else {
subscribeUser();
}
} else {
window.location.href = "/payments";
}
}
// $("#subcribemodal2").modal("show");
});
/*$(document).on("click", ".subscribeSubmit", function (e) {
e.preventDefault();
e.stopPropagation();
console.log('HERE');
if (isTelenorUser == true) {
$("#verifyModal").modal("show");
$("#subcribemodal2").modal("hide");
doubleConfirmationForUfone();
// subscribeConfirmation();
} else if (isUfoneUser == true) {
$("#verifyModal").modal("show");
$("#subcribemodal2").modal("hide");
doubleConfirmationForUfone();
// $("#gen_pin")[0].onclick();
} else {
if (userProfile && userProfile.msisdn && userProfile.isDataUser && (userProfile.isDataUser == true || userProfile.isDataUser == "true")) {
$("#verifyModal").modal("show");
$("#subcribemodal2").modal("hide");
doubleConfirmationForUfone();
return;
}
otherPayment = false;
if (isJazzUser == true || isTelenorUser == true || isUfoneUser == true) {
if ($(".title-user") && $(".title-user").html().trim() === "LOGIN" && isToShowVerify) {
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/login";
// showLoginMenu();
$("#verifyModal").modal("show");
$("#subcribemodal2").modal("hide");
} else {
subscribeUser();
}
} else {
window.location.href = "/account?otherPayment=true";
}
}
// $("#subcribemodal2").modal("show");
});*/
function doubleConfirmationForUfone() {
// console.log("Get pin for verification");
// var msisdn = $(".title-user").html().trim();
var msisdn = userProfile.msisdn;
var params = "uuid=" + msisdn + "&otpClientTitle=" + otpClientTitle;
$.ajax({
type: 'POST',
url: '/api/v2/login/generatePin',
data: params,
dataType: "JSON"
}).done(function (response) {
if (response.isSuccess) {
if (response.respCode != "00") {
displayErrorNoty(response.msg, false, 1500);
} else {
isDoubleConfirmation = true;
displaySuccessNoty(response.msg, false, 1500);
}
} else {
displayErrorNoty(response.msg, false, 1500);
}
$("#gen_pin").attr("disabled", false);
}).fail(function (response) {
displayErrorNoty("Something went wrong.", false, 1500);
$("#gen_pin").attr("disabled", false);
}).always(function () {
$("#gen_pin").attr("disabled", false);
});
}
function doubleConfirmationForEasypaisa() {
// console.log("Get pin for verification");
// var msisdn = $(".title-user").html().trim();
var msisdn = localStorage.getItem("easypaisaNumber");
$(".payEasypaisaBtn").attr("disabled", "disabled");
var params = "uuid=" + msisdn + "&otpClientTitle=" + otpClientTitle;
$.ajax({
type: 'POST',
url: '/api/generatePinEasypaisa',
data: params,
dataType: "JSON"
}).done(function (response) {
if (response.isSuccess) {
if (response.respCode != "00") {
displayErrorNoty(response.msg, false, 1500);
} else {
isDoubleConfirmation = true;
displaySuccessNoty(response.msg, false, 1500);
}
} else {
displayErrorNoty(response.msg, false, 1500);
}
$("#gen_pin").attr("disabled", false);
}).fail(function (response) {
displayErrorNoty("Something went wrong.", false, 1500);
$("#gen_pin").attr("disabled", false);
}).always(function () {
$("#gen_pin, .payEasypaisaBtn").attr("disabled", false);
});
}
$(document).on("click", ".playlistToPlay", function (e) {
e.preventDefault();
e.stopPropagation();
var sectionId = $(this).attr("rel");
var content = $(this).data("content");
if (!content) {
content = $(this).closest(".contentDataDiv").data("content");
}
currentPlaylist = content;
var id = "";
if (content.playlistId) {
id = content.playlistId;
}
if (!id) {
id = content.id;
}
switchContent("playlist/" + id + "/" + content.title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/playlist?sec=" + sectionId + "&pl=" + content.playlistId;
});
$(document).on("click", ".secPlaylistToPlay", function (e) {
e.preventDefault();
e.stopPropagation();
var sectionId = $(this).attr("rel");
var content = $(this).data("content");
currentPlaylist = content;
var id = "";
if (content.playlistId) {
id = content.playlistId;
}
if (!id) {
id = content.id;
}
switchContent("sectionPlaylist/" + sectionId + "/" + content.title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-') + "/" + id);
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/playlist?sec=" + sectionId + "&pl=" + content.playlistId;
});
$(document).on("click", ".homeTab", function (e) {
e.preventDefault();
e.stopPropagation();
var pageType = $(this).attr("data-type");
loadAllSectionV2WithContent("/api/home/sections/v2", pageType, 0, 30);
});
$(document).on("click", ".radioToPlay", function (e) {
e.preventDefault();
e.stopPropagation();
var data = $(this).data("content");
var thumb = data.thumbnailList;
thumb = thumb && thumb.mobileSquare ? thumb.mobileSquare : defaultThumbSquare();
$(".mejs__track-cover img").attr("src", thumb);
if (data.contentType) {
$('.mejs__track-title').html(data.contentType);
}
if (data.stationName) {
$('.mejs__track-artist').html("-");
$('.mejs__track-artist a').html(data.stationName);
}
$("#audioPlayer").attr("src", data.stationUrl);
$("#audioPlayer_html5").attr("src", data.stationUrl);
$('.footer-player').find('audio').each(function () {
var _player;
if (typeof (this.player) == 'undefined') {
_player = this;
} else {
_player = this.player;
}
_player.pause();
_player.load();
_player.play();
});
$(".footer-player").removeClass('contro-play');
if (!isMobile) {
$('.contro-down-player').addClass('contro_hide');
$('.contro-up-player').addClass('contro_show');
}
$(".footer-player").show();
$(".single-album-playlist").removeClass("current-playing");
$(".album-playlist-item").removeClass("current-playing");
$(".footer-player").show();
$(".top-fixed").css("background-image", "url('" + thumb + "')");
if ((!$('.footer-player').hasClass('contro-play')) && !isMobile && ($('.contro-up-player').hasClass("contro_hide") || $('.contro-down-player').hasClass("contro_show"))) {
$('.contro-down-player').addClass('contro_hide').removeClass("contro_show");
$('.contro-up-player').addClass('contro_show').removeClass("contro_hide");
}
try {
firebaseObj.analytics()
.logEvent("radio_play", {description: "" + data.stationName});
logDBEvent("radio_play", "event", data.stationName);
} catch (er) {
}
$(".mejs__broadcast").hide();
$(".contro-up-player,.contro-down-player").hide();
});
$(document).on("click", ".artistToAddFavorite", function (e) {
e.preventDefault();
e.stopPropagation();
var data = $(this).data("content");
if ($(this).hasClass("active")) {
var index = $.inArray(parseInt(data.singerId === 0 ? data.starId : data.singerId), favArtistIds);
if (index > -1) {
favArtistIds.splice(index, 1);
}
// favArtistIds.pop(data.singerId);
} else {
favArtistIds.push(data.singerId === 0 ? data.starId : data.singerId);
}
$(this).toggleClass("active");
});
$(document).on("click", ".submitFavArtist", function (e) {
e.preventDefault();
e.stopPropagation();
if (favArtistIds.length < 4) {
displayWarningNoty("Select Atleast 4 Artist.", false, 1500);
} else {
updateFavArtist(favArtistIds, "");
}
});
$(document).on("click", ".browsePlaylist", function (e) {
e.preventDefault();
e.stopPropagation();
var data = $(this).data("content");
});
$(document).on("click", ".selectArtist", function (e) {
e.preventDefault();
e.stopPropagation();
if ($("#allArtist").html() == "") {
loadAllArtsitToSelect(0, 40, "modal");
}
if ($("#recommendedArtistList").html() == "") {
loadAllRecommendedArtist(0, 40, "modal");
}
getFavArtist("modal");
$("#artistModal").modal("show");
});
$(document).on("click", ".videoToPlay, .videoPopup", function (e) {
e.preventDefault();
e.stopPropagation();
// console.log("vdo to play");
// uncomment when video is not free
// if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
// showLoginMenu();
//// } else if (userProfile && userProfile.status == 0) {
//// $(".btnSubscribe").trigger("click");
// } else {
var isNotyPopup = $(this).data("isNotyPopup");
var content = $(this).data("content");
if (isNotyPopup) {
if (!content) {
content = $(this).closest(".contentDataDiv").data("content");
}
if (content && content.respData) {
content = content.respData;
}
// if (content.video === 1 && content.secondaryContent) {
if (content.videoId != 0) {
// switchContent("vdo/" + content.videoId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
window.location.href = "/video/" + content.videoId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-');
} else if (content.contentId != 0) {
window.location.href = "/song/" + content.contentId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-');
} else if (content.albumId != 0) {
window.location.href = "/album/" + content.albumId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-');
} else if (content.artistId != 0) {
window.location.href = "/artist/" + content.artistId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-');
} else if (content.playlistId != 0) {
window.location.href = "/playlist/" + content.playlistId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-');
} else {
Noty.closeAll();
displayErrorNoty("Something went wrong", false, 1500);
}
} else {
if (!content) {
content = $(this).closest(".contentDataDiv").data("content");
}
if (content && content.respData) {
content = content.respData;
}
// if (content.video === 1 && content.secondaryContent) {
if (content.videoId) {
// switchContent("vdo/" + content.videoId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
window.location.href = "/video/" + content.videoId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-');
} else {
if (content.contentId) {
window.location.href = "/song/" + content.contentId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-');
}
Noty.closeAll();
displayErrorNoty("Something went wrong", false, 1500);
}
// }
}
});
$(document).on("click", ".albumToPlay", function (e) {
e.preventDefault();
e.stopPropagation();
// var sectionId = $(this).attr("rel");
var content = $(this).data("content");
if (!content) {
content = $(this).closest(".single-album-playlist").data("content");
}
if (!content) {
content = $(this).closest(".contentDataDiv").data("content");
}
if (!content) {
content = $(this).data("content");
}
if (content && content.respData) {
content = content.respData;
}
if (!content) {
var href = $(this).attr("href");
if (href) {
window.location.href = href;
}
}
var album = content.albumId ? content.albumId : (content.contentId ? content.contentId : content.id);
// switchContent("album/" + album + "/" + content.title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
switchContent("albumTab/" + album + "/" + content.title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/album?pl=" + album;
});
$(document).on("click", ".videolike-icon", function (e) {
e.preventDefault();
e.stopPropagation();
// if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
// noty({
// dismissQueue: true,
// timeout: 1500,
// force: false,
// layout: "center",
// theme: 'defaultTheme',
// text: 'Please Login to Play.',
// type: 'warning'
// });
// } else {
// if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
//
// showLoginMenu();
//// } else if (userProfile && userProfile.status == 0) {
//// $(".btnSubscribe").trigger("click");
// } else {
var vdoId = $(this).attr("id");
var title = $(this).attr("data-title");
// switchContent("vdo/" + vdoId + "/" + title);
if (vdoId !== getPathVariableByIndex("2")) {
window.location.href = "/video/" + vdoId + "/" + title;
}
// }
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/video?&vdo=" + vdoId;
// }
});
$(document).on("click", ".close-more-optn", function (e) {
e.preventDefault();
e.stopPropagation();
$('.more-listshow').removeClass('active');
});
$(document).on("click", ".likeCurrentContent", function (e) {
e.preventDefault();
e.stopPropagation();
var id = $(this).attr("rel");
if (id) {
likeContent(id);
} else {
id = getPathVariableByIndex(2);
likeContent(id);
}
});
$(document).on("click", ".likeContent", function (e) {
e.preventDefault();
e.stopPropagation();
var content = $(this).closest(".contentDataDiv").data("content");
if (content && !content.contentId) {
likeContent(content.id);
} else {
likeContent(content.contentId);
}
$(this).closest(".dropdown").removeClass("open");
return true;
});
$(document).on("click", ".playlistdropdown", function (e) {
e.stopPropagation();
});
$(document).on("click", ".addBannerToPlaylist", function (e) {
e.preventDefault();
e.stopPropagation();
if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
showLoginMenu();
} else {
contentToAdd = $(this).parent().parent().parent().parent().data("content");
if (contentToAdd) {
contentToAdd = contentToAdd.bannerContent;
}
if ($(".userplaylists").html().trim() === "") {
loadUserPlayList();
}
$("#alreadyaddlist").modal("show");
}
});
$(document).on("click", ".addContentToPlaylist", function (e) {
e.preventDefault();
e.stopPropagation();
if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
showLoginMenu();
} else {
contentToAdd = $(this).closest(".contentDataDiv").data("content");
if (!contentToAdd) {
contentToAdd = currentVideo;
}
if ($(".userplaylists").html().trim() === "") {
loadUserPlayList();
}
$("#alreadyaddlist").modal("show");
}
});
$(document).on("click", ".btnCreateNewPlaylist", function (e) {
e.preventDefault();
e.stopPropagation();
if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
showLoginMenu();
} else {
openAddToPlaylist = true;
$("#alreadyaddlist").modal("hide");
$("#createmylist").modal("show");
}
});
$(document).on("click", ".addToCurrentPlaylist", function (e) {
e.preventDefault();
e.stopPropagation();
var plId = $(this).closest(".contentDataDiv").data("content");
addUserPlayListContent(plId, contentToAdd.contentId, $(this));
$("#alreadyaddlist").modal("hide");
});
$(document).on("click", ".myplaylistToOpen", function (e) {
e.preventDefault();
e.stopPropagation();
var content = $(this).closest(".contentDataDiv").data("content");
if (content && content.contentCount > 0) {
switchContent("playlist/" + content.id + "/" + content.name + "?count=" + content.contentCount);
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/playlist?mypl=" + content.id + "&ttl=" + content.name + "&count=" + content.contentCount;
} else {
displayWarningNoty("Baraiy meharbani songs add karein.", false, 1500);
}
});
$(document).on("click", ".btnShowall", function (e) {
e.preventDefault();
e.stopPropagation();
var url = window.location.pathname;
var secId = $(this).attr("data-section");
if (url !== "/radio" && secId !== 0) {
if (secId && secId == 4) {
switchContent("showall/" + secId + "/artists");
} else if (secId) {
switchContent("showall/" + secId + "/sections");
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/playlist?mypl=" + content.id + "&ttl=" + content.name + "&count=" + content.contentCount;
} else {
displayWarningNoty("Mazeed Music k liye Home page visit karein.", false, 1500);
}
}
});
$(document).on("click", ".myFollowedListToOpen", function (e) {
e.preventDefault();
e.stopPropagation();
var content = $(this).closest(".contentDataDiv").data("content");
currentPlaylist = content;
var type = $(this).attr("data-type");
if (content && content.totalContent > 0) {
if (type && type == "ALBUMS") {
switchContent("album/" + content.id + "/" + content.title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
// switchContent("album?pl=" + content.id);
} else if (type && type == "ARTISTS") {
switchContent("artist/" + (content.starId === 0 ? content.singerId : content.starId) + "/" + content.title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
// switchContent("artist?art=" + content.id);
} else if (type && type == "PLAYLISTS") {
switchContent("playlist/" + content.id + "/" + content.title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
// switchContent("playlist/" + content.id + "/" + content.title);
}
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/playlist?mypl=" + content.id + "&ttl=" + content.name + "&count=" + content.contentCount;
} else {
displayWarningNoty("No content available.", false, 1500);
}
});
$(document).on("click", ".btnShuffle", function (e) {
e.preventDefault();
e.stopPropagation();
$('#content-table').shuffleChildren();
});
$(document).on("click", ".chat-span", function (e) {
e.preventDefault();
e.stopPropagation();
if (isMobile) {
window.open('https://tawk.to/chat/5dad67c7df22d91339a02c3e/default', '_blank');
} else {
Tawk_API.toggle();
}
});
$(document).on("click", ".btnPlayAll", function (e) {
e.preventDefault();
e.stopPropagation();
if (!playAll) {
playAll = true;
$(this).find(".fa-play").addClass("fa-pause").removeClass("fa-play");
if ($(".mejs__playpause-button").hasClass("mejs__play")) {
$(".mejs__play").trigger("click");
}
$("#content-table .contentToPlay:eq('1')").trigger("click");
if (allalbumsongs && allalbumsongs.length) {
$.cookie('noo-playlist', JSON.stringify(allalbumsongs), {
expires: 360 * 10,
path: "/"
});
}
$.cookie('playall', 'true', {
expires: 360 * 10,
path: "/"
});
logEvent("play_all", $("#pl-title").html());
} else {
$.removeCookie('playall', {
path: '/'
});
playAll = false;
$(this).find(".fa-pause").addClass("fa-play").removeClass("fa-pause");
$(".mejs__pause").trigger("click");
}
});
$(document).on("click", "#btnCreatePlaylist", function (e) {
e.preventDefault();
e.stopPropagation();
var title = $("#playlistName").val();
if (title) {
createUserPlayList(title);
}
});
$(document).on("click", ".btnSkipGenre", function (e) {
e.preventDefault();
e.stopPropagation();
switchContent("index");
});
$(document).on("click", ".btnRemovePlaylist", function (e) {
e.preventDefault();
e.stopPropagation();
var content = $(this).closest(".contentDataDiv").data("content");
if (content && content.id) {
removeUserPlaylist(content.id, $(this).closest(".contentDataDiv"));
}
});
$(document).on("click", ".btnRemoveFollowed", function (e) {
e.preventDefault();
e.stopPropagation();
var content = $(this).closest(".contentDataDiv").data("content");
if (content && content.id) {
removeUserPlaylist(content.id, $(this).closest(".contentDataDiv"));
}
});
$(document).on("click", ".btnEditPlaylist", function (e) {
e.preventDefault();
e.stopPropagation();
playlist = $(this).closest(".contentDataDiv").data("content");
$("#changedPlaylistName").val("");
$("#updatemylist").modal("show");
});
$(document).on("click", "#btnEditPlaylistName", function (e) {
e.preventDefault();
e.stopPropagation();
var title = $("#changedPlaylistName").val();
if (title && title !== '' && playlist.name !== title) {
updateUserPlayList(playlist.id, title);
$("#changedPlaylistName").val("");
$("#updatemylist").modal("hide");
} else {
displayWarningNoty("Mukhtalif alfaaz ka indraj karein.", false, 1500);
}
});
$(document).on("click", ".btnShareOnFacebook", function (e) {
e.preventDefault();
e.stopPropagation();
// if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
//
// showLoginMenu();
// } else {
var content = $(this).closest(".contentDataDiv").data("content");
if (!content) {
content = currentVideo;
}
logEvent("share", "song-" + content.contentTitle);
// $(this).parent().parent().parent().removeClass("open");
$(".facebookShareThumb").attr("src", content.thumbnailList ? content.thumbnailList.square.length > 0 ? content.thumbnailList.square : (content.thumbnailList.square.length > 0 ? content.thumbnailList.square : content.albumThumbnail)
: content.respData.thumbnailList.square.length > 0 ? content.respData.thumbnailList.square : (content.respData.thumbnailList.square.length > 0 ? content.respData.thumbnailList.square : content.respData.albumThumbnail));
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': 'https://bajao.pk/video/' + content.contentId + "/" + content.contentTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'),
'og:title': content.contentTitle,
'og:description': 'I am viewing to ' + content.contentTitle + ' on bajao.pk. To view this content or choose another superhit content visit.... bajao.pk',
'og:image': content.thumbnailList ? content.thumbnailList.square.length > 0 ? content.thumbnailList.square : (content.thumbnailList.square.length > 0 ? content.thumbnailList.square : content.albumThumbnail)
: content.respData.thumbnailList.square.length > 0 ? content.respData.thumbnailList.square : (content.respData.thumbnailList.square.length > 0 ? content.respData.thumbnailList.square : content.respData.albumThumbnail)
}
})
},
function (response) {
// if (response && response.post_id !== undefined) {
// console.log('Shared');
// }
});
// console.log("Share on facebook...");
// }
});
$(document).on("click", ".btnShareLiveStream", function (e) {
e.preventDefault();
e.stopPropagation();
if (liveEvent) {
var content = $(this).closest(".contentDataDiv").data("content");
if (!content) {
content = currentVideo;
}
logEvent("share", "livestream-" + liveEvent.description);
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': 'https://bajao.pk/live',
'og:title': content.contentTitle,
'og:description': liveEvent.description + ' on bajao.pk. To view this content or choose another superhit content visit.... bajao.pk',
'og:image': liveEvent.artistImage
}
})
},
function (response) {
});
}
});
$(document).on("click", ".btnSharePlaylistOnFacebook", function (e) {
e.preventDefault();
e.stopPropagation();
// if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
//
// showLoginMenu();
// } else {
var content = currentPlaylist;
logEvent("share", "playlist-" + getPathVariableByIndex(3));
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': 'https://bajao.pk/playlist/' + getPathVariableByIndex(2) + "/" + getPathVariableByIndex(3).replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'),
'og:title': getPathVariableByIndex(3),
'og:description': 'I am viewing Playlist ' + getPathVariableByIndex(3) + ' on bajao.pk. To view this Playlists or choose another superhit content visit.... bajao.pk',
// 'og:image': content.playlistThumbnailList ? content.playlistThumbnailList.square : "https://bajao.pk/theme/images/logo.png"
'og:image': "https://bajao.pk/theme/images/logo.png"
}
})
},
function (response) {
});
// }
});
$(document).on("click", ".btnShareArtistOnFacebook", function (e) {
e.preventDefault();
e.stopPropagation();
// if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
//
// showLoginMenu();
// } else {
var content = currentArtist;
logEvent("share", "artist-" + content.title);
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': 'https://bajao.pk/artist/' + content.id + "/" + content.title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'),
'og:title': content.title,
'og:description': 'I am viewing Artist ' + content.title + ' on bajao.pk. To view artist songs or choose another superhit content visit.... bajao.pk',
'og:image': content.thumbnailList ? content.thumbnailList.square : "https://bajao.pk/theme/images/logo.png"
}
})
},
function (response) {
// if (response && response.post_id !== undefined) {
// console.log('Shared');
// }
});
// console.log("Share on facebook...");
// }
});
$(document).on("click", ".btnShareAlbumOnFacebook", function (e) {
e.preventDefault();
e.stopPropagation();
// if ($(".title-user") && $(".title-user").html().trim() === "LOGIN") {
//
// showLoginMenu();
// } else {
var content = currentAlbum;
logEvent("share", "album-" + content.albumTitle);
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': 'https://bajao.pk/album/' + content.albumId + "/" + content.albumTitle.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'),
'og:title': content.title,
'og:description': 'I am viewing Album ' + content.albumTitle + ' on bajao.pk. To view Album songs or choose another superhit content visit.... bajao.pk',
'og:image': content.thumbnailList ? content.thumbnailList.square : "https://bajao.pk/theme/images/logo.png"
}
})
},
function (response) {
// if (response && response.post_id !== undefined) {
// console.log('Shared');
// }
});
// console.log("Share on facebook...");
// }
});
$(document).on("click", ".btnUnSubscribe", function (e) {
e.preventDefault();
e.stopPropagation();
unsubscribe();
});
$(document).on("click", ".contro-remove-player", function (e) {
e.preventDefault();
e.stopPropagation();
$(".footer-player").hide();
// if ($("#audioPlayer")) {
// $("#audioPlayer").attr("src", "");
// }
});
$(document).on("click", "#btnTrendAlbums", function (e) {
if ($("#trendAlbums") && $("#trendAlbums").html().trim() === "") {
loadTrendingAlbums(0, 20);
}
return true;
});
$(document).on("click", ".main-cats", function (e) {
e.preventDefault();
e.stopPropagation();
// console.log("clicked");
var color = $(this).attr("rel");
var id = $(this).attr("id");
if ($("." + id).hasClass("hidden")) {
$("." + id).toggleClass("hidden");
$("." + id).removeClass("subCat-selected");
} else {
$("." + id).find(".img-circle-category").attr("class", "img-circle-category");
if (!isMobile) {
setTimeout(function () {
$("." + id).toggleClass("hidden");
}, 500);
} else {
$("." + id).toggleClass("hidden");
}
}
$(this).toggleClass("mainCat-selected");
$("#" + id + " .img-circle-category").toggleClass(color);
$("." + id).find(".img-circle-category").attr("class", "img-circle-category");
if (!isMobile) {
setTimeout(function () {
$("." + id).toggleClass("transform");
}, 50);
}
});
$(document).on("click", ".subcats", function (e) {
e.preventDefault();
e.stopPropagation();
var color = $(this).attr("rel");
var id = $(this).attr("id");
$(this).toggleClass("subCat-selected");
// console.log(color);
// $(this).find(".img-circle-category").removeClass("type-categoryN");
$(this).find(".img-circle-category").toggleClass(color);
});
$(document).on("click", ".mood", function (e) {
e.preventDefault();
e.stopPropagation();
var id = $(this).attr("id");
var title = $(this).attr("data-title");
id = id.replace("mood_", "");
switchContent("cmood?mood=" + id + "&title=" + title.replace(/\s+/g, '-').replace(/[^\w\s]/gi, '-'));
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/cmood?mood=" + id;
});
$(document).on("click", ".suggestedSearchArtist", function (e) {
e.preventDefault();
e.stopPropagation();
switchContent("showall/4/artists");
});
$(document).on("click", ".suggestedSearchCoke", function (e) {
e.preventDefault();
e.stopPropagation();
switchContent("showall/53/sections");
});
$(document).on("click", ".suggestedSearchAlbums", function (e) {
e.preventDefault();
e.stopPropagation();
switchContent("showall/0/albums");
});
$(document).on("click", ".cross-inner-tab", function (e) {
e.preventDefault();
e.stopPropagation();
$(".tab-content div.tab-pane").removeClass("active");
$(".tab-content div.tab-pane").removeClass("in");
$("#PLAYLISTS-tab").addClass("active");
$("#PLAYLISTS-tab").addClass("in");
});
$(document).on("click", ".userSection", function (e) {
e.preventDefault();
e.stopPropagation();
var type = $(this).attr("rel");
if ($("#" + type) && $("#" + type).html() === "") {
logEvent("view_item_list", type);
if (type.indexOf("F_") > -1) {
loadUserFollowedSection(type, 0, 50);
} else {
$(".tab-content div.tab-pane").removeClass("active");
$(".tab-content div.tab-pane").removeClass("in");
$("#" + type + "-tab").addClass("active");
$("#" + type + "-tab").addClass("in");
loadTabSectionContent(type, 0, 50);
}
} else {
if (type.indexOf("F_") > -1) {
loadUserFollowedSection(type, 0, 50);
} else {
$(".tab-content div.tab-pane").removeClass("active");
$(".tab-content div.tab-pane").removeClass("in");
$("#" + type + "-tab").addClass("active");
$("#" + type + "-tab").addClass("in");
if (type.indexOf("MYLIST") < 0) {
loadTabSectionContent(type, 0, 50);
}
}
}
});
$(document).on("click", "#moreAlbumTd", function (e) {
e.preventDefault();
e.stopPropagation();
// ga('send', {
// hitType: 'event',
// eventCategory: 'Albums',
// eventAction: 'viewmore',
// eventLabel: ''
// });
var id = getPathVariableByIndex(2);
if ($("#currentAlbumId") && $("#currentAlbumId").val()) {
id = $("#currentAlbumId").val();
}
loadContentByAlbumId(id, $(".single-album-playlist").length, 7);
});
$(document).on("click", "#aritstTopTracks", function (e) {
e.preventDefault();
e.stopPropagation();
$("#wek-tabs2").removeClass("active").removeClass("in");
$("#wek-tabs1").addClass("active").addClass("in");
$("#aritstTopTracks").addClass("active");
$("#artistLatestReleases").removeClass("active");
});
$(document).on("click", "#artistLatestReleases", function (e) {
e.preventDefault();
e.stopPropagation();
$("#wek-tabs1").removeClass("active").removeClass("in");
$("#wek-tabs2").addClass("active").addClass("in");
$("#artistLatestReleases").addClass("active");
$("#aritstTopTracks").removeClass("active");
});
$(document).on("click", "#moreArtistTd", function (e) {
e.preventDefault();
e.stopPropagation();
// ga('send', {
// hitType: 'event',
// eventCategory: 'Artists',
// eventAction: 'viewmore',
// eventLabel: ''
// });
loadContentByArtistId(getPathVariableByIndex(2), $(".single-album-playlist").length, 20);
});
$(document).on("click", ".btnCatDone", function (e) {
e.preventDefault();
e.stopPropagation();
var mainCats = "", subCats = "";
$(".mainCat-selected").each(function (index) {
if (index === 0) {
mainCats = $(this).attr("data-id");
} else {
mainCats += "," + $(this).attr("data-id");
}
});
$(".subCat-selected").each(function (index) {
if (index === 0) {
subCats = $(this).attr("data-id");
} else {
subCats += "," + $(this).attr("data-id");
}
});
/**
* Trigger Genre/Category Selection clevertap event
*/
// try {
//
// clevertap.event.push("Genre/Category Selection", {
// "Category Ids": mainCats,
// "Platform": "WEB"
//
// });
// } catch (er) {
// console.log("Error logging clevertap events" + er);
// }
/**
* end trigger
*/
setCategories(mainCats, subCats);
});
$(document).on("click", ".btnResetGenre", function (e) {
e.preventDefault();
e.stopPropagation();
$(".list-genre-select").removeClass("active");
mainCategoriesAdded = {};
removeGenres();
});
$(document).on("click", ".btnCatReset", function (e) {
e.preventDefault();
e.stopPropagation();
var mainCats = "", subCats = "";
removeCategories();
});
$(document).on("click", ".moreTd", function (e) {
e.preventDefault();
e.stopPropagation();
var type = $(this).attr("rel");
// ga('send', {
// hitType: 'event',
// eventCategory: 'Playlists',
// eventAction: 'viewmore',
// eventLabel: ''
// });
if (type !== "") {
// loadTabSectionContent(type, 0, 7);
if (type.indexOf("F_") > -1) {
loadUserFollowedSection(type, $("#" + type + " .single-album-playlist").length, 7);
} else {
loadTabSectionContent(type, $("#" + type + " .single-album-playlist").length, 7);
}
}
});
$(document).on("click", ".btnRemoveFromPlaylist", function (e) {
e.preventDefault();
e.stopPropagation();
var content = $(this).closest(".contentDataDiv").data("content");
replaceParameterByName("count", getParameterByName("count") - 1);
$("#pl-songs").html(getParameterByName("count") + (getParameterByName("count") === 1 ? " track" : " tracks"));
removeUserPlayListContent(getPathVariableByIndex(2), content.contentId, $(this));
});
$(window).bind("resize scroll ", function () {
//call first load owl-nav image height
// getHeight_owl();
// // get .custome-carousel3 image height end
// getHeight_customecarousel3();
// //get item-box image height
// getHeight_itembox();
});
// stickyheader sidebar tab
//$(document).bind('scroll', lazyLoadSections);
$(window).on('scroll', function () {
lazyLoadSections();
getHeight_owl();
getheight_cat();
if ($(window).scrollTop() > 20) {
$('.added-list-right').addClass('sticky-sidebar');
} else {
$('.added-list-right').removeClass('sticky-sidebar');
}
});
$('body').on('click', '#more-sh-mb a', function (e) {
e.preventDefault();
$('.more-listshow').addClass('active');
});
$('body').on('focus', '.top-searchcenter input, .center-searchtop input', function () {
$(".drop-down-searchhistry").fadeIn(400);
$(this).closest('.top-searchcenter').addClass('active');
$(".searchpage-cross").removeClass("hidden");
$(".searchpage-searchico").addClass("hidden");
});
$('body').on('blur', '.top-searchcenter input, .center-searchtop input', function () {
var p = $(this).closest('.top-searchcenter');
if (p.hasClass('active')) {
$(".drop-down-searchhistry").fadeOut(400);
} else {
$(".drop-down-searchhistry").fadeIn(400);
}
});
$(document).on('click', '.searchpage-cross .close-more-optn', function () {
$(".searchpage-cross").addClass("hidden");
$(".searchpage-searchico").removeClass("hidden");
$(".drop-down-searchhistry").fadeOut(400);
});
//
//$('body').on('click', '.top-search', function (e) {
// e.preventDefault();
// $('.search-con').addClass('toggled-on');
// $('#top-search-wrap').addClass('search-toggled');
// $('#top-search-wrap input').focus();
//});
//$('body').on('click', '.search-close', function (e) {
// e.preventDefault();
// $('.search-con').removeClass('toggled-on');
// $('#top-search-wrap').removeClass('search-toggled');
// $('#top-search-wrap').closest('search-toggled');
//});
var paymentMethodId = 0;
$(document).on("click", ".li_payment_type", function (e) {
$('.nwwaletpaymet-subcselect-subc li').removeClass("active");
$(this).addClass("active");
$(".pack-form").addClass("hidden");
var data = $(this).data("content");
$("#package_" + data.name.toLowerCase().replace(" ", "_")).parent().removeClass("hidden");
paymentMethodId = data.id;
if (paymentMethodId == 76) {
$("#type_div").addClass("hidden");
$("#email_div").addClass("hidden");
$("#msisdn_div").addClass("hidden");
$(".google-pay").addClass("hidden");
$("#cnic_div").addClass("hidden");
$(".btnConfirmSubscription").addClass("hidden");
$("#qrmodal").modal("show");
return;
} else if (paymentMethodId == 77) {
$("#type_div").addClass("hidden");
$("#email_div").addClass("hidden");
$("#msisdn_div").addClass("hidden");
$(".btnConfirmSubscription").addClass("hidden");
$(".google-pay").removeClass("hidden");
$("#cnic_div").addClass("hidden");
addGooglePayButton();
return;
} else {
$(".google-pay").addClass("hidden");
$(".btnConfirmSubscription").removeClass("hidden");
}
selectedTelco = data.name.toLowerCase();
selectedPackageForTelco = data.paymentPackagesMappingCollection[0].packages.id;
if (data.type.toLowerCase() == "wallet") {
$(".email-number-form").removeClass("hidden");
} else {
$(".email-number-form").addClass("hidden");
}
$(".btnConfirmSubscription").removeClass("subscribeTelco").removeClass("submitbutton").removeClass("confirmSimSimPayment");
if (paymentMethodId == 74) {
//window.location.href = "/jazzCashRedirect/request";
$("#type_div").addClass("hidden");
$("#email_div").addClass("hidden");
$("#msisdn_div").removeClass("hidden");
$("#cnic_div").addClass("hidden");
$(".btnConfirmSubscription").addClass("submitbutton");
}
if (paymentMethodId == 72) {
//window.location.href = "/jazzCashRedirect/request";
$("#type_div").addClass("hidden");
$("#email_div").addClass("hidden");
$("#msisdn_div").addClass("hidden");
$("#cnic_div").addClass("hidden");
$(".btnConfirmSubscription").addClass("submitbutton");
}
if (paymentMethodId == 73) {
$("#type_div").removeClass("hidden");
$("#email_div").removeClass("hidden");
$("#msisdn_div").removeClass("hidden");
$("#cnic_div").addClass("hidden");
$(".btnConfirmSubscription").addClass("submitbutton");
}
if (paymentMethodId == 75) {
$("#type_div").addClass("hidden");
$("#email_div").addClass("hidden");
$("#msisdn_div").removeClass("hidden");
// $(".btnConfirmSubscription").addClass("submitbutton");
$("#cnic_div").addClass("hidden");
$(".btnConfirmSubscription").addClass("confirmSimSimPayment");
// $("#otp_div").removeClass("hidden");
}
if (paymentMethodId == 5 || paymentMethodId == 43 || paymentMethodId == 36
|| paymentMethodId == 29 || paymentMethodId == 64 || paymentMethodId == 78 || paymentMethodId == 86) {
$("#type_div").addClass("hidden");
$("#email_div").addClass("hidden");
$("#msisdn_div").addClass("hidden");
$(".btnConfirmSubscription").addClass("submitbutton");
}
});
$(document).on("click", ".submitbutton", function (e) {
e.preventDefault();
e.stopPropagation();
otherPayment = true;
// console.log('subscribeSubmit');
var msisdn = $('#msisdn').val();
var email = $('#email').val();
var cnic = $('#cnic').val();
// var packageId = $('#packages_dropdown :selected').val();
var packageId = selectedPackageForTelco;
var methodId = paymentMethodId;
msisdn = standardizeMsisdn(msisdn);
if (methodId !== 64 && (msisdn === undefined || msisdn === "")) {
displayWarningNoty('Please enter valid mobile number', false, 3000);
} else if (methodId !== 64 && methodId !== 74 && (email === undefined || email === "") && methodId !== 75) {
displayWarningNoty('Please enter email address', false, 3000);
} else if (packageId === undefined || packageId === "") {
displayWarningNoty('Please select package', false, 3000);
} /*else if(methodId === 74 && (cnic === undefined || cnic === "" || cnic.length !== 13)){
displayWarningNoty('Please enter 13 digit CNIC', false, 3000);
}*/ else {
subscribeUser();
}
// $("#subcribemodal2").modal("show");
});
$(document).on("click", ".confirmSimSimPayment", function (e) {
e.preventDefault();
e.stopPropagation();
// $(".loader-generic").show();
var msisdn = $('#msisdn').val();
var packageId = selectedPackageForTelco;
var otp_pin = $('#otp_pin').val();
if (!otp_pin || otp_pin === "") {
displayErrorNoty("Please enter pin sent to you on your number");
$(".loader-generic").hide();
} else {
if (!userProfile) {
getUserProfile();
}
var loggedInUser;
if (userProfile && userProfile.msisdn && userProfile.msisdn != null) {
loggedInUser = userProfile.msisdn;
} else {
loggedInUser = userProfile.email;
}
var params = "otp=" + otp_pin
+ "&msisdn=" + msisdn
+ "&email=" + simSimCustomerEmail
+ "&packageId=" + packageId
+ "&customerId=" + simSimCustomerId
+ "&finjaToken=" + simSimToken
+ "&customerName=" + simSimCustomerName
+ "&operatorId=0"
+ "&log=" + loggedInUser;
// console.log(params);
$.ajax({
type: "POST",
url: "/subscribeSimSim",
data: params,
dataType: 'json'
}).done(function (response) {
// console.log(response);
if (response && response.isSuccess) {
displaySuccessNoty(response.msg);
$("#otp_div").addClass("hidden");
$("#msisdn").prop('disabled', false);
$("#continuePayment").removeClass("hidden");
$("#continueSimSimPayment").addClass("hidden");
$("#unsubmodal").modal("hide");
try {
firebaseObj.analytics().logEvent("simsim_subscribe_event", {description: response.respData.model.data.customerName});
logDBEvent("simsim_subscribe_event", "event", response.respData.model.data.customerName);
} catch (er) {
}
/**
* Tracking FB pixel
*/
try {
var price = "0";
if (packageId == '1') {
price = '10';
}
if (packageId == '2') {
price = '47.8';
}
if (packageId == '3') {
price = '119.5';
}
if (packageId == '10') {
price = '114.8';
}
fbq('track', 'Subscribe', {value: price, currency: 'PKR', predicted_ltv: '0.00'});
} catch (er) {
// console.log("Error logging fb pixel events" + er);
}
//end tracking
/**
* Trigger Charged clevertap event
*/
// try {
//
// clevertap.event.push("Charged", {
// "Package Id": packageId,
// "Msisdn": msisdn,
// "Platform": "WEB"
//
// });
// } catch (er) {
// console.log("Error logging clevertap events" + er);
// }
/**
* end trigger
*/
} else {
displayErrorNoty(response.msg);
}
}).fail(function (error) {
displayErrorNoty('Internal Server Error...');
}).always(function () {
$(".loader-generic").hide();
subscribeCount = 0;
});
}
// window.location = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 2)) + "/playlist?sec=" + sectionId + "&pl=" + content.playlistId;
});
$(document).on("click", ".subscriptionTelenor-yes, .confirm-btn", function (e) {
e.preventDefault();
e.stopPropagation();
// submitTelenorSubscriptionConsent();
window.location="/home";
});
$(document).on("click", ".subscriptionTelenor-no, .cancel-btn", function (e) {
e.preventDefault();
e.stopPropagation();
$("#telenorConsent").modal("hide");
});