| 1 |
(function ($) { |
| 2 |
$(document).ready(function () { |
| 3 |
|
| 4 |
// import data |
| 5 |
$(document).on("click", ".ppv_import_data", function (e) { |
| 6 |
e.preventDefault(); |
| 7 |
$.ajax({ |
| 8 |
url: ppvAdmin.ajaxUrl, |
| 9 |
data: { |
| 10 |
action: "ppv_import_data", |
| 11 |
}, |
| 12 |
success: function (data) { |
| 13 |
const result = JSON.parse(data); |
| 14 |
if (result.success === true) { |
| 15 |
location.href = location.href + "?ppv-import=success"; |
| 16 |
} |
| 17 |
}, |
| 18 |
}); |
| 19 |
}); |
| 20 |
|
| 21 |
// copy to clipboard |
| 22 |
$(".bplde_front_shortcode input").on("click", function (e) { |
| 23 |
e.preventDefault(); |
| 24 |
|
| 25 |
let shortcode = $(this).parent().find("input")[0]; |
| 26 |
shortcode.select(); |
| 27 |
shortcode.setSelectionRange(0, 30); |
| 28 |
document.execCommand("copy"); |
| 29 |
$(this).parent().find(".htooltip").text("Copied Successfully!"); |
| 30 |
}); |
| 31 |
|
| 32 |
$(".bplde_front_shortcode input").on("mouseout", function () { |
| 33 |
$(this).parent().find(".htooltip").text("Copy To Clipboard"); |
| 34 |
}); |
| 35 |
|
| 36 |
|
| 37 |
$(document).on("click", ".pdfp_shortcode_copy_btn", function (e) { |
| 38 |
e.preventDefault(); |
| 39 |
|
| 40 |
const text = $(this).data("clipboard-text"); |
| 41 |
if (navigator.clipboard) { |
| 42 |
navigator.clipboard.writeText(text); |
| 43 |
} else { |
| 44 |
const tempInput = document.createElement("input"); |
| 45 |
tempInput.value = text; |
| 46 |
document.body.appendChild(tempInput); |
| 47 |
tempInput.select(); |
| 48 |
document.execCommand("copy"); |
| 49 |
document.body.removeChild(tempInput); |
| 50 |
} |
| 51 |
$(this).text("Copied!"); |
| 52 |
setTimeout(() => { |
| 53 |
$(this).text("Copy Shortcode"); |
| 54 |
}, 2000); |
| 55 |
}); |
| 56 |
|
| 57 |
|
| 58 |
}); |
| 59 |
})(jQuery); |
| 60 |
|