<?php echo getAds($AdsPath . '/all_page_bottom'); ?>
<?php if (!$isLogged && (GOOGLE_APP_ID || FACEBOOK_APP_ID)) : ?>
  <div class="modal fade" id="modalLogin" tabindex="-1" aria-labelledby="modalLoginLabel" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="modalLoginLabel"><i class="fa fa-login" aria-hidden="true"></i> Login / Register
          </h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <div class="login d-grid gap-3">
            <?php
            if (FACEBOOK_APP_ID) : ?>
              <button type="button" class="btn btn-outline-primary" onclick="loginWeb('Facebook');"><i class="fa fa-facebook" aria-hidden="true"></i> Login With Facebook</button>
            <?php endif;
            if (GOOGLE_APP_ID) : ?>
              <button type="button" class="btn btn-outline-danger" onclick="loginWeb('Google');"><i class="fa fa-google" aria-hidden="true"></i> Login with Google</button>
            <?php endif; ?>
          </div>
          <div class="modal-footer">
          By joining, you agree to <a href="<?php echo APP_URL . '/page/terms-of-service' . $endRoute; ?>">Terms of Service</a> and <a href="<?php echo APP_URL . '/page/privacy-policy' . $endRoute; ?>">Privacy Policy</a>
          </div>
        </div>
      </div>
    </div>
  </div>
<?php endif; ?>
<footer class="bg-primary">
      </br>
     <center><a href="https://zergchat.xyz/" class="btn btn-success text-uppercase"  target="_blank">Join Chat <i class="fa fa-comments"></i></a></center>
  <div id="ftcopyright" class="container p-3 text-white">
    <div class="row">
      <div class="col-md-6 col-lg-4">
        <ul class="ftlist">
          <li><a href="<?php echo APP_URL . '/page/copyright-policy' . $endRoute; ?>">DMCA / Copyright Policy</a></li>
          <li><a href="<?php echo APP_URL . '/page/privacy-policy' . $endRoute; ?>">Privacy Policy</a></li>
          <li><a href="<?php echo APP_URL . '/page/terms-of-service' . $endRoute; ?>">Terms of Service</a></li>
          <li><a href="<?php echo APP_URL . '/page/contact-us' . $endRoute; ?>">Contact Us</a></li>
          <li><a href="<?php echo APP_URL . '/page/about-us' . $endRoute; ?>">About Us</a></li>
          <li><a href="https://zergchat.xyz/">GuestBook</a></li>
        </ul>
      </div>
      <div class="col-md-6 col-lg-4">
        <ul class="ftlist">
          <li><a href="<?php echo APP_URL . '/categorie/list/' . $endRoute; ?>">Listă Categorii</a></li>
          <li><a href="<?php echo APP_URL . '/musics/1/latest-songs' . $endRoute; ?>">Tonuri Recente</a></li>
          <li><a href="<?php echo APP_URL . '/musics/1/trending' . $endRoute; ?>">Tonuri în Trend</a></li>
          <li><a href="<?php echo APP_URL . '/musics/1/top-songs' . $endRoute; ?>">Tonuri de Top</a></li>
          <li><a href="<?php echo APP_URL . '/upload' . $endRoute; ?>">Upload Tonuri</a></li>
        </ul>
      </div>
      <div class="col-lg-4 align-self-center">
        <div class="d-flex justify-content-center share">
          <div onclick="fbshare();"><i class="fa fa-facebook" aria-hidden="true"></i></div>
          <div onclick="twshare();"><i class="fa fa-twitter" aria-hidden="true"></i></div>
          <div onclick="pishare();"><i class="fa fa-pinterest" aria-hidden="true"></i></div>
          <div onclick="mishare();"><i class="fa fa-mail" aria-hidden="true"></i></div>
        </div>
      </div>
    </div>
    <hr>
    <div class="d-flex justify-content-between">
      <div class="fs-5">
        &copy; Tonuri De Apel - <?php echo '<a class="text-white" href="' . APP_URL . '">' . APP_NAME . '</a>'; ?>
      </div>
      <div class="fs-6 align-self-center">
        Made In <i class="fa fa-heart" aria-hidden="true"></i> Romania
      </div>
    </div>
  </div>
  <br/><br/><br/>
