mirror of
https://github.com/Mabbs/mabbs.github.io
synced 2025-07-19 18:42:02 +00:00
Update 3 files
- /_config.yml - /assets/css/style.scss - /assets/js/main.js
This commit is contained in:
parent
9f2bed804e
commit
9d255a0a6f
@ -7,13 +7,6 @@ description: Mayx's Home Page
|
||||
timezone: Asia/Shanghai
|
||||
excerpt_separator: <!--more-->
|
||||
paginate: 7
|
||||
kramdown:
|
||||
syntax_highlighter_opts:
|
||||
span:
|
||||
line_numbers: false
|
||||
block:
|
||||
line_numbers: true
|
||||
start_line: 1
|
||||
plugins:
|
||||
- jekyll-sitemap
|
||||
- jekyll-feed
|
||||
|
@ -99,19 +99,4 @@ div.highlight button:active,
|
||||
div.highlight button:focus,
|
||||
div.highlight button:hover {
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
table.rouge-table {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
td.rouge-gutter,
|
||||
td.rouge-code {
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
pre.lineno {
|
||||
padding: 0 10px 0 0;
|
||||
border: none;
|
||||
}
|
@ -76,31 +76,32 @@ $(function () {
|
||||
highlightTextNodes(this);
|
||||
});
|
||||
});
|
||||
$(function () {
|
||||
var codeBlocks = document.querySelectorAll('div.highlight');
|
||||
|
||||
var codeBlocks = document.querySelectorAll('div.highlight');
|
||||
codeBlocks.forEach(function (codeBlock) {
|
||||
var copyButton = document.createElement('button');
|
||||
copyButton.className = 'copy';
|
||||
copyButton.type = 'button';
|
||||
copyButton.innerText = '📋';
|
||||
|
||||
codeBlocks.forEach(function (codeBlock) {
|
||||
var copyButton = document.createElement('button');
|
||||
copyButton.className = 'copy';
|
||||
copyButton.type = 'button';
|
||||
copyButton.innerText = '📋';
|
||||
codeBlock.append(copyButton);
|
||||
|
||||
codeBlock.append(copyButton);
|
||||
copyButton.addEventListener('click', function () {
|
||||
var code = codeBlock.querySelector('pre code').innerText.trim();
|
||||
window.navigator.clipboard.writeText(code)
|
||||
.then(() => {
|
||||
copyButton.innerText = '✅';
|
||||
})
|
||||
.catch(err => {
|
||||
copyButton.innerText = '❌';
|
||||
console.error('Failed to copy:', err);
|
||||
});
|
||||
|
||||
copyButton.addEventListener('click', function () {
|
||||
var code = codeBlock.querySelector('.rouge-code pre').innerText.trim();
|
||||
window.navigator.clipboard.writeText(code)
|
||||
.then(() => {
|
||||
copyButton.innerText = '✅';
|
||||
})
|
||||
.catch(err => {
|
||||
copyButton.innerText = '❌';
|
||||
console.error('Failed to copy:', err);
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
copyButton.innerText = '📋';
|
||||
}, 1500);
|
||||
setTimeout(function () {
|
||||
copyButton.innerText = '📋';
|
||||
}, 1500);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user