| 1 |
jQuery(function ($) { |
| 2 |
|
| 3 |
let clickBusy = false; |
| 4 |
|
| 5 |
// ===== core share processor ===== |
| 6 |
function process_share($el) { |
| 7 |
if (clickBusy) { |
| 8 |
return; |
| 9 |
} |
| 10 |
|
| 11 |
let shareurl = $el.attr('href'), |
| 12 |
postid = $el.data('post-id'), |
| 13 |
network = $el.data('network'); |
| 14 |
|
| 15 |
if (!shareurl) { |
| 16 |
return; |
| 17 |
} |
| 18 |
|
| 19 |
clickBusy = true; |
| 20 |
setTimeout(function () { |
| 21 |
clickBusy = false; |
| 22 |
}, 1000); |
| 23 |
|
| 24 |
window.open( |
| 25 |
shareurl, |
| 26 |
'_blank', |
| 27 |
'resizable=yes,scrollbars=yes,height=600,width=900' |
| 28 |
); |
| 29 |
|
| 30 |
if (!postid || !network) { |
| 31 |
return; |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
// ===== share button click ===== |
| 36 |
$('.sharemypost-share-button:not(.sharemypost-network-universal), .sharemypost-modal-item').on('click', function (e) { |
| 37 |
e.preventDefault(); |
| 38 |
process_share($(this)); |
| 39 |
if ($(this).hasClass('sharemypost-modal-item')) { |
| 40 |
$('#sharemypost-modal-overlay').addClass('sharemypost-modal-hidden'); |
| 41 |
} |
| 42 |
}); |
| 43 |
|
| 44 |
}); |