</footer>
   <!-- audio player home -->
<div id="realaudio_player_container" style="display:none;">
    <audio id="audio_player" audio-id="0"></audio>
</div> 
 <script src="/player/jquery-3.6.0.min.js"></script>
<script>
    let player = document.querySelector('#audio_player');
    $(document).on('click', '.audio_itemplay', function(e){
        e.preventDefault();
        let currentIcon = $(this).children('.material-icons').text();
        let icon_playing = 'pause';
        let icon_paused = 'play_arrow';
        let source = $(this).closest('.letaudioplay').attr('data-file').trim();
        let data_id = $(this).closest('.letaudioplay').attr('data-id').trim();
        data_id = parseInt(data_id);
        let player_idnow = $('#audio_player').attr('audio-id').trim();
        player_idnow = player_idnow == "" ? 0 : parseInt(player_idnow);

        let item_selector = '#audio_'+data_id;

        if(player_idnow != data_id){
            $('.audio_item_current_time').html('<!--removetiming-->');
            $('.playtrigericon').html(icon_paused);
            player.src = source;
            player.load();

            $('#audio_player').attr('audio-id', data_id);
            $('#audio_player').trigger('play');
            $(item_selector+' .playtrigericon').html(icon_playing);
        }
        else{
            if(player.paused){
                $(item_selector+' .playtrigericon').html(icon_playing);
                player.play();
            } else {
                $(item_selector+' .playtrigericon').html(icon_paused);
                player.pause();
            }
        }
    });

    function setSliderAndTimer() {
        //get minutes
        let minutes = Math.floor(player.currentTime / 60);
        if (minutes < 10) {
            minutes = "0" + minutes;
        }
        //get seconds
        let seconds = Math.floor(player.currentTime % 60);
        if (seconds < 10) {
            seconds = "0" + seconds;
        }
        let textContent = `${minutes}:${seconds}`;
        if (player.currentTime == player.duration) {
            player.pause();
        }
        let item_selector = '#audio_'+player.getAttribute('audio-id').trim();
        $(item_selector+' .audio_item_current_time').html(textContent);
    }

    player.addEventListener("timeupdate", setSliderAndTimer);
    player.onended = function(){
        let item_selector = '#audio_'+this.getAttribute('audio-id').trim();
        $(item_selector+' .audio_item_current_time').html('<!--hide-->');
        $(item_selector+' .playtrigericon').html('play_arrow');
    };
</script>
  <!-- audio player home -->
<script src="/assets/dist/bundle.js"></script>
<?php echo getFileContent('widget/foot'); ?>
<?php if ($Route == "UPLOAD" && $isLogged) : ?>
  <script src="/assets/dist/jquery/jquery.min.js"></script>
  <script src="/assets/dist/select2/js/select2.min.js"></script>
  <script>
    $(document).ready(function() {
      $("#category_id").select2({
        placeholder: "Select Category",
        ajax: {
          url: "/ajax",
          data: function(params) {
            var query = {
              search: params.term,
              action: "categorylist",
            };
            return query;
          },
        },
      });

      $("#artist").select2({
        createTag: function(params) {
          var term = $.trim(params.term);
          if (term === '') {
            return null;
          }
          return {
            id: term,
            text: term,
            newTag: true,
          }
        },
        placeholder: "Add Artist",
        tags: true,
        tokenSeparators: [',']
      });
    });
  </script>
<?php endif; ?>
<?php if (WEBPUSH == 1 && WEBPUSH_SENDER_ID) {
  echo '<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
    <script>
      window.OneSignal = window.OneSignal || [];
      OneSignal.push(function() {
        OneSignal.init({
          appId: "' . WEBPUSH_SENDER_ID . '",
        });
      });
    </script>';
} ?>
</body>
</html>