mirror of
https://gh.wpcy.net/https://github.com/4suredev/Avada-Custom-Visual-Builder-Button.git
synced 2026-04-27 06:38:16 +08:00
44 lines
No EOL
1.5 KiB
JavaScript
44 lines
No EOL
1.5 KiB
JavaScript
jQuery(document).ready(function($){
|
|
$("#button-shortcode-dialog").dialog({
|
|
autoOpen: false,
|
|
show: {
|
|
effect: "fade",
|
|
duration: 200
|
|
},
|
|
hide: {
|
|
effect: "fade",
|
|
duration: 200
|
|
},
|
|
close: function(event, ui){
|
|
$("#page-mask").css({'opacity': 0, 'pointer-events': 'none'});
|
|
},
|
|
minWidth: 480
|
|
});
|
|
acf.addAction('load', function(){
|
|
$(document).on("click", ".generate-button-shortcode", function(e){
|
|
e.preventDefault();
|
|
$("#button-shortcode-dialog").dialog("open");
|
|
$("#page-mask").css({"opacity":1, "pointer-events": "auto"});
|
|
});
|
|
});
|
|
$('.generate-button-shortcode').click(function(e){
|
|
e.preventDefault();
|
|
$("#button-shortcode-dialog").dialog("open");
|
|
$("#page-mask").css({"opacity":1, "pointer-events": "auto"});
|
|
});
|
|
$('.copy-code-btn').click(function(e){
|
|
var id = $(this).attr('id');
|
|
e.preventDefault();
|
|
var shortcode = $('#'+id+'-shortcode').val();
|
|
navigator.clipboard.writeText(shortcode);
|
|
$(this).tooltip({ items: $(this), content: "Copied to clipboard"});
|
|
$(this).tooltip("open");
|
|
});
|
|
$('.copy-code-btn').mouseout(function(){
|
|
$(this).tooltip({ items: $(this), content: "Copied to clipboard"});
|
|
$(this).tooltip("disable");
|
|
});
|
|
$('#page-mask').click(function(){
|
|
$('#button-shortcode-dialog').dialog("close");
|
|
});
|
|
}) |