$(document).ready(function (e) { //Show result message if the message exists if ($("#overlay_form").html()) { show_msg(); } // Hide show more button if playlists are less than 8 if ($(".thumb").length < 8) { $("#show-more").hide() } //Empty the selected songs on successful submit if ($("#hdnSubmitPlayListResult").val()) { if ($("#hdnSubmitPlayListResult").val() == 'success') { ////Empty playlist songs //sessionStorage.PlaylistSongs = ''; //sessionStorage.PlaylistCount = 0; //Open playlist tab after successful submit $("#main_tab1 li:nth-child(1)").removeClass("activeLi"); $("#main_tab1 li:nth-child(2)").addClass("activeLi"); $(".tab").hide(); $("#tab2").show(); $("#Counter1 .listNum").text(sessionStorage.PlaylistCount); // disable button if enabled on success if ($("#btn-submit-playlist").attr("disabled") == undefined) { disablePlaylistSubmit(); } } } //$('.Songstable').find('tr').each(function (i) { // table numbering // $(this).children('td:eq(0)').text(i / 2 + 1 + ". "); //}); ////////////////////////////////////////////////////// // song type //////////// $("#songType").change(function () { var selectVal = $('#songType option:selected').val(); if (selectVal == 'أخرى') { $(".hiddenText").slideDown(); } else { $(".hiddenText").slideUp(); } }); ///////////////////////// $("#main_tab1").find("li").click(function (e) { $(this).addClass("activeLi"); $(this).siblings().removeClass("activeLi"); $(".tab").hide(); $("#tab" + ($(this).index() + 1)).show(); $("#Counter1 .listNum").text(sessionStorage.PlaylistCount); }); if (sessionStorage.PlaylistName) { $("#PlaylistTitle").val(sessionStorage.PlaylistName); } //Load selected songs to hidden field $("#audio-ids").val(sessionStorage.PlaylistSongs); // Get the songs details list if songs are added to playlist if (sessionStorage.PlaylistCount > 0) { // if selected var songsIds = sessionStorage.PlaylistSongs; $.ajax({ // desktop div url: "/GetAllSongsList", data: { resources: songsIds, mobile: false }, success: function (result) { if (result != '') { $(".songs-loading").hide(); $("#Songstable").html(result); //$("#Counter1 .listNum").text(($(".Songstable tr").length + 1) / 2); ////the circule counter // if new songs added to either playlist or suggested songs //$('#Songstable, #addedTable').bind("DOMSubtreeModified", function () { enablePlaylistSubmit() }); //enable playlist submit on change $("#form1 :input").bind("change", function () { enablePlaylistSubmit() }); } IntializeDropBox('.show-sharing', '.share_this'); } }); //$.ajax({ // mobile div // url: "/GetAllSongsList", // data: { resources: songsIds, mobile: true }, // success: function (result) { // if (result != '') { // $(".songs-loading").hide(); // $("#SongstableMobile").html(result); // } // } //}); } else { $(".songs-loading").hide(); $('#Songstable').html('ليس لديك اغاني مختارة*'); //$('#SongstableMobile').html('ليس لديك اغاني مختارة*'); } // Delete rows on songs table $("#songsTable").on("click", ".deleteIcon", function () { $("#Counter1 .listNum").text(parseInt($("#Counter1 .listNum").text()) - 1); // Decrement counter $(this).parents('.file_info').remove(); enablePlaylistSubmit(); return false; }); //Delete rows on suggested song table $("#addedTable").on("click", ".deleteIcon", function () { $("#Counter2 .listNum").text(parseInt($("#Counter2 .listNum").text()) - 1); // Decrement counter $(this).closest('tr').remove(); enablePlaylistSubmit(); return false; }); countWords(); // Hide show more button if playlists count is less than 8 if ($("#tab1 section:first-child").html()) { if (($("#tab1 section:first-child").html().match(/