53 lines
2.4 KiB
HTML
53 lines
2.4 KiB
HTML
<div class="mailpoet-deactivate-survey-modal" id="mailpoet-deactivate-survey-modal">
|
|
<div class="mailpoet-deactivate-survey-wrap">
|
|
<div class="mailpoet-deactivate-survey">
|
|
<script type="text/javascript">
|
|
window.addEventListener('load', function() {
|
|
var deactivateLink = document.querySelector('#the-list [data-slug="mailpoet"] span.deactivate a');
|
|
var overlay = document.querySelector('#mailpoet-deactivate-survey-modal');
|
|
var closeButton = document.querySelector('#mailpoet-deactivate-survey-close');
|
|
var formOpen = false;
|
|
|
|
if (!deactivateLink || !overlay || !closeButton) {
|
|
return;
|
|
}
|
|
|
|
deactivateLink.addEventListener('click', function (event) {
|
|
event.preventDefault();
|
|
overlay.style.display = 'table';
|
|
formOpen = true;
|
|
});
|
|
|
|
closeButton.addEventListener('click', function (event) {
|
|
event.preventDefault();
|
|
overlay.style.display = 'none';
|
|
formOpen = false;
|
|
location.href = deactivateLink.getAttribute('href');
|
|
});
|
|
|
|
document.addEventListener('keyup', function (event) {
|
|
if ((event.keyCode === 27) && formOpen) {
|
|
location.href = deactivateLink.getAttribute('href');
|
|
}
|
|
});
|
|
});
|
|
|
|
// This callback is by docs, and guarantees that the modal window is closed and deactivated only after the vote has been submitted
|
|
var pd_callback = function(json) {
|
|
var obj = JSON.parse(json);
|
|
var deactivateLink = document.querySelector('#the-list [data-slug="mailpoet"] span.deactivate a');
|
|
var overlay = document.querySelector('#mailpoet-deactivate-survey-modal');
|
|
if (obj.result === 'already-registered' || obj.result === 'registered') {
|
|
overlay.style.display = 'none';
|
|
location.href = deactivateLink.getAttribute('href');
|
|
}
|
|
};
|
|
</script>
|
|
<script type="text/javascript" charset="utf-8" src="https://secure.polldaddy.com/p/11161195.js"></script>
|
|
|
|
<noscript><a href="https://poll.fm/11161195">We're sorry to see you leave. Could you tell us more why are you deactivating MailPoet?</a></noscript>
|
|
|
|
<a class="button" id="mailpoet-deactivate-survey-close"><%= __('Skip survey and deactivate MailPoet') %> →</a>
|
|
</div>
|
|
</div>
|
|
</div>
|