mirror of
https://github.com/Mabbs/mabbs.github.io
synced 2026-05-23 15:54:10 +02:00
Update 5 files
- /_layouts/default.html - /_data/proxylist.yml - /assets/js/main.js - /assets/js/pjax.js - /assets/js/main_new.js
This commit is contained in:
parent
1a529143a8
commit
481df19596
@ -24,6 +24,7 @@ mirrors:
|
|||||||
- https://mabbs.kinsta.page/
|
- https://mabbs.kinsta.page/
|
||||||
- https://mayx.codeberg.page/
|
- https://mayx.codeberg.page/
|
||||||
- https://mayx.tildepages.org/
|
- https://mayx.tildepages.org/
|
||||||
|
- https://mayx.pandastack.app/
|
||||||
- https://mayx.pages.lain.la/
|
- https://mayx.pages.lain.la/
|
||||||
- https://mayx.4everland.app/
|
- https://mayx.4everland.app/
|
||||||
- https://mayx.readthedocs.io/
|
- https://mayx.readthedocs.io/
|
||||||
|
|||||||
@ -17,7 +17,7 @@ layout: xslt_container
|
|||||||
<link rel="stylesheet" href="/assets/css/style.css?v={{ site.time | date: "%s" }}" />
|
<link rel="stylesheet" href="/assets/css/style.css?v={{ site.time | date: "%s" }}" />
|
||||||
<!--[if !IE]> -->
|
<!--[if !IE]> -->
|
||||||
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
|
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
|
||||||
<link rel="stylesheet" href="/assets/css/gitalk.css">
|
<link rel="stylesheet" href="/assets/css/gitalk.css" />
|
||||||
<script src="/assets/js/gitalk.min.js"></script>
|
<script src="/assets/js/gitalk.min.js"></script>
|
||||||
<!-- <![endif]-->
|
<!-- <![endif]-->
|
||||||
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="{{ site.title }}" />
|
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="{{ site.title }}" />
|
||||||
|
|||||||
@ -1,6 +1,22 @@
|
|||||||
var message_Path = '/Live2dHistoire/live2d/';
|
var message_Path = '/Live2dHistoire/live2d/';
|
||||||
var talkAPI = BlogAPI + "/ai_chat";
|
var talkAPI = BlogAPI + "/ai_chat";
|
||||||
|
|
||||||
|
function initVisitors() {
|
||||||
|
if ($('.visitors').length === 1) {
|
||||||
|
var $visitor = $('.visitors:first');
|
||||||
|
$.get(BlogAPI + '/count_click_add?id=' + $visitor.attr('id'), function (data) {
|
||||||
|
$visitor.text(Number(data));
|
||||||
|
});
|
||||||
|
} else if ($('.visitors-index').length > 0) {
|
||||||
|
$('.visitors-index').each(function () {
|
||||||
|
var $elem = $(this);
|
||||||
|
$.get(BlogAPI + '/count_click?id=' + $elem.attr('id'), function (data) {
|
||||||
|
$elem.text(Number(data));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
(function () {
|
(function () {
|
||||||
var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
|
var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
|
||||||
@ -14,25 +30,7 @@ $(function () {
|
|||||||
$(function () { $backToTopFun(); });
|
$(function () { $backToTopFun(); });
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function showHitCount() {
|
initVisitors();
|
||||||
$(".visitors-index").each(function () {
|
|
||||||
var $elem = $(this);
|
|
||||||
$.get(BlogAPI + "/count_click?id=" + $elem.attr('id'), function (data) {
|
|
||||||
$elem.text(Number(data));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function addCount() {
|
|
||||||
var $visitor = $(".visitors:first");
|
|
||||||
$.get(BlogAPI + "/count_click_add?id=" + $visitor.attr('id'), function (data) {
|
|
||||||
$visitor.text(Number(data));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if ($('.visitors').length == 1) {
|
|
||||||
addCount();
|
|
||||||
} else if ($('.visitors-index').length > 0) {
|
|
||||||
showHitCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Math.floor((new Date().getTime() - lastUpdated.getTime()) / (24 * 60 * 60 * 1000)) > 90) {
|
if (Math.floor((new Date().getTime() - lastUpdated.getTime()) / (24 * 60 * 60 * 1000)) > 90) {
|
||||||
$("html").css({
|
$("html").css({
|
||||||
|
|||||||
@ -43,35 +43,21 @@ $(function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function() {
|
function initCopyButtons() {
|
||||||
var $codeBlocks = $('div.highlight');
|
$('.copy').remove();
|
||||||
|
$('div.highlight').each(function () {
|
||||||
$codeBlocks.each(function() {
|
var $btn = $('<button>', { class: 'copy', type: 'button', text: '📋' });
|
||||||
var $copyButton = $('<button>', {
|
$(this).append($btn);
|
||||||
class: 'copy',
|
$btn.on('click', function () {
|
||||||
type: 'button',
|
var code = $btn.siblings('pre').find('code').text().trim();
|
||||||
text: '📋'
|
|
||||||
});
|
|
||||||
|
|
||||||
$(this).append($copyButton);
|
|
||||||
|
|
||||||
$copyButton.on('click', function() {
|
|
||||||
var code = $(this).siblings('pre').find('code').text().trim();
|
|
||||||
var $button = $(this);
|
|
||||||
|
|
||||||
navigator.clipboard.writeText(code)
|
navigator.clipboard.writeText(code)
|
||||||
.then(function() {
|
.then(function () { $btn.text('✅'); })
|
||||||
$button.text('✅');
|
.catch(function () { $btn.text('❌'); })
|
||||||
})
|
.finally(function () { setTimeout(function () { $btn.text('📋'); }, 1500); });
|
||||||
.catch(function(err) {
|
|
||||||
$button.text('❌');
|
|
||||||
console.error('复制失败:', err);
|
|
||||||
})
|
|
||||||
.finally(function() {
|
|
||||||
setTimeout(function() {
|
|
||||||
$button.text('📋');
|
|
||||||
}, 1500);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
initCopyButtons();
|
||||||
});
|
});
|
||||||
@ -16,25 +16,6 @@
|
|||||||
|
|
||||||
// ========== 各组件重初始化 ==========
|
// ========== 各组件重初始化 ==========
|
||||||
|
|
||||||
/** 访问量统计 */
|
|
||||||
function reinitVisitors() {
|
|
||||||
if (typeof BlogAPI === 'undefined') return;
|
|
||||||
var apiBase = BlogAPI;
|
|
||||||
if ($('.visitors').length === 1) {
|
|
||||||
var $visitor = $('.visitors:first');
|
|
||||||
$.get(apiBase + '/count_click_add?id=' + $visitor.attr('id'), function (data) {
|
|
||||||
$visitor.text(Number(data));
|
|
||||||
});
|
|
||||||
} else if ($('.visitors-index').length > 0) {
|
|
||||||
$('.visitors-index').each(function () {
|
|
||||||
var $elem = $(this);
|
|
||||||
$.get(apiBase + '/count_click?id=' + $elem.attr('id'), function (data) {
|
|
||||||
$elem.text(Number(data));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** AI 摘要(post.html 内联脚本,pjax 后由 executeScripts 触发) */
|
/** AI 摘要(post.html 内联脚本,pjax 后由 executeScripts 触发) */
|
||||||
function reinitAISummary() {
|
function reinitAISummary() {
|
||||||
if (typeof ai_gen === 'function' && $('#ai-output').length) {
|
if (typeof ai_gen === 'function' && $('#ai-output').length) {
|
||||||
@ -42,23 +23,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 代码块复制按钮 */
|
|
||||||
function reinitCopyButtons() {
|
|
||||||
$('.copy').remove();
|
|
||||||
$('div.highlight').each(function () {
|
|
||||||
var $block = $(this);
|
|
||||||
var $btn = $('<button>', { class: 'copy', type: 'button', text: '📋' });
|
|
||||||
$block.append($btn);
|
|
||||||
$btn.on('click', function () {
|
|
||||||
var code = $btn.siblings('pre').find('code').text().trim();
|
|
||||||
navigator.clipboard.writeText(code)
|
|
||||||
.then(function () { $btn.text('✅'); })
|
|
||||||
.catch(function () { $btn.text('❌'); })
|
|
||||||
.finally(function () { setTimeout(function () { $btn.text('📋'); }, 1500); });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 关键词高亮 */
|
/** 关键词高亮 */
|
||||||
function reinitHighlight() {
|
function reinitHighlight() {
|
||||||
var keyword = new URLSearchParams(window.location.search).get('kw');
|
var keyword = new URLSearchParams(window.location.search).get('kw');
|
||||||
@ -158,8 +122,8 @@
|
|||||||
|
|
||||||
/** 每次 pjax 完成后执行所有重初始化 */
|
/** 每次 pjax 完成后执行所有重初始化 */
|
||||||
function onPjaxComplete() {
|
function onPjaxComplete() {
|
||||||
reinitVisitors();
|
initVisitors();
|
||||||
reinitCopyButtons();
|
initCopyButtons();
|
||||||
reinitHighlight();
|
reinitHighlight();
|
||||||
reinitAISummary();
|
reinitAISummary();
|
||||||
reinitLive2d();
|
reinitLive2d();
|
||||||
@ -206,8 +170,6 @@
|
|||||||
newScript.remove();
|
newScript.remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// 首次加载初始化
|
|
||||||
reinitCopyButtons();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
Loading…
Reference in New Issue
Block a user