PluginProbe
ShareMyPost / 1.0.7
ShareMyPost v1.0.7
1.0.7 trunk 1.0.4 1.0.5 1.0.6
sharemypost / assets / js / frontend.js

frontend.js in ShareMyPost 1.0.7, at assets/js/frontend.js

48 lines 945 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 if (network === 'print' || shareurl === '#') {
24 window.print();
25 return;
26 }
27
28 window.open(
29 shareurl,
30 '_blank',
31 'resizable=yes,scrollbars=yes,height=600,width=900'
32 );
33
34 if (!postid || !network) {
35 return;
36 }
37 }
38
39 // ===== share button click =====
40 $('.sharemypost-share-button:not(.sharemypost-network-universal), .sharemypost-modal-item').on('click', function (e) {
41 e.preventDefault();
42 process_share($(this));
43 if ($(this).hasClass('sharemypost-modal-item')) {
44 $('#sharemypost-modal-overlay').addClass('sharemypost-modal-hidden');
45 }
46 });
47
48 });