pulsante copia codice
This commit is contained in:
parent
8a1cbf0235
commit
8ec065cbcc
@ -57,3 +57,47 @@ figcaption {
|
|||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* pulsante copia codice */
|
||||||
|
.copy-code-button {
|
||||||
|
color: #272822;
|
||||||
|
background-color: #f7990e,;
|
||||||
|
border-color: #272822;
|
||||||
|
border: 2px solid;
|
||||||
|
border-radius: 4px 4px 0px 0px;
|
||||||
|
min-width: auto;
|
||||||
|
|
||||||
|
/* right-align */
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-top: 5px;
|
||||||
|
|
||||||
|
margin-bottom: -2px;
|
||||||
|
padding: 0px 3px;
|
||||||
|
font-size: 0.5em;
|
||||||
|
font-variant-caps: small-caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-code-button:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #fff;
|
||||||
|
border-color: #272822;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-code-button:focus {
|
||||||
|
/* Avoid an ugly focus outline on click in Chrome,
|
||||||
|
but darken the button for accessibility.
|
||||||
|
See https://stackoverflow.com/a/25298082/1481479 */
|
||||||
|
background-color: #272822;
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-code-button:active {
|
||||||
|
background-color: #272822;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight pre {
|
||||||
|
/* Avoid pushing up the copy buttons. */
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
@ -44,7 +44,7 @@ smtp_helo_name = pve.nomedominio.it
|
|||||||
|
|
||||||
Creare il file `/etc/postfix/sasl_passwd` inserendo:
|
Creare il file `/etc/postfix/sasl_passwd` inserendo:
|
||||||
|
|
||||||
```conf
|
```text
|
||||||
[smtp.gmail.com]:587 mia_mail@gmail.com:PASSWD
|
[smtp.gmail.com]:587 mia_mail@gmail.com:PASSWD
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ Inviare una mail di prova:
|
|||||||
echo "Test mail from postfix" | mail -s "Test Postfix" test@test.com
|
echo "Test mail from postfix" | mail -s "Test Postfix" test@test.com
|
||||||
```
|
```
|
||||||
|
|
||||||
```conf
|
```text
|
||||||
/var/log/mail.log
|
/var/log/mail.log
|
||||||
/var/log/mail.info
|
/var/log/mail.info
|
||||||
/var/log/mail.warn
|
/var/log/mail.warn
|
||||||
|
@ -41,4 +41,46 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{- .Content }}
|
{{- .Content }}
|
||||||
|
|
||||||
|
{{ if (findRE "<pre" .Content 1) }}
|
||||||
|
<script>
|
||||||
|
function addCopyButtons(clipboard) {
|
||||||
|
document.querySelectorAll('pre > code').forEach(function (codeBlock) {
|
||||||
|
var button = document.createElement('button');
|
||||||
|
button.className = 'copy-code-button';
|
||||||
|
button.type = 'button';
|
||||||
|
button.innerText = 'Copy';
|
||||||
|
|
||||||
|
button.addEventListener('click', function () {
|
||||||
|
clipboard.writeText(codeBlock.innerText).then(function () {
|
||||||
|
/* Chrome doesn't seem to blur automatically,
|
||||||
|
leaving the button in a focused state. */
|
||||||
|
button.blur();
|
||||||
|
|
||||||
|
button.innerText = 'Copied!';
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
button.innerText = 'Copy';
|
||||||
|
}, 2000);
|
||||||
|
}, function (error) {
|
||||||
|
button.innerText = 'Error';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var pre = codeBlock.parentNode;
|
||||||
|
if (pre.parentNode.classList.contains('highlight')) {
|
||||||
|
var highlight = pre.parentNode;
|
||||||
|
highlight.parentNode.insertBefore(button, highlight);
|
||||||
|
} else {
|
||||||
|
pre.parentNode.insertBefore(button, pre);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (navigator && navigator.clipboard) {
|
||||||
|
addCopyButtons(navigator.clipboard);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user