first commit

This commit is contained in:
CHIEFSOFT\ameye
2023-11-30 13:20:54 -05:00
commit e9e5c0546c
5833 changed files with 1801865 additions and 0 deletions
@@ -0,0 +1,271 @@
<?php
/**
* The public-facing functionality of the plugin.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ADP
* @subpackage ADP/public
*/
/**
* The public-facing functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the public-facing stylesheet and JavaScript.
*
* @package ADP
* @subpackage ADP/public
*/
class ADP_Public {
/**
* The ID of this plugin.
* @access private
* @var string $adp The ID of this plugin.
*/
private $adp;
/**
* The version of this plugin.
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @param string $adp The name of the plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $adp, $version ) {
$this->adp = $adp;
$this->version = $version;
}
/**
* Initialize
*/
public function wp_footer() {
$query = new WP_Query();
// Get all popups.
$popups = $query->query( array(
'post_status' => 'publish',
'post_type' => 'adp-popup',
'posts_per_page' => -1,
) );
// Looop popups.
foreach ( $popups as $popup ) {
$popup_type = adp_get_post_meta( $popup->ID, '_adp_popup_type', true, 'content' );
$popup_location = adp_get_post_meta( $popup->ID, '_adp_popup_location', true, 'center' );
$popup_preview_image = adp_get_post_meta( $popup->ID, '_adp_popup_preview_image', true, 'left' );
$popup_info_text = adp_get_post_meta( $popup->ID, '_adp_popup_info_text', true );
$popup_info_buton_label = adp_get_post_meta( $popup->ID, '_adp_popup_info_buton_label', true );
$popup_info_button_action = adp_get_post_meta( $popup->ID, '_adp_popup_info_button_action', true, 'link' );
$popup_info_button_link = adp_get_post_meta( $popup->ID, '_adp_popup_info_button_link', true );
$popup_limit_display = adp_get_post_meta( $popup->ID, '_adp_popup_limit_display', true, 1 );
$popup_limit_lifetime = adp_get_post_meta( $popup->ID, '_adp_popup_limit_lifetime', true, 30 );
$popup_open_trigger = adp_get_post_meta( $popup->ID, '_adp_popup_open_trigger', true, 'delay' );
$popup_open_delay_number = adp_get_post_meta( $popup->ID, '_adp_popup_open_delay_number', true, 1 );
$popup_open_scroll_position = adp_get_post_meta( $popup->ID, '_adp_popup_open_scroll_position', true, 10 );
$popup_open_scroll_type = adp_get_post_meta( $popup->ID, '_adp_popup_open_scroll_type', true, '%' );
$popup_open_manual_selector = adp_get_post_meta( $popup->ID, '_adp_popup_open_manual_selector', true );
$popup_close_trigger = adp_get_post_meta( $popup->ID, '_adp_popup_close_trigger', true, 'none' );
$popup_close_delay_number = adp_get_post_meta( $popup->ID, '_adp_popup_close_delay_number', true, 30 );
$popup_close_scroll_position = adp_get_post_meta( $popup->ID, '_adp_popup_close_scroll_position', true, 10 );
$popup_close_scroll_type = adp_get_post_meta( $popup->ID, '_adp_popup_close_scroll_type', true, '%' );
$popup_open_animation = adp_get_post_meta( $popup->ID, '_adp_popup_open_animation', true, 'popupOpenFade' );
$popup_exit_animation = adp_get_post_meta( $popup->ID, '_adp_popup_exit_animation', true, 'popupExitFade' );
$popup_content_box_width = adp_get_post_meta( $popup->ID, '_adp_popup_content_box_width', true, 500 );
$popup_notification_box_width = adp_get_post_meta( $popup->ID, '_adp_popup_notification_box_width', true, 400 );
$popup_notification_bar_width = adp_get_post_meta( $popup->ID, '_adp_popup_notification_bar_width', true, 1024 );
$popup_light_close = adp_get_post_meta( $popup->ID, '_adp_popup_light_close', true, false );
$popup_display_overlay = adp_get_post_meta( $popup->ID, '_adp_popup_display_overlay', true, false );
$popup_mobile_disable = adp_get_post_meta( $popup->ID, '_adp_popup_mobile_disable', true );
$popup_body_scroll_disable = adp_get_post_meta( $popup->ID, '_adp_popup_body_scroll_disable', true );
$popup_overlay_close = adp_get_post_meta( $popup->ID, '_adp_popup_overlay_close', true );
$popup_esc_close = adp_get_post_meta( $popup->ID, '_adp_popup_esc_close', true );
$popup_f4_close = adp_get_post_meta( $popup->ID, '_adp_popup_f4_close', true );
// Check show popup.
if ( ! adp_is_popup_visible( $popup->ID ) ) {
continue;
}
$has_post_thumbnail = has_post_thumbnail( $popup->ID ) && 'none' !== $popup_preview_image;
// Default location for notification bar.
if ( 'notification-bar' === $popup_type ) {
if ( 'top' !== $popup_location && 'bottom' !== $popup_location ) {
$popup_location = 'bottom';
}
}
// Set popup width.
if ( 'content' === $popup_type ) {
$popup_width = $popup_content_box_width . 'px';
if ( $has_post_thumbnail ) {
$popup_width = ( $popup_content_box_width * 2 ) . 'px';
}
} elseif ( 'notification-box' === $popup_type ) {
$popup_width = $popup_notification_box_width . 'px';
} else {
$popup_width = '100%';
}
// Set Popup CSS.
$popup_style = sprintf( 'width:%s;', $popup_width );
// Set Outer CSS.
$outer_style = sprintf( 'max-width:%s;', '100%' );
if ( 'notification-bar' === $popup_type ) {
$outer_style = sprintf( 'max-width:%s;', $popup_notification_bar_width . 'px' );
}
// Popup clasess.
$class = 'adp-popup';
$class .= ' adp-popup-type-' . esc_attr( $popup_type );
$class .= ' adp-popup-location-' . esc_attr( $popup_location );
$class .= ' adp-preview-image-' . esc_attr( $popup_preview_image );
$class .= ' adp-preview-image-' . esc_attr( $has_post_thumbnail ? 'yes' : 'no' );
// Filter clasess.
$class = apply_filters( 'adp_popup_clasess', $class, $popup->ID, $popup_type, $popup_location );
?>
<div class="<?php echo esc_attr( $class ); ?>"
data-limit-display="<?php echo esc_attr( $popup_limit_display ); ?>"
data-limit-lifetime="<?php echo esc_attr( $popup_limit_lifetime ); ?>"
data-open-trigger="<?php echo esc_attr( $popup_open_trigger ); ?>"
data-open-delay-number="<?php echo esc_attr( $popup_open_delay_number ); ?>"
data-open-scroll-position="<?php echo esc_attr( $popup_open_scroll_position ); ?>"
data-open-scroll-type="<?php echo esc_attr( $popup_open_scroll_type ); ?>"
data-open-manual-selector="<?php echo esc_attr( $popup_open_manual_selector ); ?>"
data-close-trigger="<?php echo esc_attr( $popup_close_trigger ); ?>"
data-close-delay-number="<?php echo esc_attr( $popup_close_delay_number ); ?>"
data-close-scroll-position="<?php echo esc_attr( $popup_close_scroll_position ); ?>"
data-close-scroll-type="<?php echo esc_attr( $popup_close_scroll_type ); ?>"
data-open-animation="<?php echo esc_attr( $popup_open_animation ); ?>"
data-exit-animation="<?php echo esc_attr( $popup_exit_animation ); ?>"
data-light-close="<?php echo esc_attr( $popup_light_close ? 'true' : 'false' ); ?>"
data-overlay="<?php echo esc_attr( $popup_display_overlay ? 'true' : 'false' ); ?>"
data-mobile-disable="<?php echo esc_attr( $popup_mobile_disable ? 'true' : 'false' ); ?>"
data-body-scroll-disable="<?php echo esc_attr( $popup_body_scroll_disable ? 'true' : 'false' ); ?>"
data-overlay-close="<?php echo esc_attr( $popup_overlay_close ? 'true' : 'false' ); ?>"
data-esc-close="<?php echo esc_attr( $popup_esc_close ? 'true' : 'false' ); ?>"
data-f4-close="<?php echo esc_attr( $popup_f4_close ? 'true' : 'false' ); ?>"
data-id="<?php echo esc_attr( $popup->ID ); ?>"
style="<?php echo esc_attr( $popup_style ); ?>">
<div class="adp-popup-wrap">
<div class="adp-popup-container">
<!-- Content -->
<?php if ( 'content' === $popup_type ) { ?>
<div class="adp-popup-outer" style="<?php echo esc_attr( $outer_style ); ?>">
<?php if ( $has_post_thumbnail ) { ?>
<div class="adp-popup-thumbnail">
<?php echo get_the_post_thumbnail( $popup->ID, 'large', array( 'class' => 'adp-lazyload-disabled' ) ); ?>
</div>
<?php } ?>
<div class="adp-popup-content">
<div class="adp-popup-inner">
<?php
$content = do_blocks( $popup->post_content );
echo do_shortcode( $content ); // XSS.
?>
</div>
<button type="button" class="adp-popup-close"></button>
</div>
</div>
<?php } ?>
<!-- Info -->
<?php if ( 'notification-box' === $popup_type || 'notification-bar' === $popup_type ) { ?>
<div class="adp-popup-outer" style="<?php echo esc_attr( $outer_style ); ?>">
<?php if ( $popup_info_text ) { ?>
<div class="adp-popup-text">
<?php echo wp_kses( $popup_info_text, 'post' ); ?>
</div>
<?php } ?>
<?php if ( $popup_info_buton_label ) { ?>
<?php if ( 'accept' === $popup_info_button_action ) { ?>
<button class="adp-button adp-popup-button adp-popup-accept">
<?php echo wp_kses( $popup_info_buton_label, 'post' ); ?>
</button>
<?php } ?>
<?php if ( 'link' === $popup_info_button_action ) { ?>
<a class="adp-button adp-popup-button" target="_blank" href="<?php echo esc_attr( $popup_info_button_link ); ?>">
<?php echo wp_kses( $popup_info_buton_label, 'post' ); ?>
</a>
<?php } ?>
<?php } ?>
<button type="button" class="adp-popup-close"></button>
</div>
<?php } ?>
</div>
</div>
</div>
<?php if ( $popup_display_overlay ) { ?>
<div class="adp-popup-overlay"></div>
<?php } ?>
<?php
// Integration css of powerkit blocks.
if ( function_exists( 'cnvs_gutenberg' ) ) {
// Parse blocks.
$blocks = parse_blocks( $popup->post_content );
$blocks_css = cnvs_gutenberg()->parse_blocks_css( $blocks );
if ( $blocks_css ) {
echo sprintf( '<style>%s</style>', $blocks_css ); // XSS.
}
}
}
}
/**
* Fire the wp_head action.
*/
public function wp_head() {
?>
<link rel="preload" href="<?php echo esc_url( ADP_URL . 'fonts/advanced-popups-icons.woff' ); ?>" as="font" type="font/woff" crossorigin>
<?php
}
/**
* Register the stylesheets for the public-facing side of the site.
*/
public function wp_enqueue_scripts() {
// Scripts.
wp_enqueue_script( $this->adp, plugin_dir_url( __FILE__ ) . 'js/advanced-popups-public.js', array( 'jquery' ), $this->version, false );
// Styles.
wp_enqueue_style( $this->adp, adp_style( plugin_dir_url( __FILE__ ) . 'css/advanced-popups-public.css' ), array(), $this->version, 'all' );
// Add RTL support.
wp_style_add_data( $this->adp, 'rtl', 'replace' );
}
}
@@ -0,0 +1,626 @@
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
@font-face {
font-family: 'advanced-popups-icons';
src: url("../../fonts/advanced-popups-icons.woff") format("woff"), url("../../fonts/advanced-popups-icons.ttf") format("truetype"), url("../../fonts/advanced-popups-icons.svg") format("svg");
font-weight: normal;
font-style: normal;
font-display: swap;
}
[class^="adp-icon-"],
[class*=" adp-icon-"] {
font-family: 'advanced-popups-icons' !important;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.adp-icon-x:before {
content: "\e913";
}
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.adp-popup {
--adp-popup-wrap-scrollbar-width: 0.625rem;
--adp-popup-wrap-scrollbar-track-background: #f1f1f1;
--adp-popup-wrap-scrollbar-thumb-background: #888;
--adp-popup-wrap-scrollbar-thumb-hover-background: #555;
--adp-popup-wrap-box-shadow: 0 0 40px 0 rgba(0,0,0,.075);
--adp-popup-container-background: #FFFFFF;
--adp-popup-close-font-size: 1.25rem;
--adp-popup-close-color: #000;
--adp-popup-close-hover-color: #777;
--adp-popup-close-light-color: #FFFF;
--adp-popup-close-light-hover-color: rgba(255,255,255,0.75);
--adp-popup-type-content-close-font-size: 1.5rem;
--adp-popup-type-notification-text-font-size: 90%;
--adp-popup-type-notification-text-color: #777777;
--adp-popup-type-notification-text-link-color: #000000;
--adp-popup-type-notification-button-background: #282828;
--adp-popup-type-notification-button-color: #FFF;
--adp-popup-type-notification-button-border-radius: 0;
}
.adp-popup-overlay {
--adp-popup-overlay-background: rgba(0,0,0,0.25);
}
/*--------------------------------------------------------------*/
.adp-popup-scroll-hidden {
overflow: hidden;
width: 100%;
}
.adp-popup-animated {
-webkit-animation-duration: 0.5s;
animation-duration: 0.5s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
overflow: hidden !important;
}
@-webkit-keyframes popupOpenFade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes popupOpenFade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-webkit-keyframes popupExitFade {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes popupExitFade {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@-webkit-keyframes popupOpenSlide {
from {
transform: translate3d(0, 100vh, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
@keyframes popupOpenSlide {
from {
transform: translate3d(0, 100vh, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes popupExitSlide {
from {
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
transform: translate3d(0, 100vh, 0);
}
}
@keyframes popupExitSlide {
from {
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
transform: translate3d(0, 100vh, 0);
}
}
@-webkit-keyframes popupOpenZoom {
from {
opacity: 0;
transform: scale(1.1);
}
to {
opacity: 1;
transform: scale(1);
}
}
@keyframes popupOpenZoom {
from {
opacity: 0;
transform: scale(1.1);
}
to {
opacity: 1;
transform: scale(1);
}
}
@-webkit-keyframes popupExitZoom {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(1.1);
}
}
@keyframes popupExitZoom {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(1.1);
}
}
@-webkit-keyframes popupOpenSlideFade {
from {
opacity: 0;
transform: translate3d(0, 40px, 0);
visibility: visible;
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes popupOpenSlideFade {
from {
opacity: 0;
transform: translate3d(0, 40px, 0);
visibility: visible;
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes popupExitSlideFade {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
visibility: hidden;
transform: translate3d(0, 40px, 0);
}
}
@keyframes popupExitSlideFade {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
visibility: hidden;
transform: translate3d(0, 40px, 0);
}
}
.popupOpenFade {
-webkit-animation-name: popupOpenFade;
animation-name: popupOpenFade;
}
.popupExitFade {
-webkit-animation-name: popupExitFade;
animation-name: popupExitFade;
}
.popupOpenSlide {
-webkit-animation-name: popupOpenSlide;
animation-name: popupOpenSlide;
}
.popupExitSlide {
-webkit-animation-name: popupExitSlide;
animation-name: popupExitSlide;
}
.popupOpenZoom {
-webkit-animation-name: popupOpenZoom;
animation-name: popupOpenZoom;
}
.popupExitZoom {
-webkit-animation-name: popupExitZoom;
animation-name: popupExitZoom;
}
.popupOpenSlideFade {
-webkit-animation-name: popupOpenSlideFade;
animation-name: popupOpenSlideFade;
}
.popupExitSlideFade {
-webkit-animation-name: popupExitSlideFade;
animation-name: popupExitSlideFade;
}
.adp-popup {
display: none;
position: fixed;
z-index: 999999;
max-width: calc(100vw - 1.5rem);
max-height: calc(100vh - 1.5rem);
-webkit-backface-visibility: hidden;
}
@media (min-width: 720px) {
.adp-popup {
max-width: calc(100vw - 6rem);
max-height: calc(100vh - 6rem);
}
}
.adp-popup.adp-popup-location-top {
top: 20px;
right: 50%;
transform: translate3d(-50%, 0, 0);
}
.adp-popup.adp-popup-location-top-left {
top: 20px;
right: 20px;
}
.adp-popup.adp-popup-location-top-right {
top: 20px;
left: 20px;
}
.adp-popup.adp-popup-location-bottom {
bottom: 20px;
right: 50%;
transform: translate3d(-50%, 0, 0);
}
.adp-popup.adp-popup-location-bottom-left {
right: 20px;
bottom: 20px;
}
.adp-popup.adp-popup-location-bottom-right {
left: 20px;
bottom: 20px;
}
.adp-popup.adp-popup-location-left {
top: 50%;
right: 20px;
transform: translate3d(0, -50%, 0);
}
.adp-popup.adp-popup-location-right {
top: 50%;
left: 20px;
transform: translate3d(0, -50%, 0);
}
.adp-popup.adp-popup-location-center {
top: 50%;
right: 50%;
transform: translate3d(-50%, -50%, 0);
}
.adp-popup .adp-popup-wrap {
position: relative;
overflow-x: hidden;
overflow-y: auto;
width: 100%;
box-shadow: var(--adp-popup-wrap-box-shadow);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar {
width: var(--adp-popup-wrap-scrollbar-width);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-track {
background: var(--adp-popup-wrap-scrollbar-track-background);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-thumb {
background: var(--adp-popup-wrap-scrollbar-thumb-background);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-thumb:hover {
background: var(--adp-popup-wrap-scrollbar-thumb-hover-background);
}
.adp-popup .adp-popup-container {
background: var(--adp-popup-container-background);
width: 100%;
}
.adp-popup .adp-popup-outer {
position: relative;
display: flex;
flex-direction: column;
}
.adp-popup .adp-popup-thumbnail img {
width: 100%;
}
.adp-popup .adp-popup-close {
position: absolute;
background: transparent;
color: var(--adp-popup-close-color);
padding: 0;
line-height: 1;
font-size: var(--adp-popup-close-font-size);
top: 20px;
left: 20px;
z-index: 2;
}
.adp-popup .adp-popup-close:before {
font-family: 'advanced-popups-icons';
transition: color 0.25s ease;
content: "\e913";
}
.adp-popup .adp-popup-close:hover:before {
color: var(--adp-popup-close-hover-color);
}
.adp-popup.adp-popup-open[data-light-close="true"] .adp-popup-close {
color: var(--adp-popup-close-light-color);
}
.adp-popup.adp-popup-open[data-light-close="true"] .adp-popup-close:hover:before {
color: var(--adp-popup-close-light-hover-color);
}
.adp-popup.adp-popup-open {
display: flex;
}
@media (max-width: 720px) {
.adp-popup.adp-popup-open[data-mobile-disable="true"] {
display: none;
}
}
.adp-popup-overlay {
background: var(--adp-popup-overlay-background);
position: fixed;
display: none;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
z-index: 999998;
}
.adp-popup-overlay .adp-popup-wrap {
box-shadow: none;
}
.adp-popup-open + .adp-popup-overlay {
display: block;
}
@media (max-width: 719.98px) {
.adp-popup-type-content {
max-width: 100vw;
max-height: 100vh;
}
}
.adp-popup-type-content .adp-popup-content {
padding: 40px;
}
.adp-popup-type-content .adp-popup-close {
font-size: var(--adp-popup-type-content-close-font-size);
}
.adp-popup-type-content .wp-block-cover:first-child:last-child {
margin: -40px;
width: initial;
}
.adp-popup-type-content.adp-preview-image-yes .adp-popup-close {
color: var(--adp-popup-close-light-color);
}
.adp-popup-type-content.adp-preview-image-yes .adp-popup-close:hover:before {
color: var(--adp-popup-close-light-hover-color);
}
@media (min-width: 1024px) {
.adp-popup-type-content .adp-popup-outer {
flex-direction: row;
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-close, .adp-popup-type-content.adp-preview-image-bottom .adp-popup-close {
color: var(--adp-popup-close-color);
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-close:hover:before, .adp-popup-type-content.adp-preview-image-bottom .adp-popup-close:hover:before {
color: var(--adp-popup-close-hover-color);
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-thumbnail {
order: 1;
}
.adp-popup-type-content.adp-preview-image-right .adp-popup-thumbnail {
order: 3;
}
.adp-popup-type-content.adp-preview-image-top .adp-popup-outer {
flex-direction: column;
}
.adp-popup-type-content.adp-preview-image-top .adp-popup-thumbnail img {
position: relative;
top: initial;
bottom: initial;
left: initial;
right: initial;
width: initial;
height: initial;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-outer {
flex-direction: column;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-thumbnail {
order: 3;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-thumbnail img {
position: relative;
top: initial;
bottom: initial;
left: initial;
right: initial;
width: initial;
height: initial;
}
.adp-popup-type-content .adp-popup-thumbnail {
position: relative;
flex: 1 0 50%;
order: 1;
}
.adp-popup-type-content .adp-popup-thumbnail img {
position: absolute;
display: block;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
}
.adp-popup-type-content .adp-popup-content {
padding: 80px;
flex: 1 0 50%;
order: 2;
}
.adp-popup-type-content .adp-popup-content:first-child:last-child {
flex: 1 0 100%;
}
.adp-popup-type-content .wp-block-cover:first-child:last-child {
margin: -80px;
}
}
.adp-popup-type-notification-box .adp-popup-outer,
.adp-popup-type-notification-bar .adp-popup-outer {
padding: 30px;
}
.adp-popup-type-notification-box .adp-popup-text,
.adp-popup-type-notification-bar .adp-popup-text {
padding-left: 10px;
font-size: var(--adp-popup-type-notification-text-font-size);
color: var(--adp-popup-type-notification-text-color);
}
.adp-popup-type-notification-box .adp-popup-text a,
.adp-popup-type-notification-bar .adp-popup-text a {
color: var(--adp-popup-type-notification-text-link-color);
text-decoration: underline;
}
.adp-popup-type-notification-box .adp-popup-text a:hover,
.adp-popup-type-notification-bar .adp-popup-text a:hover {
text-decoration: none;
}
.adp-popup-type-notification-box .adp-popup-button,
.adp-popup-type-notification-bar .adp-popup-button {
background: var(--adp-popup-type-notification-button-background);
margin-top: 1.5rem;
width: 100%;
color: var(--adp-popup-type-notification-button-color);
border-radius: var(--adp-popup-type-notification-button-border-radius);
}
.adp-popup-type-notification-box .adp-popup-close {
top: 15px;
left: 15px;
}
.adp-popup-type-notification-bar.adp-popup-location-top {
width: 100%;
max-width: 100%;
top: 0;
right: 0;
bottom: auto;
transform: none;
}
.adp-popup-type-notification-bar.adp-popup-location-bottom {
width: 100%;
max-width: 100%;
top: auto;
right: 0;
bottom: 0;
transform: none;
}
.adp-popup-type-notification-bar .adp-popup-outer {
padding-top: 20px;
padding-bottom: 20px;
padding-right: 60px;
padding-left: 60px;
}
@media (min-width: 720px) {
.adp-popup-type-notification-bar .adp-popup-outer {
justify-content: center;
align-items: center;
flex-direction: row;
flex-wrap: wrap;
margin: 0 auto;
padding-right: 40px;
padding-left: 40px;
}
.adp-popup-type-notification-bar .adp-popup-close {
top: 50%;
transform: translateY(-50%);
}
.adp-popup-type-notification-bar .adp-button {
margin-right: 1rem;
margin-top: 0;
width: auto;
}
}
@@ -0,0 +1,626 @@
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
@font-face {
font-family: 'advanced-popups-icons';
src: url("../../fonts/advanced-popups-icons.woff") format("woff"), url("../../fonts/advanced-popups-icons.ttf") format("truetype"), url("../../fonts/advanced-popups-icons.svg") format("svg");
font-weight: normal;
font-style: normal;
font-display: swap;
}
[class^="adp-icon-"],
[class*=" adp-icon-"] {
font-family: 'advanced-popups-icons' !important;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.adp-icon-x:before {
content: "\e913";
}
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.adp-popup {
--adp-popup-wrap-scrollbar-width: 0.625rem;
--adp-popup-wrap-scrollbar-track-background: #f1f1f1;
--adp-popup-wrap-scrollbar-thumb-background: #888;
--adp-popup-wrap-scrollbar-thumb-hover-background: #555;
--adp-popup-wrap-box-shadow: 0 0 40px 0 rgba(0,0,0,.075);
--adp-popup-container-background: #FFFFFF;
--adp-popup-close-font-size: 1.25rem;
--adp-popup-close-color: #000;
--adp-popup-close-hover-color: #777;
--adp-popup-close-light-color: #FFFF;
--adp-popup-close-light-hover-color: rgba(255,255,255,0.75);
--adp-popup-type-content-close-font-size: 1.5rem;
--adp-popup-type-notification-text-font-size: 90%;
--adp-popup-type-notification-text-color: #777777;
--adp-popup-type-notification-text-link-color: #000000;
--adp-popup-type-notification-button-background: #282828;
--adp-popup-type-notification-button-color: #FFF;
--adp-popup-type-notification-button-border-radius: 0;
}
.adp-popup-overlay {
--adp-popup-overlay-background: rgba(0,0,0,0.25);
}
/*--------------------------------------------------------------*/
.adp-popup-scroll-hidden {
overflow: hidden;
width: 100%;
}
.adp-popup-animated {
-webkit-animation-duration: 0.5s;
animation-duration: 0.5s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
overflow: hidden !important;
}
@-webkit-keyframes popupOpenFade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes popupOpenFade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-webkit-keyframes popupExitFade {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes popupExitFade {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@-webkit-keyframes popupOpenSlide {
from {
transform: translate3d(0, 100vh, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
@keyframes popupOpenSlide {
from {
transform: translate3d(0, 100vh, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes popupExitSlide {
from {
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
transform: translate3d(0, 100vh, 0);
}
}
@keyframes popupExitSlide {
from {
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
transform: translate3d(0, 100vh, 0);
}
}
@-webkit-keyframes popupOpenZoom {
from {
opacity: 0;
transform: scale(1.1);
}
to {
opacity: 1;
transform: scale(1);
}
}
@keyframes popupOpenZoom {
from {
opacity: 0;
transform: scale(1.1);
}
to {
opacity: 1;
transform: scale(1);
}
}
@-webkit-keyframes popupExitZoom {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(1.1);
}
}
@keyframes popupExitZoom {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(1.1);
}
}
@-webkit-keyframes popupOpenSlideFade {
from {
opacity: 0;
transform: translate3d(0, 40px, 0);
visibility: visible;
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes popupOpenSlideFade {
from {
opacity: 0;
transform: translate3d(0, 40px, 0);
visibility: visible;
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes popupExitSlideFade {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
visibility: hidden;
transform: translate3d(0, 40px, 0);
}
}
@keyframes popupExitSlideFade {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
visibility: hidden;
transform: translate3d(0, 40px, 0);
}
}
.popupOpenFade {
-webkit-animation-name: popupOpenFade;
animation-name: popupOpenFade;
}
.popupExitFade {
-webkit-animation-name: popupExitFade;
animation-name: popupExitFade;
}
.popupOpenSlide {
-webkit-animation-name: popupOpenSlide;
animation-name: popupOpenSlide;
}
.popupExitSlide {
-webkit-animation-name: popupExitSlide;
animation-name: popupExitSlide;
}
.popupOpenZoom {
-webkit-animation-name: popupOpenZoom;
animation-name: popupOpenZoom;
}
.popupExitZoom {
-webkit-animation-name: popupExitZoom;
animation-name: popupExitZoom;
}
.popupOpenSlideFade {
-webkit-animation-name: popupOpenSlideFade;
animation-name: popupOpenSlideFade;
}
.popupExitSlideFade {
-webkit-animation-name: popupExitSlideFade;
animation-name: popupExitSlideFade;
}
.adp-popup {
display: none;
position: fixed;
z-index: 999999;
max-width: calc(100vw - 1.5rem);
max-height: calc(100vh - 1.5rem);
-webkit-backface-visibility: hidden;
}
@media (min-width: 720px) {
.adp-popup {
max-width: calc(100vw - 6rem);
max-height: calc(100vh - 6rem);
}
}
.adp-popup.adp-popup-location-top {
top: 20px;
left: 50%;
transform: translate3d(-50%, 0, 0);
}
.adp-popup.adp-popup-location-top-left {
top: 20px;
left: 20px;
}
.adp-popup.adp-popup-location-top-right {
top: 20px;
right: 20px;
}
.adp-popup.adp-popup-location-bottom {
bottom: 20px;
left: 50%;
transform: translate3d(-50%, 0, 0);
}
.adp-popup.adp-popup-location-bottom-left {
left: 20px;
bottom: 20px;
}
.adp-popup.adp-popup-location-bottom-right {
right: 20px;
bottom: 20px;
}
.adp-popup.adp-popup-location-left {
top: 50%;
left: 20px;
transform: translate3d(0, -50%, 0);
}
.adp-popup.adp-popup-location-right {
top: 50%;
right: 20px;
transform: translate3d(0, -50%, 0);
}
.adp-popup.adp-popup-location-center {
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.adp-popup .adp-popup-wrap {
position: relative;
overflow-x: hidden;
overflow-y: auto;
width: 100%;
box-shadow: var(--adp-popup-wrap-box-shadow);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar {
width: var(--adp-popup-wrap-scrollbar-width);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-track {
background: var(--adp-popup-wrap-scrollbar-track-background);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-thumb {
background: var(--adp-popup-wrap-scrollbar-thumb-background);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-thumb:hover {
background: var(--adp-popup-wrap-scrollbar-thumb-hover-background);
}
.adp-popup .adp-popup-container {
background: var(--adp-popup-container-background);
width: 100%;
}
.adp-popup .adp-popup-outer {
position: relative;
display: flex;
flex-direction: column;
}
.adp-popup .adp-popup-thumbnail img {
width: 100%;
}
.adp-popup .adp-popup-close {
position: absolute;
background: transparent;
color: var(--adp-popup-close-color);
padding: 0;
line-height: 1;
font-size: var(--adp-popup-close-font-size);
top: 20px;
right: 20px;
z-index: 2;
}
.adp-popup .adp-popup-close:before {
font-family: 'advanced-popups-icons';
transition: color 0.25s ease;
content: "\e913";
}
.adp-popup .adp-popup-close:hover:before {
color: var(--adp-popup-close-hover-color);
}
.adp-popup.adp-popup-open[data-light-close="true"] .adp-popup-close {
color: var(--adp-popup-close-light-color);
}
.adp-popup.adp-popup-open[data-light-close="true"] .adp-popup-close:hover:before {
color: var(--adp-popup-close-light-hover-color);
}
.adp-popup.adp-popup-open {
display: flex;
}
@media (max-width: 720px) {
.adp-popup.adp-popup-open[data-mobile-disable="true"] {
display: none;
}
}
.adp-popup-overlay {
background: var(--adp-popup-overlay-background);
position: fixed;
display: none;
top: 0;
bottom: 0;
right: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999998;
}
.adp-popup-overlay .adp-popup-wrap {
box-shadow: none;
}
.adp-popup-open + .adp-popup-overlay {
display: block;
}
@media (max-width: 719.98px) {
.adp-popup-type-content {
max-width: 100vw;
max-height: 100vh;
}
}
.adp-popup-type-content .adp-popup-content {
padding: 40px;
}
.adp-popup-type-content .adp-popup-close {
font-size: var(--adp-popup-type-content-close-font-size);
}
.adp-popup-type-content .wp-block-cover:first-child:last-child {
margin: -40px;
width: initial;
}
.adp-popup-type-content.adp-preview-image-yes .adp-popup-close {
color: var(--adp-popup-close-light-color);
}
.adp-popup-type-content.adp-preview-image-yes .adp-popup-close:hover:before {
color: var(--adp-popup-close-light-hover-color);
}
@media (min-width: 1024px) {
.adp-popup-type-content .adp-popup-outer {
flex-direction: row;
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-close, .adp-popup-type-content.adp-preview-image-bottom .adp-popup-close {
color: var(--adp-popup-close-color);
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-close:hover:before, .adp-popup-type-content.adp-preview-image-bottom .adp-popup-close:hover:before {
color: var(--adp-popup-close-hover-color);
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-thumbnail {
order: 1;
}
.adp-popup-type-content.adp-preview-image-right .adp-popup-thumbnail {
order: 3;
}
.adp-popup-type-content.adp-preview-image-top .adp-popup-outer {
flex-direction: column;
}
.adp-popup-type-content.adp-preview-image-top .adp-popup-thumbnail img {
position: relative;
top: initial;
bottom: initial;
right: initial;
left: initial;
width: initial;
height: initial;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-outer {
flex-direction: column;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-thumbnail {
order: 3;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-thumbnail img {
position: relative;
top: initial;
bottom: initial;
right: initial;
left: initial;
width: initial;
height: initial;
}
.adp-popup-type-content .adp-popup-thumbnail {
position: relative;
flex: 1 0 50%;
order: 1;
}
.adp-popup-type-content .adp-popup-thumbnail img {
position: absolute;
display: block;
top: 0;
bottom: 0;
right: 0;
left: 0;
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
}
.adp-popup-type-content .adp-popup-content {
padding: 80px;
flex: 1 0 50%;
order: 2;
}
.adp-popup-type-content .adp-popup-content:first-child:last-child {
flex: 1 0 100%;
}
.adp-popup-type-content .wp-block-cover:first-child:last-child {
margin: -80px;
}
}
.adp-popup-type-notification-box .adp-popup-outer,
.adp-popup-type-notification-bar .adp-popup-outer {
padding: 30px;
}
.adp-popup-type-notification-box .adp-popup-text,
.adp-popup-type-notification-bar .adp-popup-text {
padding-right: 10px;
font-size: var(--adp-popup-type-notification-text-font-size);
color: var(--adp-popup-type-notification-text-color);
}
.adp-popup-type-notification-box .adp-popup-text a,
.adp-popup-type-notification-bar .adp-popup-text a {
color: var(--adp-popup-type-notification-text-link-color);
text-decoration: underline;
}
.adp-popup-type-notification-box .adp-popup-text a:hover,
.adp-popup-type-notification-bar .adp-popup-text a:hover {
text-decoration: none;
}
.adp-popup-type-notification-box .adp-popup-button,
.adp-popup-type-notification-bar .adp-popup-button {
background: var(--adp-popup-type-notification-button-background);
margin-top: 1.5rem;
width: 100%;
color: var(--adp-popup-type-notification-button-color);
border-radius: var(--adp-popup-type-notification-button-border-radius);
}
.adp-popup-type-notification-box .adp-popup-close {
top: 15px;
right: 15px;
}
.adp-popup-type-notification-bar.adp-popup-location-top {
width: 100%;
max-width: 100%;
top: 0;
left: 0;
bottom: auto;
transform: none;
}
.adp-popup-type-notification-bar.adp-popup-location-bottom {
width: 100%;
max-width: 100%;
top: auto;
left: 0;
bottom: 0;
transform: none;
}
.adp-popup-type-notification-bar .adp-popup-outer {
padding-top: 20px;
padding-bottom: 20px;
padding-left: 60px;
padding-right: 60px;
}
@media (min-width: 720px) {
.adp-popup-type-notification-bar .adp-popup-outer {
justify-content: center;
align-items: center;
flex-direction: row;
flex-wrap: wrap;
margin: 0 auto;
padding-left: 40px;
padding-right: 40px;
}
.adp-popup-type-notification-bar .adp-popup-close {
top: 50%;
transform: translateY(-50%);
}
.adp-popup-type-notification-bar .adp-button {
margin-left: 1rem;
margin-top: 0;
width: auto;
}
}
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,429 @@
"use strict";
jQuery(document).ready(function($) {
var adpPopup = {};
( function() {
var $this;
adpPopup = {
sPrevious : window.scrollY,
sDirection: 'down',
/*
* Initialize
*/
init: function( e ) {
$this = adpPopup;
$this.popupInit( e );
// Init events.
$this.events( e );
},
/*
* Events
*/
events: function( e ) {
// Custom Events
$( document ).on( 'click', '.adp-popup-close', $this.closePopup );
$( document ).on( 'click', '.adp-popup-accept', $this.acceptPopup );
$( document ).on( 'click', '.adp-popup-accept', $this.closePopup );
// Checking this will cause popup to close when user presses key.
$( document ).keyup(function(e) {
// Press ESC to Close.
if ( e.key === 'Escape' ) {
$( '.adp-popup-open[data-esc-close="true"]' ).each(function(index, popup) {
$this.closePopup(popup);
});
}
// Press F4 to Close.
if ( e.key === 'F4' ) {
$( '.adp-popup-open[data-esc-close="true"]' ).each(function(index, popup) {
$this.closePopup(popup);
});
}
});
// Checking this will cause popup to close when user clicks on overlay.
$( document ).on( 'click', '.adp-popup-overlay', function( e ) {
$this.closePopup( $( this).prev() );
} );
},
/*
* Init popup elements
*/
popupInit: function( e ) {
// Set scroll direction.
$( document ).on( 'scroll', function() {
let scrollCurrent = window.scrollY;
// Set scroll temporary vars.
if ( scrollCurrent > $this.sPrevious ) {
$this.sDirection = 'down';
} else {
$this.sDirection = 'up';
}
$this.sPrevious = scrollCurrent;
});
// Open popup
$( '.adp-popup' ).each(function(index, popup) {
// Manual Launch.
if ( 'manual' === $( popup ).data( 'open-trigger' ) ) {
let selector = $( popup ).data( 'open-manual-selector' );
if ( selector ) {
$( document ).on( 'click', selector, function( e ) {
event.preventDefault();
$( popup ).removeClass( 'adp-popup-already-opened' );
$this.openPopup( popup );
} );
}
}
// Checks whether a popup should be displayed or not.
if ( ! $this.isAllowPopup( popup ) ) {
return;
}
$this.openTriggerPopup( popup );
});
},
/*
* Trigger open popup
*/
openTriggerPopup: function( e ) {
let popup = ( e.originalEvent ) ? this : e;
var trigger = $( popup ).data( 'open-trigger' );
// Page Viewed.
if ( 'viewed' === trigger ) {
$this.openPopup( popup );
}
// Time Delay.
if ( 'delay' === trigger ) {
setTimeout( function() {
$this.openPopup( popup );
}, $( popup ).data( 'open-delay-number' ) * 1000 );
}
// Exit Intent.
if ( 'exit' === trigger ) {
var showExit = true;
document.addEventListener( "mousemove", function( e ) {
// Get current scroll position
var scroll = window.pageYOffset || document.documentElement.scrollTop;
if ( ( e.pageY - scroll ) < 7 && showExit ) {
$this.openPopup( popup );
showExit = false;
}
} );
}
// Scroll Position.
if ( 'read' === trigger || 'scroll' === trigger ) {
var pointScrollType = $( popup ).data( 'open-scroll-type' );
var pointScrollPosition = $( popup ).data( 'open-scroll-position' );
if ( 'read' === trigger ) {
pointScrollType = '%';
pointScrollPosition = 100;
}
// Event scroll.
$( document ).on( 'scroll', function() {
// Type px.
if ( 'px' === pointScrollType ) {
if ( window.scrollY >= pointScrollPosition ) {
$this.openPopup( popup );
}
}
// Type %.
if ( '%' === pointScrollType ) {
if ( $this.getScrollPercent() >= pointScrollPosition ) {
$this.openPopup( popup );
}
}
} );
}
// Accept Agreement.
if ( 'accept' === trigger ) {
let accept = $this.getCookie( 'adp-popup-accept-' + $( popup ).data( 'id' ) || 0 );
if ( ! accept ) {
$this.openPopup( popup );
}
}
},
/*
* Trigger close popup
*/
closeTriggerPopup: function( e ) {
let popup = ( e.originalEvent ) ? this : e;
var trigger = $( popup ).data( 'close-trigger' );
// Time Delay.
if ( 'delay' === trigger ) {
setTimeout( function() {
$this.closePopup(popup);
}, $( popup ).data( 'close-delay-number' ) * 1000 );
}
// Scroll Position.
if ( 'scroll' === trigger ) {
var pointScrollType = $( popup ).data( 'close-scroll-type' );
var pointScrollPosition = $( popup ).data( 'close-scroll-position' );
var initScrollPx = $( popup ).data( 'init-scroll-px' );
var initScrollPercent = $( popup ).data( 'init-scroll-percent' );
// Event scroll.
$( document ).on( 'scroll', function() {
// Type px.
if ( 'px' === pointScrollType ) {
if ( 'up' === $this.sDirection && window.scrollY < ( initScrollPx - pointScrollPosition ) ) {
$this.closePopup( popup );
}
if ( 'down' === $this.sDirection && window.scrollY >= ( initScrollPx + pointScrollPosition ) ) {
$this.closePopup( popup );
}
}
// Type %.
if ( '%' === pointScrollType ) {
if ( 'up' === $this.sDirection && $this.getScrollPercent() < ( initScrollPercent - pointScrollPosition ) ) {
$this.closePopup(popup);
}
if ( 'down' === $this.sDirection && $this.getScrollPercent() >= ( initScrollPercent + pointScrollPosition ) ) {
$this.closePopup(popup);
}
}
} );
}
},
/*
* Open popup
*/
openPopup: function( e ) {
let popup = ( e.originalEvent ) ? this : e;
if ( $( popup ).hasClass( 'adp-popup-open' ) ) {
return;
}
// Check already opened.
if ( $( popup ).hasClass( 'adp-popup-already-opened' ) ) {
return;
}
// Display popup.
$( popup ).addClass( 'adp-popup-open' );
// Set current scroll.
$( popup ).data( 'init-scroll-px', window.scrollY );
$( popup ).data( 'init-scroll-percent', $this.getScrollPercent() );
// Hide body scroll.
if ( $( popup ).is( '[data-body-scroll-disable="true"]' ) ) {
$( 'body' ).addClass( 'adp-popup-scroll-hidden' );
}
// Set Cookie of Limit display.
let limit = parseInt( $this.getCookie( 'adp-popup-' + $( popup ).data( 'id' ) ) || 0 ) + 1;
$this.setCookie( 'adp-popup-' + $( popup ).data( 'id' ), limit, {
expires: $( popup ).data( 'limit-lifetime' )
} );
// Open animation.
let animation = $( popup ).data( 'open-animation' );
$this.applyAnimation( popup, animation );
// Init close trigger.
$this.closeTriggerPopup( popup );
},
/*
* Accept popup
*/
acceptPopup: function( e ) {
let $el = ( e.originalEvent ) ? this : e;
// Get popup container.
let popup = $( $el ).closest( '.adp-popup' );
// Set Cookie of Accept.
$this.setCookie( 'adp-popup-accept-' + $( popup ).data( 'id' ), 1, {
expires: 360
} );
},
/*
* Close popup
*/
closePopup: function( e ) {
let $el = ( e.originalEvent ) ? this : e;
// Get popup container.
let popup = $( $el ).closest( '.adp-popup' );
// Close animation.
let animation = $( popup ).data( 'exit-animation' );
$this.applyAnimation( popup, animation, function() {
// Already opened.
$( popup ).addClass( 'adp-popup-already-opened' );
// Hide popup.
$( popup ).removeClass( 'adp-popup-open' );
// Remove classes from body.
$( 'body' ).removeClass( 'adp-popup-scroll-hidden' );
} );
},
/*
* Checks whether a popup should be displayed or not
*/
isAllowPopup: function( e ) {
let popup = ( e.originalEvent ) ? this : e;
// Has user seen this popup before?
let limitDisplay = parseInt( $( popup ).data( 'limit-display' ) || 0 );
let limitDisplayCookie = parseInt( $this.getCookie( 'adp-popup-' + $( popup ).data( 'id' ) ) );
if ( limitDisplay && limitDisplayCookie && limitDisplayCookie >= limitDisplay ) {
return;
}
return true;
},
/*
* Apply animation
*/
applyAnimation: function( el, name, callback ) {
var popup = $( el ).closest( '.adp-popup' );
if ( typeof callback === 'function' ) {
var overlayName = 'popupExitFade';
} else {
var overlayName = 'popupOpenFade';
}
// Overlay Animation.
$( popup ).next( '.adp-popup-overlay' ).addClass( 'adp-popup-animated ' + overlayName )
.one( 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
$( this ).removeClass( 'adp-popup-animated ' + overlayName );
} );
// Wrap Animation.
$( popup ).find( '.adp-popup-wrap' ).addClass( 'adp-popup-animated ' + name )
.one( 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
// remove the animation classes after animation ends
// required in order to apply new animation on close
$( this ).removeClass( 'adp-popup-animated ' + name );
if ( typeof callback === 'function' ) {
callback();
}
} );
},
/*
* Set cookie
*/
getCookie: function( name ) {
var matches = document.cookie.match( new RegExp(
"(?:^|; )" + name.replace( /([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1' ) + "=([^;]*)"
) );
return matches ? decodeURIComponent( matches[ 1 ] ) : undefined;
},
/*
* Set cookie
*/
setCookie: function( name, value, options ) {
options = options || {};
options.path = options.hasOwnProperty( 'path' ) ? options.path : '/';
options.expires = parseInt( options.expires );
if ( typeof options.expires == "number" && options.expires ) {
options.expires = new Date().setDate(new Date().getDate() + options.expires );
options.expires = new Date(options.expires).toUTCString();
}
value = encodeURIComponent( value );
var updatedCookie = name + "=" + value;
for ( var propName in options ) {
updatedCookie += "; " + propName;
var propValue = options[ propName ];
if ( propValue !== true ) {
updatedCookie += "=" + propValue;
}
}
document.cookie = updatedCookie;
},
/*
* Get scroll percent
*/
getScrollPercent: function() {
var h = document.documentElement,
b = document.body,
st = 'scrollTop',
sh = 'scrollHeight';
return (h[st]||b[st]) / ((h[sh]||b[sh]) - h.clientHeight) * 100;
}
};
} )();
// Initialize.
adpPopup.init();
});