| 1 |
/* |
| 2 |
|
| 3 |
html example: |
| 4 |
|
| 5 |
<a href="#" " |
| 6 |
class="button button-primary"> |
| 7 |
Open |
| 8 |
</a> |
| 9 |
|
| 10 |
|
| 11 |
<div class="wdk-modal wdk-fade" id="noticeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" |
| 12 |
style="display: none;" aria-hidden="true"> |
| 13 |
<div class="modal-dialog modal-notice"> |
| 14 |
<div class="modal-content"> |
| 15 |
<div class="modal-header"> |
| 16 |
<h5 class="modal-title"><?php echo esc_html__('How Add Link Calendar Into Google?', 'wpdirectorykit'); ?> |
| 17 |
</h5> |
| 18 |
<button type="button" class="close" data-wdk-dismiss="modal" aria-hidden="true"> |
| 19 |
<span class="dashicons dashicons-no-alt"></span> |
| 20 |
</button> |
| 21 |
</div> |
| 22 |
<div class="modal-body"> |
| 23 |
<div class="instruction"> |
| 24 |
<h4><strong><?php echo esc_html__('1. Open Settings On Google Calendar', 'wpdirectorykit'); ?></strong> |
| 25 |
</h4> |
| 26 |
<br> |
| 27 |
<img src="<?php echo esc_url(WDK_BOOKING_URL . 'public/img/google_calendar_guide.jpg'); ?>" |
| 28 |
alt="Thumbnail Image"> |
| 29 |
</div> |
| 30 |
<br> |
| 31 |
<div class="instruction"> |
| 32 |
<h4><strong><?php echo esc_html__('2. Copy Past Event Link', 'wpdirectorykit'); ?></strong></h4> |
| 33 |
<p class="description"> |
| 34 |
<textarea row="5" style="width:100%" |
| 35 |
class="wp-editor-area"><?php echo get_admin_url() . "admin.php?page=wdk-bookings-calendar&function=export_icl_calendar&hash=" . substr(md5(wmvc_show_data('idcalendar', $db_data, '-') . 'ms1f5c06b3b3e34'), 0, 10); ?></textarea> |
| 36 |
</p> |
| 37 |
</div> |
| 38 |
</div> |
| 39 |
<div class="modal-footer justify-content-center"> |
| 40 |
<button type="button" class="button button-secondary" |
| 41 |
data-wdk-dismiss="modal"><?php echo esc_html__('Close', 'wpdirectorykit'); ?></button> |
| 42 |
</div> |
| 43 |
</div> |
| 44 |
</div> |
| 45 |
|
| 46 |
|
| 47 |
*/ |
| 48 |
|
| 49 |
|
| 50 |
const wdk_log_modal = () => { |
| 51 |
var $ = jQuery; |
| 52 |
|
| 53 |
$('*[data-wdk-toggle="modal"][data-wdk-target]:not(.init)').on('click', function(e){ |
| 54 |
e.preventDefault(); |
| 55 |
e.stopPropagation(); |
| 56 |
$('.wdk-modal'+$(this).attr('data-wdk-target')).show().toggleClass("active"); |
| 57 |
$("body").addClass("wdk-overlay-bgg"); |
| 58 |
}).addClass('init'); |
| 59 |
|
| 60 |
$("html").on("click", function (e) { |
| 61 |
if ($(e.target).closest('.modal-content').length) return; |
| 62 |
if ($(e.target).closest('.select2-container').length) return; |
| 63 |
if ($(e.target).closest('.daterangepicker').length) return; |
| 64 |
|
| 65 |
|
| 66 |
$('.wdk-modal').hide().removeClass("active"); |
| 67 |
$("body").removeClass("wdk-overlay-bgg"); |
| 68 |
}); |
| 69 |
|
| 70 |
$('*[data-wdk-dismiss="modal"]:not(.init)').on('click', function(e){ |
| 71 |
e.preventDefault(); |
| 72 |
|
| 73 |
if($(this).attr('data-wdk-target')) { |
| 74 |
$('.wdk-modal'+$(this).attr('data-wdk-target')).hide().removeClass("active"); |
| 75 |
} else { |
| 76 |
$(this).closest('.wdk-modal').hide().removeClass("active"); |
| 77 |
} |
| 78 |
|
| 79 |
$("body").removeClass("wdk-overlay-bgg"); |
| 80 |
}).addClass('init'); |
| 81 |
|
| 82 |
$('.wdk-modal:not(.init)').each(function () { |
| 83 |
if($(this).hasClass('nodetach')) { |
| 84 |
$(this).addClass('init'); |
| 85 |
} else { |
| 86 |
$('body').append($(this).detach().addClass('init')); |
| 87 |
} |
| 88 |
|
| 89 |
}) |
| 90 |
} |
| 91 |
|
| 92 |
jQuery(document).on('ready', function(){ |
| 93 |
wdk_log_modal(); |
| 94 |
}); |