( function( api ) {
api.sectionConstructor['real-estate-developer'] = api.Section.extend( {
attachEvents: function () {},
isContextuallyActive: function () { return true; }
} );
} )( wp.customize );
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('click', function(e) {
var target = e.target;
if (target && (target.classList.contains('change-theme') || target.closest('.change-theme'))) {
var popupShown = (typeof realEstateDeveloperCustomizer !== 'undefined') ? realEstateDeveloperCustomizer.popupShown : '0';
if (popupShown === '1') { return true; } else {
e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation();
var popup = document.getElementById('buy-pro-popup');
if (popup) { jQuery(popup).fadeIn(300); }
return false;
}
}
}, true);
});
jQuery(document).ready(function($) {
var popupHTML = '<div id="theme-change-popup" class="theme-popup-overlay" style="display:none;"><div class="theme-popup-content"><span class="theme-popup-close">&times;</span><h2>Change Theme</h2><div class="theme-popup-body"><p>Are you sure you want to change the theme?</p><p>This will take you to the themes page where you can select a new theme.</p><div class="theme-popup-buttons"><button class="button button-primary theme-confirm-change">Yes, Change Theme</button><button class="button theme-cancel-change">Cancel</button></div></div></div></div>';
if ($('#theme-change-popup').length === 0) { $('body').append(popupHTML); }
$(document).on('click', '.theme-popup-close, .theme-cancel-change', function() { $('#theme-change-popup').fadeOut(300); });
$(document).on('click', '.theme-confirm-change', function() { $('#theme-change-popup').fadeOut(300); setTimeout(function() { window.location.href = $('.change-theme').attr('href'); }, 300); });
var buyProPopupHTML = '<div id="buy-pro-popup" class="theme-popup-overlay buy-pro-overlay" style="display:none;"><div class="theme-popup-content buy-pro-content"><span class="theme-popup-close buy-pro-close">&times;</span><div class="welcome-notice-popup"><div class="notice-text"><p class="welcome-text1">🎉Before Switching Real Estate Developer…</p><p class="welcome-text2">Unlock its Premium Version for more power, features, and design control.</p><p class="welcome-text3">Or get 500+ themes in one bundle at $119</p><div class="pro-popup-buttons"><a href="https://www.vwthemes.com/products/property-developer-wordpress-theme" class="button button-primary upgrade-pro-btn" target="_blank">UPGRADE TO PRO</a><a href="https://www.vwthemes.com/products/wp-theme-bundle" class="button button-primary bundle-btn" target="_blank">BUNDLE OF 500+ THEMES</a></div></div></div></div></div>';
if ($('#buy-pro-popup').length === 0) { $('body').append(buyProPopupHTML); }
$(document).on('click', '.pro-popup-buttons a', function(e) { if ($(this).attr('target') === '_blank') { } else { window.location.href = $(this).attr('href'); e.preventDefault(); } });
$(document).on('click', '.buy-pro-close', function() { $.ajax({ url: realEstateDeveloperCustomizer.ajaxUrl, type: 'POST', data: { action: 'real_estate_developer_customizer_popup_shown', nonce: realEstateDeveloperCustomizer.nonce }, success: function() { realEstateDeveloperCustomizer.popupShown = '1'; } }); $('#buy-pro-popup').fadeOut(300); });
$(document).on('click', '.buy-pro-overlay', function(e) { if (e.target === this) { $.ajax({ url: realEstateDeveloperCustomizer.ajaxUrl, type: 'POST', data: { action: 'real_estate_developer_customizer_popup_shown', nonce: realEstateDeveloperCustomizer.nonce }, success: function() { realEstateDeveloperCustomizer.popupShown = '1'; } }); $(this).fadeOut(300); } });
$(document).on('click', '.change-theme', function(e) { var popupShown = realEstateDeveloperCustomizer.popupShown; if (popupShown === '1') { return true; } else { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); $('#buy-pro-popup').fadeIn(300); return false; } });
if (typeof wp !== 'undefined' && typeof wp.customize !== 'undefined') {
wp.customize.bind('ready', function() {
setTimeout(function() {
$('.change-theme').off('click');
$('.change-theme').on('click', function(e) {
var popupShown = realEstateDeveloperCustomizer.popupShown;
if (popupShown === '1') { return true; } else { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); $('#buy-pro-popup').fadeIn(300); return false; }
});
}, 100);
});
}
});
