| 1 |
(function ($) { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
$(document).ready(function ($) { |
| 5 |
|
| 6 |
//select all text on click of shortcode text |
| 7 |
$('.cbxgooglemapshortcode').on('click', function (event) { |
| 8 |
var text = $(this).text(); |
| 9 |
var $this = $(this); |
| 10 |
var $input = $('<input class="cbxgooglemapshortcode-text" type="text">'); |
| 11 |
$input.prop('value', text); |
| 12 |
$input.insertAfter($(this)); |
| 13 |
$input.focus(); |
| 14 |
$input.select(); |
| 15 |
try { |
| 16 |
document.execCommand('copy'); |
| 17 |
} catch (err) { |
| 18 |
|
| 19 |
} |
| 20 |
$this.hide(); |
| 21 |
$input.on('focusout', function (event) { |
| 22 |
$this.show(); |
| 23 |
$input.remove(); |
| 24 |
}); |
| 25 |
}); |
| 26 |
|
| 27 |
}); |
| 28 |
})(jQuery); |
| 29 |
|