<?php
   include "config/MainFunction.php";
   $base_url = $use->base_url();
   $angels = $use->angels();
   $articles = $use->randomArticleSeven();
   $angels = $use->mergeArray($angels, $articles);
   $horoscope_sign_menus = $use->horoscope_sign_menus();
   ?>
<!doctype html>
<html lang="en">
   <head>
      <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4801985982356333"
         crossorigin="anonymous"></script>
      <!-- Required meta tags -->
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <!-- Bootstrap CSS -->
      <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
      <link rel="stylesheet" href="css/new-style.css">
      <link rel="stylesheet" href="css/bootstrap.css">
      <link rel="stylesheet" href="css/font-awesome.min.css">
      <link rel="stylesheet" href="css/audio.css">
      <link rel="stylesheet" href="https://icono-49d6.kxcdn.com/icono.min.css">
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
      <link rel="icon" type="image/png" href="images/arch-logo.png" />
      <title>Angelic Divine Message</title>
   </head>
   <body>
      <header class="w-100 clearfix MainHeader" id="TopHeader">
         <div class="header_sec container-fluid">
            <nav class="navbar navbar-expand-lg px-0">
               <a class="navbar-brand head_logo" href="<?php echo $base_url;?>">
               <img src="images/logo.png" class="img-fluid" alt="No Logo"></a>
               <button class="navbar-toggler" type="button" id="sidebar" onclick="openNav()">
               ☰
               </button>
               <div class="side_bar" id="collapsibleNavbar">
                  <ul class="navbar-nav header_menu">
                     <a href="javascript:void(0)" class="closebtn d-lg-none d-block text-decoration-none text-dark" onclick="closeNav()">×</a>
                     <li class="nav-item dropdown">
                        <a class="nav-link" href="javascript:void(0);" data-toggle="dropdown">Horoscopes <span><i class="fa fa-caret-down" aria-hidden="true"></i></span></a>
                        <ul class="header_menu_drop py-2 dropdown-menu">
                           <?php foreach($horoscope_sign_menus as $horoscope_sign){ ?>
                           <li class="nav-item">
                              <a class="nav-link" href="<?php echo $base_url;?>horoscope/<?php echo $horoscope_sign['slug'];?>/horoscope-today"><img src="<?php echo $base_url;?>assets/uploads/horoscope/<?php echo $horoscope_sign['file'];?>"><?php echo $horoscope_sign['title'];?></a>
                           </li>
                           <?php  } ?>
                        </ul>
                     </li>
                     <li class="nav-item dropdown">
                        <a class="nav-link" href="javascript:void(0);" data-toggle="dropdown">Tarot <span><i class="fa fa-caret-down" aria-hidden="true"></i></span></a>
                        <ul class="header_menu_drop py-2 dropdown-menu">
                           <li class="nav-item">
                              <a class="nav-link" href="<?php echo $base_url;?>tarot/daily-tarot">Daily Tarot</a>
                           </li>
                           <li class="nav-item">
                              <a class="nav-link" href="<?php echo $base_url;?>tarot/yes-or-no-tarot">Yes/No Tarot</a>
                           </li>
                           <li class="nav-item">
                              <a class="nav-link" href="<?php echo $base_url;?>tarot/cards"> Tarot Meaning</a>
                           </li>
                        </ul>
                     </li>
                     <li class="nav-item">
                        <a class="nav-link" href="<?php echo $base_url;?>fortune-cookie">Fortune Cookie</a>
                     </li>
                     <li class="nav-item">
                        <a class="nav-link" href="<?php echo $base_url;?>coffee-cup-reading">Coffee Cup Reading</a>
                     </li>
                     <li class="nav-item">
                        <a class="nav-link" href="<?php echo $base_url;?>blog">Blog</a>
                     </li>
                     <li class="nav-item">
                        <a class="nav-link" href="<?php echo $base_url;?>contact-us">Contact Us</a>
                     </li>
                     <!-- <li class="nav-item d-lg-block d-none">
                        <a class="nav-link btn reveal_btn" href="https://quiz.astrologyvalley.com/optinu4lry51d
                        ">Free Natal Reading</a>
                        </li> -->
                  </ul>
               </div>
               <div class="mt-lg-2 freebtn">
                  <a class="nav-link btn reveal_btn" href="https://quiz.astrologyvalley.com/optinu4lry51d
                     ">Free Natal Reading</a>
               </div>
            </nav>
         </div>
      </header>
      <div class="bg_image">
         <section class="w-100 clearfix messagesearch py-5" id="message_part">

            <div class="heading_bg">
               <div class="container">
                  <?php foreach ($angels as $angel) : ?>
                  <div class="first_section text-center">
                     <h1><?= ucfirst($angel['title']); ?></h1>
                  </div>
               </div>
            </div>
            <div class="ads" style="text-align: center; margin: 0 auto; margin-top: 5px; margin-bottom: 5px">
                        <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                        <!-- AP - Horizontal -->
                        <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4801985982356333" data-ad-slot="5263271406" data-ad-format="auto" data-full-width-responsive="true"></ins>
                        <script>
                           (adsbygoogle = window.adsbygoogle || []).push({});
                        </script>
                     </div>
            <div class="container-fluid position-relative">
              <div class="angle_image">
                       <img src="images/angle.png" class="img-fluid">
               </div>
            </div>
            <div class="container">
               <div class="row">
                  <div class="col-12">
                     <div class="first_section_1 text-center px-lg-5 py-4">
                        <h1>You've (1) Message from the Universe<br>
                        <img src="images/spkr.png" class="img-fluid"> Make sure your sound is turned on  <img src="images/spkr.png" class="img-fluid"></h1>
                    
                  </div>
                     
                 <div class="col-lg-9 m-auto">
                 <div class="audio_play my-md-5 mx-md-4">                  
                     <div class="wish_fisrt text-center py-5">
                        <h2>Click Here to Play Your Audio Message</h2>
                     </div>
                     <audio controls class="audio-message" style="display: none;">
                        <source src="images/thumb/<?= $angel['image'] ?>"  type="audio/mp3" >
                     </audio>
                     <!-- <div style="width: 50px; height: 50px;"></div> -->
                     <div class="flower position-relative">
                      </div>
                     <div class="audio-player">
                      
                        <div class="controls">
                           <div class="play-container">
                              <div class="play-audio">
                                 <div class="toggle-play play">
                                 </div>
                              </div>
                           </div>
                           <div class="time">
                              <div class="current">0:00</div>
                              <div class="divider">/</div>
                              <div class="length"></div>
                           </div>
                           <!--     credit for icon to https://saeedalipoor.github.io/icono/ -->
                           <div class="volume-container">
                              <div class="volume-button">
                                 <div class="volume">
                                    <img src="images/volume.png">
                                 </div>
                              </div>
                              <div class="volume-slider">
                                 <div class="volume-percentage"></div>
                              </div>
                           </div>
                        </div>
                        <div class="timeline">
                           <div class="progress"></div>
                        </div>
                     </div>
                     <?php endforeach; ?>
                    
                  </div>
                  </div>
                  </div>
               </div>
               <div class="px-3">
                  <div class="ads" style="text-align: center; margin: 0 auto; margin-top: 5px; margin-bottom: 5px">
                     <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                     <!-- AP - Horizontal -->
                     <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4801985982356333" data-ad-slot="5263271406" data-ad-format="auto" data-full-width-responsive="true"></ins>
                     <script>
                        (adsbygoogle = window.adsbygoogle || []).push({});
                     </script>
                  </div>
               </div>
            </div>
      </div>
      </section>
      </div>
      <footer class="AstroFooter w-100 clearfix" id="AstrologyFooter">
         <div class="container">
            <div class="AstroFooter text-center w-100 py-5">
               <div class="FooterLogo">
                  <a href="<?php echo $base_url;?>" class="d-inline-block">
                  <img src="images/logo.png" class="img-fluid">
                  </a>
               </div>
               <div class="FooterLinks pt-4 mt-2">
                  <ul class="list-unstyled FooterLists">
                     <li>
                        <a href="<?php echo $base_url;?>horoscope/daily">Horoscope Daily</a>
                     </li>
                     <li>
                        <a href="<?php echo $base_url;?>horoscope/weekly">Horoscope Weekly</a>
                     </li>
                     <li>
                        <a href="<?php echo $base_url;?>horoscope/monthly">Horoscope Monthly</a>
                     </li>
                     <li>
                        <a href="<?php echo $base_url;?>tarot/daily-tarot">DAILY TAROT</a>
                     </li>
                     <li>
                        <a href="<?php echo $base_url;?>tarot/yes-or-no-tarot">YES/NO TAROT</a>
                     </li>
                     <li>
                        <a href="<?php echo $base_url;?>fortune-cookie">Fortune Cookie</a>
                     </li>
                     <li>
                        <a href="<?php echo $base_url;?>coffee-cup-reading">Coffee Cup Reading</a>
                     </li>
                     <li>
                        <a class="nav-link" href="<?php echo $base_url;?>blog">Blog</a>
                     </li>
                     <li>
                        <a class="nav-link" href="<?php echo $base_url;?>contact-us">Contact Us</a>
                     </li>
                     <li>
                        <a class="nav-link" href="<?php echo $base_url;?>about-us">About Us</a>
                     </li>
                     <li>
                        <a class="nav-link" href="<?php echo $base_url;?>privacy-policy">Privacy Policy</a>
                     </li>
                     <li>
                        <a class="nav-link" href="<?php echo $base_url;?>terms-condition">Terms Condition</a>
                     </li>
                     <li>
                        <a class="nav-link" href="<?php echo $base_url;?>tarot/cards">Tarot</a>
                     </li>
                     <li>
                        <a href="<?php echo $base_url;?>archangel-message-1/">Archangel Message</a>
                     </li>
                     <li>
                        <a href="http://localhost/zodiac-message/">Zodiec Message</a>
                     </li>
                  </ul>
               </div>
               <div class="FooterSocials d-none">
                  <ul class="list-unstyled FooterSocLists">
                     <li>
                        <a href="javascript:void(0);" class="fb">
                        <i class="fa fa-facebook" aria-hidden="true"></i>
                        </a>
                     </li>
                  </ul>
               </div>
            </div>
         </div>
         <div class="modal fade" id="modal-default">
            <div class="modal-dialog">
               <div class="modal-content">
               </div>
            </div>
         </div>
      </footer>
      <script src="js/jquery.min.js"></script>
      <script src="js/popper.min.js"></script>
      <script src="js/bootstrap.min.js"></script>
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/flexslider/2.2.0/jquery.flexslider-min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
      <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
      <script>
         function openNav() {
               document.getElementById("collapsibleNavbar").style.transform = "translate(0%, 0%)";
               }
         
               function closeNav() {
               document.getElementById("collapsibleNavbar").style.transform = "translate(-130%, 0%)";
               }
         
         
         
         const audioPlayer = document.querySelector(".audio-player");
         var audiourl = $('source').attr('src');
         
         const audio = new Audio(audiourl);
         
         console.dir(audio);
         
         audio.addEventListener(
         "loadeddata",
         () => {
         audioPlayer.querySelector(".time .length").textContent = getTimeCodeFromNum(
         audio.duration
         );
         audio.volume = .75;
         },
         false
         );
         
         //click on timeline to skip around
         const timeline = audioPlayer.querySelector(".timeline");
         timeline.addEventListener("click", e => {
         const timelineWidth = window.getComputedStyle(timeline).width;
         const timeToSeek = e.offsetX / parseInt(timelineWidth) * audio.duration;
         audio.currentTime = timeToSeek;
         }, false);
         
         //click volume slider to change volume
         const volumeSlider = audioPlayer.querySelector(".controls .volume-slider");
         volumeSlider.addEventListener('click', e => {
         const sliderWidth = window.getComputedStyle(volumeSlider).width;
         const newVolume = e.offsetX / parseInt(sliderWidth);
         audio.volume = newVolume;
         audioPlayer.querySelector(".controls .volume-percentage").style.width = newVolume * 100 + '%';
         }, false)
         
         //check audio percentage and update time accordingly
         setInterval(() => {
         const progressBar = audioPlayer.querySelector(".progress");
         progressBar.style.width = audio.currentTime / audio.duration * 100 + "%";
         audioPlayer.querySelector(".time .current").textContent = getTimeCodeFromNum(
         audio.currentTime
         );
         }, 500);
         
         //toggle between playing and pausing on button click
         const playBtn = audioPlayer.querySelector(".controls .toggle-play");
         playBtn.addEventListener(
         "click",
         () => {
         if (audio.paused) {
         playBtn.classList.remove("play");
         playBtn.classList.add("pause");
         audio.play();
         } else {
         playBtn.classList.remove("pause");
         playBtn.classList.add("play");
         audio.pause();
         }
         },
         false
         );
         
         audioPlayer.querySelector(".volume-button").addEventListener("click", () => {
         const volumeEl = audioPlayer.querySelector(".volume-container .volume");
         audio.muted = !audio.muted;
         if (audio.muted) {
         volumeEl.classList.remove("icono-volumeMedium");
         volumeEl.classList.add("icono-volumeMute");
         } else {
         volumeEl.classList.add("icono-volumeMedium");
         volumeEl.classList.remove("icono-volumeMute");
         }
         });
         
         //turn 128 seconds into 2:08
         function getTimeCodeFromNum(num) {
         let seconds = parseInt(num);
         let minutes = parseInt(seconds / 60);
         seconds -= minutes * 60;
         const hours = parseInt(minutes / 60);
         minutes -= hours * 60;
         
         if (hours === 0) return `${minutes}:${String(seconds % 60).padStart(2, 0)}`;
         return `${String(hours).padStart(2, 0)}:${minutes}:${String(
         seconds % 60
         ).padStart(2, 0)}`;
         }
         
         
         
      </script>
   </body>
</html>