This commit is contained in:
cuom1999 2024-01-29 20:43:28 -06:00
parent e22061fc84
commit 4b6ba43c42
3 changed files with 31 additions and 11 deletions

View file

@ -280,12 +280,18 @@ function registerPopper($trigger, $dropdown) {
function populateCopyButton() {
var copyButton;
$('pre code').each(function () {
var copyButton = $('<span>', {
'class': 'btn-clipboard',
'data-clipboard-text': $(this).text(),
'title': 'Click to copy'
}).append('<i class="fa fa-copy"></i>');
if ($(this).parent().width() > 100) {
copyButton.append('<span style="margin-left: 2px">Copy</span>');
}
$(this).before($('<div>', {'class': 'copy-clipboard'})
.append(copyButton = $('<span>', {
'class': 'btn-clipboard',
'data-clipboard-text': $(this).text(),
'title': 'Click to copy'
}).append('<i class="fa fa-copy"></i><span style="margin-left: 2px">Copy</span>')));
.append(copyButton));
$(copyButton.get(0)).mouseleave(function () {
$(this).attr('class', 'btn-clipboard');

View file

@ -173,7 +173,7 @@ pre {
@media (min-width: 800px) {
.content-description pre:has(code) {
min-width: 20em;
min-width: 3em;
}
#common-content {
display: flex;