/**
 * @package Party Corp
 */

jQuery(document).ready(function ($) {
  $("#dashboard-changelog-button").click(function (e) {
    e.stopPropagation();
    $("#party-corp-dashboard-offcanvas").addClass("open");
    $(".wrap").addClass("overlay");
  });

  $("#dialog-close").click(function (e) {
    e.stopPropagation();
    $("#party-corp-dashboard-offcanvas").removeClass("open");
    $(".wrap").removeClass("overlay");
  });

  $(document).on("click", function (e) {
    if (
      !$("#party-corp-dashboard-offcanvas").is(e.target) &&
      $("#party-corp-dashboard-offcanvas").has(e.target).length === 0
    ) {
      $("#party-corp-dashboard-offcanvas").removeClass("open");
      $(".wrap").removeClass("overlay");
    }
  });
});

jQuery(document).ready(function ($) {
  var party_corp_adminUrl = partycorpRedirectDemoPage.admin_url;

  var party_corp_targetUrl = party_corp_adminUrl + "themes.php?page=party-corp";

  var party_corp_currentPage = window.location.href;

  $(".dashboard-header-nav ul li").each(function () {
    var pageURL = $(this).find("a").attr("href");
    $;
    if (party_corp_currentPage === pageURL) {
      $(this).addClass("active");
    }
  });

  if (party_corp_currentPage === party_corp_targetUrl) {
    $(".dashboard-header-nav ul li:first").addClass("active");
  }
});