1 var myPlaylist; 2 var current_playing_song_index=0; 3 var playlist_length=0; 4 var repeatFlag=false; 5 var isAlbum = false; 6 var albumId=""; 7 var isPlaylist = false; 8 var playlistId=""; 9 var songToPlayIndexAfterAds = 0; 10 var isAdPlaying = false; 11 var currentPlayingAd = {}; 12 13$(document).ready(function() 14{ 15 //$("#mustLoginSignUpModal").modal("show"); 16 17 time =0; 18 19 current_play_time_flag =true; 20 minumum_play_time = 30; 21 default_title = document.title; 22 23 myPlaylist = new jPlayerPlaylist( 24 { 25 jPlayer: "#jplayer_N", 26 cssSelectorAncestor: "#jp_container_N" 27 }, 28 29 30 [ 31 /*{ 32 title:"NIMEKUCHAGUA - Alice Kella", 33 artist:"Alice Kella", 34 mp3:"imgs/Akothee Ft. Diamond Platnumz - Sweet Love.mp3", 35 },*/ 36 37 ], 38 { 39 playlistOptions: 40 { 41 enableRemoveControls: true, 42 autoPlay: false, 43 }, 44 45 //when to update song count 46 timeupdate: function(time_update) 47 { 48 current_time = time_update.jPlayer.status.currentTime; 49 50 if(current_time > minumum_play_time) 51 { 52 53 if(current_play_time_flag & !isAdPlaying) //and we are not playing ads 54 { 55 id = time_update.jPlayer.status.media.id 56 57 updateNumOfPlay(id); 58 59 if(isAlbum) 60 { 61 albumListened(albumId); 62 isAlbum = false; 63 } 64 65 if(isPlaylist) 66 { 67 playlistListened(playlistId); 68 isPlaylist = false; 69 } 70 71 //increament for ads 72 totalListenedSongs ++; 73 } 74 75 current_play_time_flag=false; 76 } 77 78 }, 79 80 swfPath: "js/jPlayer", 81 supplied: "webmv, ogv, m4v, oga, mp3", 82 smoothPlayBar: true, 83 keyEnabled: true, 84 audioFullScreen: false, 85 preload:"auto" 86 }); 87 88 89 //when song ends event 90 $(document).on($.jPlayer.event.ended, myPlaylist.cssSelector.jPlayer, function(play_end_event) 91 { 92 //if it is last song in the playlist, recormend next song 93 if(isLastSong() && !repeatFlag && !isAdPlaying) 94 { 95 recommendNextSong(); 96 } 97 98 else if(!isLastSong() && !isAdPlaying) //we still have songs to play and not ad 99 { 100 //pause first 101 myPlaylist.pause(); 102 103 var nextSongTempIndex = current_playing_song_index+1; 104 playAdvertisement(nextSongTempIndex); //check if we need to play ads before playlist the next song 105 } 106 107 //if we just finished playing ads 108 if(isAdPlaying) 109 { 110 111 myPlaylist.play(songToPlayIndexAfterAds); 112 113 //reset 114 isAdPlaying = false; 115 totalListenedSongs = 0; 116 117 //remove ad from playlist 118 myPlaylist.remove(-1); 119 120 //show control buttons 121 $(".jp-previous").removeClass("hide"); 122 $(".jp-play").removeClass("hide"); 123 $(".jp-pause").removeClass("hide"); 124 $(".jp-next").removeClass("hide"); 125 $(".playlistBtn").removeClass("hide"); 126 $(".jp-progress").removeClass("hide"); 127 128 //remove info to track clicks 129 $("#jplayer_N").removeClass("ac-ad"); 130 $("#jplayer_N").removeAttr("adId"); 131 } 132 }); 133 134 135 //when song paused event 136 $(document).on($.jPlayer.event.pause, myPlaylist.cssSelector.jPlayer, function(){ 137 $('.musicbar').removeClass('animate'); 138 $('.jp-play-me').removeClass('active'); 139 $('.jp-play-me').parent('li').removeClass('active'); 140 }); 141 142 //when song Play event 143 $(document).on($.jPlayer.event.play, myPlaylist.cssSelector.jPlayer, function(play_event) 144 { 145 $('.musicbar').addClass('animate'); 146 147 //global variable 148 current_playing_song_index = myPlaylist.current; 149 150 //add current song into the title 151 current_song_title = play_event.jPlayer.status.media.title; 152 current_song_artists = play_event.jPlayer.status.media.artist; 153 154 document.title = current_song_title + " @AfroCharts.com - "; 155 156 current_play_time_flag=true; 157 158 current_play_time = play_event.jPlayer.status.currentTime; 159 160 //if minumum play time has reached then keey it to false 161 if(current_play_time >= minumum_play_time) 162 { 163 current_play_time_flag = false; 164 } 165 166 songPlayed(); 167 }); 168 169 170 //control playing next 171 //$(document).on('click', '.jp-play-next', function(e) 172 $(document).on('click', '.jp-next', function(e) 173 { 174 e && e.preventDefault(); 175 176 177 //call end event so that it can pick up the next song 178 //$("#jplayer_N").trigger($.jPlayer.event.ended); 179 180 //if it is last song in the playlist, recormend next song 181 if(isLastSong() && !repeatFlag) 182 { 183 current_playing_song_id = myPlaylist.playlist[myPlaylist.current].id; //last song Id 184 recommendNextSong(); 185 } 186 187 188 }); 189 190 //control playing previous 191 $(document).on('click', '.jp-previous', function(e) 192 { 193 e && e.preventDefault(); 194 //another internal method is called to play previos 195 196 }); 197 198 //control repeat ON 199 $(document).on('click', '.jp-repeat', function(e) 200 { 201 e && e.preventDefault(); 202 203 //repeat is on 204 repeatFlag = true; 205 206 }); 207 208 //control repeat OFF 209 $(document).on('click', '.jp-repeat-off', function(e) 210 { 211 e && e.preventDefault(); 212 213 //repeat is on 214 repeatFlag = false; 215 216 }); 217 218 //control playing and pausing audio 219 $(document).on('click', '.jp-play-me', function(e){
220 e && e.preventDefault(); 221 var $this = $(e.target); 222 songId = $(this).attr("song"); 223 224 /* 225 check for exlusive/prerelease 226 */ 227 var exclusive = $(this).attr("exclusive"); 228 229 if(exclusive == "1") 230 { 231 //update buy url 232 $("#buyNowModalUrl").attr("href", "purchase-single?id="+songId+"&type=song") 233 234 //show modal 235 $("#pre_release_alert").modal("show"); 236 237 return; 238 } 239 240 //check if user need to sign up/login 241 var playCount = getCookie("ACPC"); 242 243 var id = getCookie("userId"); 244 245 if(playCount >=5 && id.indexOf("web") > -1) 246 { 247 //show modal 248 $("#mustLoginSignUpModal").modal("show"); 249 250 return; 251 } 252 253 //chnage styling 254 if (!$this.is('a')) 255 { 256 257 $this = $this.closest('a'); 258 259 $('.jp-play-me').not($this).removeClass('active'); 260 $('.jp-play-me').parent('li').not($this.parent('li')).removeClass('active'); 261 262 $this.toggleClass('active'); 263 $this.parent('li').toggleClass('active'); 264 } 265 266 //when play single song is pressed 267 if($this.hasClass('active') ) 268 { 269 songData = $this.attr("song"); 270 playType = $this.attr("playType"); 271 272 if(songId!=null) 273 { 274 275 //check if we are playing album or playlist 276 if(playType == "playlist") 277 { 278 playlistId = $this.attr("playlistId"); 279 playlistType = $this.attr("playlistType"); 280 songIndex = $this.attr("songIndex"); 281 282 //play song in the playlist 283 playPlaylist(playlistId,playlistType,songIndex); 284 285 } 286 287 else if(playType == "album") 288 { 289 albumId = $this.attr("albumId"); 290 songIndex = $this.attr("songIndex"); 291 292 //play song in the playlist 293 playAlbum(albumId,songIndex); 294 295 } 296 297 //single song 298 else 299 { 300 myFormData={ 301 song:songId, 302 action:"getSingleSong" 303 }; 304 305 $.ajax({
306 type:'POST', 307 url:'ajax.php', 308 data:myFormData, 309 success: function(song) 310 { 311 song = JSON.parse(song); //parse results to json 312 addMusicToCurrentPlayList(song.songId, song.songAudioFileUrl, song.songName, song.artists,song.songCover) //add song to playlist 313 314 //myPlaylist.play(-1); 315 //myPlaylist.play(); 316 317 //starting 9-1-2022 318 playAdvertisement(myPlaylist.playlist.length-1); 319 320 } 321 }); 322 } 323 } 324 } 325 326 //when pausing 327 if( !$this.hasClass('active') ) 328 { 329 myPlaylist.pause(); 330 } 331 332 else 333 { 334 /*var i = Math.floor(Math.random() * (1 + 7 - 1)); 335 myPlaylist.play(i);*/ 336 } 337 338 }); 339 340 341 342 //Add playlist songs to Queuee to be played Next, append it to the end of current Quee 343 $(document).on('click', '#addPlaylistToQueue', function(e) 344 { 345 e && e.preventDefault(); 346 347 //check if user need to sign up/login 348 var playCount = getCookie("ACPC"); 349 350 var id = getCookie("userId"); 351 352 if(playCount >=5 && id.indexOf("web") > -1) 353 { 354 //show modal 355 $("#mustLoginSignUpModal").modal("show"); 356 357 return; 358 } 359 360 playlist = $(this).attr('playlist'); 361 playlistType = $(this).attr('playlistType'); 362 363 if(playlist!=null) 364 { 365 myFormData={ 366 playlist:playlist, 367 playlistType:playlistType, 368 action:"getPlaylistSongs" 369 }; 370 371 $.ajax({ 372 type:'POST', 373 url:'ajax.php', 374 data:myFormData, 375 success: function(playlistSongs) 376 { 377 playlistSongsJS = JSON.parse(playlistSongs); //parse results to json 378 currentPlaylistLength = myPlaylist.playlist.length; 379 380 for(var key in playlistSongsJS) 381 { 382 if(playlistSongsJS.hasOwnProperty(key)) 383 { 384 song = playlistSongsJS[key]; // get the song 385 addMusicToCurrentPlayList(song.songId, song.songAudioFileUrl, song.songName, song.artists,song.songCover) //add song to playlist 386 } 387 } 388 389 //if they are the first songs added 390 if(currentPlaylistLength==0) 391 { 392 myPlaylist.play(0); // play song right the way 393 } 394 395 actionMessageAlert("<strong> Playlist </strong> added to Queue"); 396 } 397 }); 398 399 } 400 401 }); 402 403 404 //Play all Playlist songs right now 405 $(document).on('click', '#playAllPlaylistSongs', function(e) 406 { 407 e && e.preventDefault(); 408 //get targeted event 409 var thisObj = $(e.target); 410 411 //check if user need to sign up/login 412 var playCount = getCookie("ACPC"); 413 414 var id = getCookie("userId"); 415 416 if(playCount >=5 && id.indexOf("web") > -1) 417 { 418 //show modal 419 $("#mustLoginSignUpModal").modal("show"); 420 421 return; 422 } 423 424 //get element that was pressed on 425 thisObj=thisObj.closest('button'); 426 427 playlist=thisObj.attr('current_playlist'); 428 playlistType = $(this).attr('playlistType'); 429 430 //play song in the playlist 431 var songIndex = -1; //so we can play first song in the playlist 432 playPlaylist(playlist,playlistType,songIndex); 433 434 }); 435 436 //Add album songs to Queuee to be played Next, append it to the end of current Quee 437 $(document).on('click', '#addAlbumToQueue', function(e) 438 { 439 e && e.preventDefault(); 440 441 current_album = $(this).attr("album"); 442 443 /* 444 check for exlusive/prerelease 445 */ 446 var exclusive = $(this).attr("exclusive"); 447 448 if(exclusive == "1") 449 { 450 //update buy url 451 $("#buyNowModalUrl").attr("href", "purchase-single?id="+current_album+"&type=album") 452 453 //show modal 454 $("#pre_release_alert").modal("show"); 455 456 return; 457 } 458 459 460 //check if user need to sign up/login 461 var playCount = getCookie("ACPC"); 462 var id = getCookie("userId"); 463 464 if(playCount >=5 && id.indexOf("web") > -1) 465 { 466 //show modal 467 $("#mustLoginSignUpModal").modal("show"); 468 469 return; 470 } 471 472 album = $(this).attr('album'); 473 474 if(album!=null) 475 { 476 myFormData={ 477 album:album, 478 action:"getAlbumSongs" 479 }; 480 481 $.ajax({ 482 type:'POST', 483 url:'ajax.php', 484 data:myFormData, 485 success: function(albumSongs) 486 { 487 albumSongsJS = JSON.parse(albumSongs); //parse results to json 488 currentPlaylistLength = myPlaylist.playlist.length; 489 490 for(var key in albumSongsJS) 491 { 492 if(albumSongsJS.hasOwnProperty(key)) 493 { 494 song = albumSongsJS[key]; // get the song 495 addMusicToCurrentPlayList(song.songId, song.songAudioFileUrl, song.songName, song.artistName,song.songCover) //add song to playlist 496 } 497 } 498 499 //if they are the first songs added 500 if(currentPlaylistLength==0) 501 { 502 myPlaylist.play(0); // play song right the way 503 } 504 505 actionMessageAlert("<strong> Album </strong> added to Queue"); 506 507 } 508 }); 509 } 510 }); 511 512 //Play all Album songs right now 513 $(document).on('click', '#playAllAlbumSongs', function(e) 514 { 515 e && e.preventDefault(); 516 517 current_album = $(this).attr("current_album"); 518 519 /* 520 check for exlusive/prerelease 521 */ 522 var exclusive = $(this).attr("exclusive"); 523 524 if(exclusive == "1") 525 { 526 //update buy url 527 $("#buyNowModalUrl").attr("href", "purchase-single?id="+current_album+"&type=album") 528 529 //show modal 530 $("#pre_release_alert").modal("show"); 531 532 return; 533 } 534 535 //check if user need to sign up/login 536 var playCount = getCookie("ACPC"); 537 538 var id = getCookie("userId"); 539 540 if(playCount >=5 && id.indexOf("web") > -1) 541 { 542 //show modal
543 $("#mustLoginSignUpModal").modal("show"); 544 545 return; 546 } 547 548 //get targeted event 549 var thisObj = $(e.target); 550 551 //get element that was pressed on 552 thisObj=thisObj.closest('button'); 553 554 album=thisObj.attr('current_album'); 555 556 //play song in the playlist 557 var songIndex = -1; //so we can play first song in the playlist 558 playAlbum(album,songIndex); 559 560 }); 561 562 563//add song to Queue 564 $(document).on('click', '#addSongToQueue', function(e){ 565 e.preventDefault(); 566 567 songId = $(this).attr("song"); 568 569 /* 570 check for exlusive/prerelease 571 */ 572 var exclusive = $(this).attr("exclusive"); 573 574 if(exclusive == "1") 575 { 576 //update buy url 577 $("#buyNowModalUrl").attr("href", "purchase-single?id="+songId+"&type=song") 578 579 //show modal 580 $("#pre_release_alert").modal("show"); 581 582 return; 583 } 584 585 //check if user need to sign up/login 586 var playCount = getCookie("ACPC"); 587 588 var id = getCookie("userId"); 589 590 if(playCount >=5 && id.indexOf("web") > -1) 591 { 592 //show modal 593 $("#mustLoginSignUpModal").modal("show"); 594 595 return; 596 } 597 598 song = $(this).attr("song"); 599 songId = $(this).attr("song"); 600 601 if(songId!=null) 602 { 603 myFormData={ 604 song:song, 605 action:"getSingleSong" 606 }; 607 608 $.ajax({ 609 type:'POST', 610 url:'ajax.php', 611 data:myFormData, 612 success: function(song) 613 { 614 song = JSON.parse(song); //parse results to json 615 616 addMusicToCurrentPlayList(song.songId, song.songAudioFileUrl, song.songName, song.artists,song.songCover) //add song to playlist 617 618 //play if it is the first song 619 currentPlaylistLength = myPlaylist.playlist.length; 620 621 if(currentPlaylistLength==1) 622 { 623 myPlaylist.play(0); // play song right the way 624 } 625 626 actionMessageAlert("<strong>" + song.songName + "</strong> added to Queue"); 627 } 628 }); 629 630 631 } 632 633 /* 634 song_id = $song.attr('song_id'); 635 song_title = $song.attr('song_name'); 636 song_poster = $song.attr('poster'); 637 song_artist = $song.attr('artist'); 638 song_path = $song.attr('data-jp-src'); 639 640 addMusicToCurrentPlayList(song_id, song_path, song_title, song_artist,song_poster) 641 642 643 644 //popover 645 //popover_id = $(this).attr('popover-id'); 646 647 //$('#add_song').popover('show'); 648 //$('[popover-id="'+popover_id+'"]').popover('show'); 649 $(this).popover('show'); 650 651 //fad popover out 652 setTimeout(function() 653 { 654 $('.popover').fadeOut(); 655 }, 2000); 656 657 //myPlaylist.play(-1);*/ 658}); 659 660 661 //Play all artists songs 662 $(document).on('click', '#playAllArtistSongs', function(e) 663 { 664 e && e.preventDefault(); 665 666 //check if user need to sign up/login 667 var playCount = getCookie("ACPC"); 668 669 var id = getCookie("userId"); 670 671 if(playCount >=5 && id.indexOf("web") > -1) 672 { 673 //show modal 674 $("#mustLoginSignUpModal").modal("show"); 675 676 return; 677 } 678 679 //get targeted event 680 var thisObj = $(e.target); 681 682 //get element that was pressed on 683 thisObj=thisObj.closest('button'); 684 685 //get artist id 686 artist=thisObj.attr('artist'); 687 688 if(artist!=null) 689 { 690 myFormData={ 691 artist:artist, 692 action:"getArtistSongs" 693 }; 694 695 $.ajax({ 696 type:'POST', 697 url:'ajax.php', 698 data:myFormData, 699 success: function(artistSongs) 700 { 701 artistSongsJS = JSON.parse(artistSongs); //parse results to json 702 currentPlaylistLength = myPlaylist.playlist.length; 703 704 for(var key in artistSongsJS) 705 { 706 if(artistSongsJS.hasOwnProperty(key)) 707 { 708 song = artistSongsJS[key]; // get the song 709 addMusicToCurrentPlayList(song.songId, song.songAudioFileUrl, song.songName, song.artists,song.songCover) //add song to playlist 710 } 711 } 712 713 //myPlaylist.play(currentPlaylistLength); // play song right the way 714 //$( ".jp-play" ).trigger( "click" ); 715 716 //starting 9-1-2022 717 playAdvertisement(currentPlaylistLength); 718 } 719 }); 720 } 721 722 }); 723 724 725 // video 726 727 $("#jplayer_1").jPlayer({ 728 ready: function () { 729 $(this).jPlayer("setMedia", { 730 title: "Big Buck Bunny", 731 m4v: "http://flatfull.com/themes/assets/video/big_buck_bunny_trailer.m4v", 732 ogv: "http://flatfull.com/themes/assets/video/big_buck_bunny_trailer.ogv", 733 webmv: "http://flatfull.com/themes/assets/video/big_buck_bunny_trailer.webm", 734 poster: "images/m41.jpg" 735 }); 736 }, 737 swfPath: "js", 738 supplied: "webmv, ogv, m4v", 739 size: { 740 width: "100%", 741 height: "auto", 742 cssClass: "jp-video-360p" 743 }, 744 globalVolume: true, 745 smoothPlayBar: true, 746 keyEnabled: true 747 }); 748 749 //functions 750 viewCurrentPlayingSong(); 751 752 753}); 754 755 756function playAdvertisement(songToPlayIndex) 757{ 758 songToPlayIndexAfterAds = songToPlayIndex; 759 760 myPlaylist.play(songToPlayIndex); // remove this and uncomment below to play ads 761 762 /* 763 Don't play ads as of 1/25/2023 764 */ 765
766 //check if we need to retrieve and play ads 767 /*if(totalListenedSongs >= 4) 768 { 769 myFormData={ 770 action:"getAds" 771 }; 772 773 $.ajax({ 774 type:'POST', 775 url:'ajax.php', 776 data:myFormData, 777 success: function(adResult) 778 { 779 currentAd = JSON.parse(adResult); //parse results to json 780 currentPlayingAd = currentAd; 781 782 //check if there is any ads to play 783 if(currentAd.message == 'ok') 784 { 785 addMusicToCurrentPlayList(currentAd.adId, currentAd.adAudioUrl, currentAd.adName, "Advertisement",currentAd.adContentUrl) //add song to playlist 786 //play last item which would be the ad 787 myPlaylist.play(-1); 788 789 isAdPlaying = true; 790 791 //hide control buttons 792 $(".jp-previous").addClass("hide"); 793 $(".jp-play").addClass("hide"); 794 $(".jp-pause").addClass("hide"); 795 $(".jp-next").addClass("hide"); 796 $(".playlistBtn").addClass("hide"); 797 $(".jp-progress").addClass("hide"); 798 799 //add info to track clicks 800 $("#jplayer_N").addClass("ac-ad"); 801 $("#jplayer_N").attr("adId",currentPlayingAd.adId); 802 803 /***************** 804 //count this as an ad play 805 ************************/ 806 807 /*myFormData={ 808 adId:currentPlayingAd.adId, 809 action:"play" 810 }; 811 812 $.ajax({
813 type:'POST', 814 url:'adManager.php', 815 data:myFormData, 816 requestFrom:"webAjax", 817 beforeSend: function(resultData) 818 { 819 }, 820 821 success: function(resultData) 822 { 823 }, 824 error: function(resultData) 825 { 826 } 827 }); 828 } 829 else 830 { 831 myPlaylist.play(songToPlayIndex); 832 } 833 } 834 }); 835 } 836 837 else 838 { 839 myPlaylist.play(songToPlayIndex); 840 }*/ 841} 842 843function playAlbum(album,songIndex) 844{ 845 if(album!=null) 846 { 847 myFormData={ 848 album:album, 849 action:"getAlbumSongs" 850 }; 851 852 $.ajax({ 853 type:'POST', 854 url:'ajax.php', 855 data:myFormData, 856 success: function(albumSongs) 857 { 858 albumSongsJS = JSON.parse(albumSongs); //parse results to json 859 currentPlaylistLength = myPlaylist.playlist.length; 860 861 for(var key in albumSongsJS) 862 { 863 if(albumSongsJS.hasOwnProperty(key)) 864 { 865 song = albumSongsJS[key]; // get the song 866 addMusicToCurrentPlayList(song.songId, song.songAudioFileUrl, song.songName, song.artistName,song.songCover) //add song to playlist 867 } 868 } 869 870 //which index to start playing a song 871 if(songIndex === -1) 872 { 873 songIndex = currentPlaylistLength 874 } 875 876 //myPlaylist.play(songIndex); // play song right the way 877 878 //starting 9-1-2022 879 playAdvertisement(songIndex); 880 881 albumId = album; 882 isAlbum = true; 883 } 884 }); 885 } 886} 887 888function playPlaylist(playlist,playlistType,songIndex) 889{ 890 var songIndex = parseInt(songIndex); 891 892 if(playlist!=null) 893 { 894 myFormData={ 895 playlist:playlist, 896 playlistType:playlistType, 897 action:"getPlaylistSongs" 898 }; 899 900 $.ajax({ 901 type:'POST', 902 url:'ajax.php', 903 data:myFormData, 904 success: function(playlistSongs) 905 { 906 playlistSongsJS = JSON.parse(playlistSongs); //parse results to json 907 currentPlaylistLength = myPlaylist.playlist.length; 908 909 for(var key in playlistSongsJS) 910 { 911 if(playlistSongsJS.hasOwnProperty(key)) 912 { 913 song = playlistSongsJS[key]; // get the song 914 addMusicToCurrentPlayList(song.songId, song.songAudioFileUrl, song.songName, song.artists,song.songCover) //add song to playlist 915 } 916 } 917 918 //which index to start playing a song 919 if(songIndex === -1) 920 { 921 songIndex = currentPlaylistLength 922 } 923 924 //myPlaylist.play(songIndex); // play song right the way 925 926 //starting 9-1-2022 927 playAdvertisement(songIndex); 928 929 playlistId = playlist; 930 isPlaylist = true; 931 } 932 }); 933 } 934} 935 936function songPlayed() 937{ 938 var playCount = getCookie("ACPC"); 939 940 if(playCount == ""){ 941 playCount = 0; 942 } 943 944 playCount++; 945 946 setCookie("ACPC",playCount, 1825); 947} 948 949function isLastSong() 950{ 951 setPlaylistLength() 952 953 if(current_playing_song_index==playlist_length-1) 954 { 955 return true; 956 } 957 958 return false; 959} 960 961//add song to current playlist 962function addMusicToCurrentPlayList(song_id, song_path, song_title, song_artist,song_poster) 963{ 964 965 var song = {}; 966 song.id = song_id; 967 song.title = song_title + " - "+song_artist; 968 song.poster = song_poster; 969 song.artist = song_artist; 970 song.mp3 = song_path; 971 972 myPlaylist.add(song); 973 974 setPlaylistLength(); // update global playlist length variable 975} 976 977//recommend song 978function recommendNextSong() 979{ 980 current_playing_song_id = myPlaylist.playlist[current_playing_song_index].id; //last song Id 981 982 var song = {}; 983 984 $.ajax({ 985 url: 'ajax.php', 986 data: {action: 'recommendedSongs',id:current_playing_song_id}, 987 type: 'get', 988 success: function(result) 989 { 990 r_song = JSON.parse(result)["0"]; //parse results to json and get the first song; 991 992 song_id = r_song.songId; 993 song_title = r_song.songName; 994 song_poster = r_song.songCover; 995 song_artist = r_song.artists; 996 song_path = r_song.songAudioFileUrl; 997 998 addMusicToCurrentPlayList(song_id, song_path, song_title, song_artist,song_poster) 999 1000 //myPlaylist.play(-1); //play last song 1001 1002 //starting 9-1-2022 1003 playAdvertisement(myPlaylist.playlist.length-1); 1004 } 1005 }); 1006} 1007 1008function actionMessageAlert(message) 1009{ 1010 //show and remove Song added alert 1011 //$('[popover-id="'+songId+'"]').popover('show'); 1012 //popoverObj.popover('show'); 1013 $("#actionMessageAlertText").html(message); 1014 $("#actionMessageAlert").removeClass('hide'); 1015 //fad popover out 1016 setTimeout(function() 1017 { 1018 $("#actionMessageAlert").addClass('hide'); 1019 }, 5000); 1020} 1021 1022//when song poster is clicked on from 1023function viewCurrentPlayingSong() 1024{ 1025 $(document).on('click', '#jplayer_N', function(e) 1026 { 1027 e.preventDefault(); 1028 1029 //when ad is playling 1030 if(isAdPlaying) 1031 { 1032 currentPlayingAd 1033 var adId = currentPlayingAd.adId; 1034 var adUrl = currentPlayingAd.adUrl; 1035 1036 //window.location.href='guest' 1037 //open page in new tab 1038 window.open(adUrl, '_blank'); 1039 } 1040 1041 //check if there is a song
1042 else if(myPlaylist.playlist[current_playing_song_index] !=null) 1043 { 1044 id = myPlaylist.playlist[current_playing_song_index].id; 1045 href = "song.php?id="+id; 1046 1047 //save current href and tittle in history 1048 history.pushState("view-current-song"+id, '', href); 1049 1050 loadPage(href,globalContainer,globalElement); 1051 1052 } 1053 1054 }); 1055 1056} 1057 1058function setPlaylistLength() 1059{ 1060 playlist_length = myPlaylist.playlist.length; 1061}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.