Compare commits
10 Commits
d0e11eed3b
...
e34bfe5047
| Author | SHA1 | Date | |
|---|---|---|---|
| e34bfe5047 | |||
| 5c362b1075 | |||
| c9cebf0c14 | |||
| a12af3c4df | |||
| 731f573b2c | |||
| 549fec6a53 | |||
| 1eb5d85eaf | |||
| 73103ea853 | |||
| 67d1465014 | |||
| 7f79a14e3e |
446
argontheme.js
446
argontheme.js
@@ -44,6 +44,31 @@ if (typeof jQuery !== 'undefined') {
|
||||
return x === 1 ? 1 : 1 - Math.pow(2, -10 * x);
|
||||
};
|
||||
}
|
||||
|
||||
if (!$.fn._argonInit) {
|
||||
$.fn._argonInit = $.fn.init;
|
||||
$.fn.init = function(selector, context, root) {
|
||||
// 修复空选择器、特殊字符和中文标点导致的语法错误
|
||||
if (typeof selector === 'string') {
|
||||
let trimmed = selector.trim();
|
||||
// 检查是否为空或只有 # 符号
|
||||
if (trimmed === '' || trimmed === '#') {
|
||||
return new $.fn._argonInit();
|
||||
}
|
||||
// 检查是否包含中文标点(可能导致语法错误)
|
||||
if (/[;,。:!?]/.test(trimmed)) {
|
||||
console.warn('[Argon] Invalid selector with Chinese punctuation:', selector);
|
||||
return new $.fn._argonInit();
|
||||
}
|
||||
// 检查 ID 选择器是否有效(#后面必须有内容)
|
||||
if (/^#\s*$/.test(trimmed)) {
|
||||
return new $.fn._argonInit();
|
||||
}
|
||||
}
|
||||
return $.fn._argonInit.call(this, selector, context, root);
|
||||
};
|
||||
$.fn.init.prototype = $.fn;
|
||||
}
|
||||
|
||||
// 确保 zoomify 插件存在
|
||||
if (typeof $.fn.zoomify === 'undefined') {
|
||||
@@ -2336,17 +2361,34 @@ $(document).on("submit" , ".post-password-form" , function(){
|
||||
|
||||
/*URL 和# 根据 ID 定位*/
|
||||
function gotoHash(hash, durtion, easing = 'easeOutExpo'){
|
||||
if (hash.length == 0){
|
||||
if (!hash || hash === "#"){
|
||||
return;
|
||||
}
|
||||
if ($(hash).length == 0){
|
||||
var target = null;
|
||||
var decodedId = "";
|
||||
try {
|
||||
decodedId = decodeURIComponent(hash.slice(1));
|
||||
} catch (err) {
|
||||
decodedId = hash.slice(1);
|
||||
}
|
||||
if (decodedId) {
|
||||
target = document.getElementById(decodedId);
|
||||
}
|
||||
if (!target) {
|
||||
try {
|
||||
target = document.querySelector(hash);
|
||||
} catch (err) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!target){
|
||||
return;
|
||||
}
|
||||
if (durtion == null){
|
||||
durtion = 200;
|
||||
}
|
||||
$("body,html").stop().animate({
|
||||
scrollTop: $(hash).offset().top - 80
|
||||
scrollTop: $(target).offset().top - 80
|
||||
}, durtion, easing);
|
||||
}
|
||||
function getHash(url){
|
||||
@@ -2565,6 +2607,16 @@ function loadImageOptimized(img, effect) {
|
||||
requestAnimationFrame(function() {
|
||||
img.src = src;
|
||||
img.removeAttribute('data-src');
|
||||
let srcset = img.getAttribute('data-srcset');
|
||||
if (srcset) {
|
||||
img.setAttribute('srcset', srcset);
|
||||
img.removeAttribute('data-srcset');
|
||||
}
|
||||
let sizes = img.getAttribute('data-sizes');
|
||||
if (sizes) {
|
||||
img.setAttribute('sizes', sizes);
|
||||
img.removeAttribute('data-sizes');
|
||||
}
|
||||
img.classList.remove('lazyload');
|
||||
|
||||
// 移除所有lazyload-style-* 类
|
||||
@@ -2579,6 +2631,16 @@ function loadImageOptimized(img, effect) {
|
||||
requestAnimationFrame(function() {
|
||||
img.src = src;
|
||||
img.removeAttribute('data-src');
|
||||
let srcset = img.getAttribute('data-srcset');
|
||||
if (srcset) {
|
||||
img.setAttribute('srcset', srcset);
|
||||
img.removeAttribute('data-srcset');
|
||||
}
|
||||
let sizes = img.getAttribute('data-sizes');
|
||||
if (sizes) {
|
||||
img.setAttribute('sizes', sizes);
|
||||
img.removeAttribute('data-sizes');
|
||||
}
|
||||
img.classList.remove('lazyload');
|
||||
img.className = img.className.replace(/\blazyload-style-\d+\b/g, '').trim();
|
||||
|
||||
@@ -2688,6 +2750,16 @@ function loadAllImagesImmediately() {
|
||||
if (src) {
|
||||
img.src = src;
|
||||
img.removeAttribute('data-src');
|
||||
let srcset = img.getAttribute('data-srcset');
|
||||
if (srcset) {
|
||||
img.setAttribute('srcset', srcset);
|
||||
img.removeAttribute('data-srcset');
|
||||
}
|
||||
let sizes = img.getAttribute('data-sizes');
|
||||
if (sizes) {
|
||||
img.setAttribute('sizes', sizes);
|
||||
img.removeAttribute('data-sizes');
|
||||
}
|
||||
img.classList.remove('lazyload');
|
||||
img.className = img.className.replace(/\blazyload-style-\d+\b/g, '').trim();
|
||||
}
|
||||
@@ -3085,6 +3157,9 @@ function executeInlineScripts(container) {
|
||||
|
||||
// 需求 4.3: 按照脚本在 DOM 中的顺序执行
|
||||
scripts.forEach((script, index) => {
|
||||
if (script.getAttribute('data-pjax-executed') === 'true') {
|
||||
return;
|
||||
}
|
||||
// 需求 4.2: 只执行内联脚本(没有 src 属性的脚本)
|
||||
if (!script.src) {
|
||||
// 跳过空脚本
|
||||
@@ -3098,6 +3173,7 @@ function executeInlineScripts(container) {
|
||||
// 需求 4.4: 错误隔离 - 单个脚本失败不影响其他脚本
|
||||
const success = executeScript(script);
|
||||
if (success) {
|
||||
script.setAttribute('data-pjax-executed', 'true');
|
||||
successCount++;
|
||||
} else {
|
||||
failedCount++;
|
||||
@@ -3118,9 +3194,288 @@ function executeInlineScripts(container) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var pjaxContainerSelectors = ['#primary', '#leftbar_part1_menu', '#leftbar_part2_inner', '.page-information-card-container', '#rightbar', '#wpadminbar'];
|
||||
var pjaxContainers = pjaxContainerSelectors.filter(function(selector) {
|
||||
return document.querySelector(selector);
|
||||
});
|
||||
|
||||
// ==========================================================================
|
||||
// 现代化页面加载系统
|
||||
// ==========================================================================
|
||||
|
||||
/**
|
||||
* 页面加载管理器 - 提供智能加载动画和进度追踪
|
||||
*/
|
||||
const PageLoader = (function() {
|
||||
// 配置常量
|
||||
const CONFIG = {
|
||||
OVERLAY_ID: 'page-loader',
|
||||
MIN_DISPLAY_TIME: 400, // 最小显示时间(避免闪烁)
|
||||
FADE_DURATION: 350, // 淡出动画时长
|
||||
PROGRESS_STEP: 0.1, // 进度条步进
|
||||
PROGRESS_INTERVAL: 200, // 进度更新间隔
|
||||
SKELETON_DELAY: 150 // 骨架屏延迟显示
|
||||
};
|
||||
|
||||
// 状态管理
|
||||
let state = {
|
||||
element: null,
|
||||
isVisible: false,
|
||||
startTime: 0,
|
||||
progress: 0,
|
||||
progressTimer: null,
|
||||
hideTimer: null,
|
||||
skeletonTimer: null
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建加载动画 HTML
|
||||
*/
|
||||
function createHTML() {
|
||||
return `
|
||||
<div class="page-loader-backdrop"></div>
|
||||
<div class="page-loader-content">
|
||||
<!-- 进度环 -->
|
||||
<div class="loader-ring-container">
|
||||
<svg class="loader-ring" viewBox="0 0 100 100">
|
||||
<circle class="loader-ring-bg" cx="50" cy="50" r="45"></circle>
|
||||
<circle class="loader-ring-progress" cx="50" cy="50" r="45"></circle>
|
||||
</svg>
|
||||
<div class="loader-icon">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 加载文字 -->
|
||||
<div class="loader-text">
|
||||
<div class="loader-title">加载中</div>
|
||||
<div class="loader-subtitle">正在为您准备内容</div>
|
||||
</div>
|
||||
|
||||
<!-- 骨架屏(延迟显示) -->
|
||||
<div class="loader-skeleton">
|
||||
<div class="skeleton-card">
|
||||
<div class="skeleton-image"></div>
|
||||
<div class="skeleton-content">
|
||||
<div class="skeleton-title"></div>
|
||||
<div class="skeleton-line"></div>
|
||||
<div class="skeleton-line short"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建加载器元素
|
||||
*/
|
||||
function createElement() {
|
||||
const el = document.createElement('div');
|
||||
el.id = CONFIG.OVERLAY_ID;
|
||||
el.className = 'page-loader';
|
||||
el.innerHTML = createHTML();
|
||||
return el;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取或创建元素
|
||||
*/
|
||||
function getElement() {
|
||||
if (!state.element) {
|
||||
state.element = document.getElementById(CONFIG.OVERLAY_ID);
|
||||
if (!state.element) {
|
||||
state.element = createElement();
|
||||
document.body.appendChild(state.element);
|
||||
}
|
||||
}
|
||||
return state.element;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新进度环
|
||||
*/
|
||||
function updateProgress(progress) {
|
||||
const el = state.element;
|
||||
if (!el) return;
|
||||
|
||||
const circle = el.querySelector('.loader-ring-progress');
|
||||
if (circle) {
|
||||
const circumference = 2 * Math.PI * 45;
|
||||
const offset = circumference - (progress / 100) * circumference;
|
||||
circle.style.strokeDashoffset = offset;
|
||||
}
|
||||
|
||||
state.progress = progress;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动递增进度
|
||||
*/
|
||||
function startProgressAnimation() {
|
||||
stopProgressAnimation();
|
||||
|
||||
state.progress = 0;
|
||||
updateProgress(0);
|
||||
|
||||
state.progressTimer = setInterval(function() {
|
||||
if (state.progress < 90) {
|
||||
// 使用缓动函数,越接近 90% 越慢
|
||||
const increment = CONFIG.PROGRESS_STEP * (1 - state.progress / 100);
|
||||
state.progress = Math.min(90, state.progress + increment * 10);
|
||||
updateProgress(state.progress);
|
||||
}
|
||||
}, CONFIG.PROGRESS_INTERVAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止进度动画
|
||||
*/
|
||||
function stopProgressAnimation() {
|
||||
if (state.progressTimer) {
|
||||
clearInterval(state.progressTimer);
|
||||
state.progressTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成进度到 100%
|
||||
*/
|
||||
function completeProgress() {
|
||||
stopProgressAnimation();
|
||||
updateProgress(100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示加载器
|
||||
*/
|
||||
function show() {
|
||||
// 清理之前的定时器
|
||||
if (state.hideTimer) {
|
||||
clearTimeout(state.hideTimer);
|
||||
state.hideTimer = null;
|
||||
}
|
||||
if (state.skeletonTimer) {
|
||||
clearTimeout(state.skeletonTimer);
|
||||
state.skeletonTimer = null;
|
||||
}
|
||||
|
||||
const el = getElement();
|
||||
state.startTime = Date.now();
|
||||
state.isVisible = true;
|
||||
|
||||
// 移除隐藏类,添加显示类
|
||||
el.classList.remove('is-hiding');
|
||||
void el.offsetWidth; // 强制重排
|
||||
el.classList.add('is-visible');
|
||||
|
||||
// 启动进度动画
|
||||
startProgressAnimation();
|
||||
|
||||
// 延迟显示骨架屏(避免快速加载时闪烁)
|
||||
state.skeletonTimer = setTimeout(function() {
|
||||
if (state.isVisible && el) {
|
||||
el.classList.add('show-skeleton');
|
||||
}
|
||||
}, CONFIG.SKELETON_DELAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏加载器
|
||||
*/
|
||||
function hide() {
|
||||
if (!state.isVisible) return;
|
||||
|
||||
const el = state.element;
|
||||
if (!el) return;
|
||||
|
||||
// 完成进度
|
||||
completeProgress();
|
||||
|
||||
// 计算已显示时间
|
||||
const elapsedTime = Date.now() - state.startTime;
|
||||
const remainingTime = Math.max(0, CONFIG.MIN_DISPLAY_TIME - elapsedTime);
|
||||
|
||||
// 确保最小显示时间后再隐藏
|
||||
state.hideTimer = setTimeout(function() {
|
||||
el.classList.add('is-hiding');
|
||||
el.classList.remove('show-skeleton');
|
||||
|
||||
// 动画结束后清理
|
||||
setTimeout(function() {
|
||||
el.classList.remove('is-visible', 'is-hiding');
|
||||
state.isVisible = false;
|
||||
stopProgressAnimation();
|
||||
}, CONFIG.FADE_DURATION);
|
||||
}, remainingTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置进度(手动控制)
|
||||
*/
|
||||
function setProgress(progress) {
|
||||
progress = Math.max(0, Math.min(100, progress));
|
||||
stopProgressAnimation();
|
||||
updateProgress(progress);
|
||||
}
|
||||
|
||||
/**
|
||||
* 销毁加载器
|
||||
*/
|
||||
function destroy() {
|
||||
stopProgressAnimation();
|
||||
|
||||
if (state.hideTimer) {
|
||||
clearTimeout(state.hideTimer);
|
||||
state.hideTimer = null;
|
||||
}
|
||||
if (state.skeletonTimer) {
|
||||
clearTimeout(state.skeletonTimer);
|
||||
state.skeletonTimer = null;
|
||||
}
|
||||
|
||||
if (state.element && state.element.parentNode) {
|
||||
state.element.parentNode.removeChild(state.element);
|
||||
}
|
||||
|
||||
state.element = null;
|
||||
state.isVisible = false;
|
||||
}
|
||||
|
||||
// 公开 API
|
||||
return {
|
||||
show: show,
|
||||
hide: hide,
|
||||
setProgress: setProgress,
|
||||
destroy: destroy
|
||||
};
|
||||
})();
|
||||
function startPageTransition() {
|
||||
document.documentElement.classList.add('page-transition-enter');
|
||||
pjaxContainers.forEach(function(selector) {
|
||||
var c = document.querySelector(selector);
|
||||
if (c) c.classList.add('page-transition-content');
|
||||
});
|
||||
}
|
||||
function activatePageTransition() {
|
||||
requestAnimationFrame(function() {
|
||||
document.documentElement.classList.add('page-transition-active');
|
||||
});
|
||||
}
|
||||
function endPageTransition() {
|
||||
document.documentElement.classList.remove('page-transition-active');
|
||||
document.documentElement.classList.remove('page-transition-enter');
|
||||
pjaxContainers.forEach(function(selector) {
|
||||
var c = document.querySelector(selector);
|
||||
if (c) c.classList.remove('page-transition-content');
|
||||
});
|
||||
}
|
||||
|
||||
$.pjax.defaults.timeout = 10000;
|
||||
$.pjax.defaults.container = ['#primary', '#leftbar_part1_menu', '#leftbar_part2_inner', '.page-information-card-container', '#rightbar', '#wpadminbar'];
|
||||
$.pjax.defaults.fragment = ['#primary', '#leftbar_part1_menu', '#leftbar_part2_inner', '.page-information-card-container', '#rightbar', '#wpadminbar'];
|
||||
$.pjax.defaults.container = pjaxContainers;
|
||||
$.pjax.defaults.fragment = pjaxContainers;
|
||||
|
||||
/*
|
||||
* PJAX 事件处理优化说明:
|
||||
@@ -3134,15 +3489,17 @@ $.pjax.defaults.fragment = ['#primary', '#leftbar_part1_menu', '#leftbar_part2_i
|
||||
* - pjax:complete: 需求 1.5, 1.6 (模块初始化和错误隔离)
|
||||
* - pjax:end: 需求 1.7 (特定任务处理)
|
||||
*/
|
||||
$(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):not([download]):not(.reference-link):not(.reference-list-backlink)")
|
||||
if (argonConfig.disable_pjax != true && argonConfig.disable_pjax != 'true') {
|
||||
$(document).pjax(
|
||||
"a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):not([download]):not(.reference-link):not(.reference-list-backlink):not([href^='#'])",
|
||||
pjaxContainers.length ? pjaxContainers[0] : '#primary',
|
||||
{ fragment: (pjaxContainers.length ? pjaxContainers : ['#primary']), timeout: $.pjax.defaults.timeout }
|
||||
)
|
||||
.on('pjax:click', function(e, f, g){
|
||||
if (argonConfig.disable_pjax == true){
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
NProgress.remove();
|
||||
NProgress.start();
|
||||
pjaxLoading = true;
|
||||
PageLoader.show();
|
||||
}).on('pjax:afterGetContainers', function(e, f, g) {
|
||||
pjaxScrollTop = 0;
|
||||
if ($("html").hasClass("banner-as-cover")){
|
||||
@@ -3152,6 +3509,7 @@ $(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):no
|
||||
}
|
||||
}).on('pjax:send', function() {
|
||||
NProgress.set(0.618);
|
||||
startPageTransition();
|
||||
}).on('pjax:beforeReplace', function(e, dom) {
|
||||
// ========== 需求 1.1-1.4: 清理旧页面的所有资源 ==========
|
||||
// 调用统一的资源清理管理器
|
||||
@@ -3175,10 +3533,21 @@ $(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):no
|
||||
// ========== 需求 1.5, 1.6: 重新初始化所有功能模块 ==========
|
||||
pjaxLoading = false;
|
||||
NProgress.inc();
|
||||
startPageTransition();
|
||||
activatePageTransition();
|
||||
setTimeout(function() {
|
||||
PageLoader.hide();
|
||||
endPageTransition();
|
||||
}, 320);
|
||||
|
||||
// ========== 需求 4.1-4.5: 执行新页面中的内联脚本 ==========
|
||||
try {
|
||||
executeInlineScripts(document);
|
||||
pjaxContainers.forEach(function(selector) {
|
||||
var container = document.querySelector(selector);
|
||||
if (container) {
|
||||
executeInlineScripts(container);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
ArgonDebug.error('executeInlineScripts failed:', err);
|
||||
}
|
||||
@@ -3240,6 +3609,10 @@ $(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):no
|
||||
}
|
||||
|
||||
NProgress.done();
|
||||
}).on('pjax:error', function() {
|
||||
PageLoader.hide();
|
||||
endPageTransition();
|
||||
pjaxLoading = false;
|
||||
}).on('pjax:end', function() {
|
||||
// ========== 需求 1.7: 执行特定任务 ==========
|
||||
|
||||
@@ -3255,6 +3628,7 @@ $(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):no
|
||||
// GT4: PJAX 后确保评论页验证码已初始化
|
||||
resetGT4Captcha();
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', function() {
|
||||
handleHashNavigation();
|
||||
@@ -3270,7 +3644,14 @@ if (document.readyState === 'loading') {
|
||||
/*Reference 跳转*/
|
||||
$(document).on("click", ".reference-link , .reference-list-backlink" , function(e){
|
||||
e.preventDefault();
|
||||
$target = $($(this).attr("href"));
|
||||
var href = $(this).attr("href");
|
||||
if (!href || href === "#" ) { return; }
|
||||
var $target;
|
||||
try {
|
||||
$target = $(href);
|
||||
} catch (err) {
|
||||
return;
|
||||
}
|
||||
$("body,html").animate({
|
||||
scrollTop: $target.offset().top - document.body.clientHeight / 2 - 75
|
||||
}, 500, 'easeOutExpo')
|
||||
@@ -3283,7 +3664,7 @@ $(document).on("click", ".reference-link , .reference-list-backlink" , function(
|
||||
}, 1);
|
||||
});
|
||||
|
||||
/*Tags Dialog pjax 加载后自动关闭/
|
||||
/*Tags Dialog pjax 加载后自动关闭 */
|
||||
$(document).on("click" , "#blog_tags .tag" , function(){
|
||||
$("#blog_tags button.close").trigger("click");
|
||||
});
|
||||
@@ -4591,10 +4972,29 @@ void 0;
|
||||
if (progress >= 90) { clearInterval(interval); progress = 90; }
|
||||
bar.style.width = progress + '%';
|
||||
}, 100);
|
||||
var overlay = document.getElementById('article-loading-overlay');
|
||||
if (!overlay) {
|
||||
overlay = document.createElement('div');
|
||||
overlay.id = 'article-loading-overlay';
|
||||
var inner = document.createElement('div');
|
||||
inner.className = 'overlay-content';
|
||||
inner.innerHTML = '<div class="overlay-title"></div><div class="overlay-thumb"></div><div class="overlay-row" style="width:85%"></div><div class="overlay-row" style="width:70%"></div><div class="overlay-row" style="width:90%"></div><div class="overlay-grid"><div class="overlay-grid-item"></div><div class="overlay-grid-item"></div></div><div class="center-spinner"><div class="loading-spinner"></div><div class="overlay-row" style="width:120px;height:14px;margin:0"></div></div>';
|
||||
overlay.appendChild(inner);
|
||||
document.body.appendChild(overlay);
|
||||
}
|
||||
overlay.classList.remove('is-hiding');
|
||||
requestAnimationFrame(function() {
|
||||
overlay.classList.add('is-visible');
|
||||
});
|
||||
window.addEventListener('load', function() {
|
||||
clearInterval(interval);
|
||||
bar.style.width = '100%';
|
||||
setTimeout(function() { bar.style.opacity = '0'; setTimeout(function() { bar.remove(); }, 300); }, 200);
|
||||
if (overlay) {
|
||||
overlay.classList.remove('is-visible');
|
||||
overlay.classList.add('is-hiding');
|
||||
setTimeout(function() { if (overlay && overlay.parentNode) overlay.parentNode.removeChild(overlay); }, 360);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4607,12 +5007,32 @@ void 0;
|
||||
if (!bar) { bar = document.createElement('div'); bar.id = 'page-loading-bar'; document.body.appendChild(bar); }
|
||||
bar.style.opacity = '1'; bar.style.width = '30%';
|
||||
setTimeout(function() { bar.style.width = '60%'; }, 200);
|
||||
var overlay = document.getElementById('article-loading-overlay');
|
||||
if (!overlay) {
|
||||
overlay = document.createElement('div');
|
||||
overlay.id = 'article-loading-overlay';
|
||||
var inner = document.createElement('div');
|
||||
inner.className = 'overlay-content';
|
||||
inner.innerHTML = '<div class="overlay-title"></div><div class="overlay-thumb"></div><div class="overlay-row" style="width:85%"></div><div class="overlay-row" style="width:70%"></div><div class="overlay-row" style="width:90%"></div><div class="overlay-grid"><div class="overlay-grid-item"></div><div class="overlay-grid-item"></div></div><div class="center-spinner"><div class="loading-spinner"></div><div class="overlay-row" style="width:120px;height:14px;margin:0"></div></div>';
|
||||
overlay.appendChild(inner);
|
||||
document.body.appendChild(overlay);
|
||||
}
|
||||
overlay.classList.remove('is-hiding');
|
||||
requestAnimationFrame(function() {
|
||||
overlay.classList.add('is-visible');
|
||||
});
|
||||
});
|
||||
jQuery(document).on('pjax:end', function() {
|
||||
jQuery('#primary').removeClass('pjax-loading');
|
||||
var bar = document.getElementById('page-loading-bar');
|
||||
if (bar) { bar.style.width = '100%'; setTimeout(function() { bar.style.opacity = '0'; setTimeout(function() { bar.remove(); }, 300); }, 200); }
|
||||
setTimeout(function() { initImageLoadAnimation(); initScrollAnimations(); initSmoothScroll(); }, 100);
|
||||
var overlay = document.getElementById('article-loading-overlay');
|
||||
if (overlay) {
|
||||
overlay.classList.remove('is-visible');
|
||||
overlay.classList.add('is-hiding');
|
||||
setTimeout(function() { if (overlay && overlay.parentNode) overlay.parentNode.removeChild(overlay); }, 360);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
3654
doc/argon-theme-training.md
Normal file
3654
doc/argon-theme-training.md
Normal file
File diff suppressed because it is too large
Load Diff
53
header.php
53
header.php
@@ -726,18 +726,33 @@
|
||||
$card_opacity = get_option('argon_post_background_opacity', '0.7');
|
||||
$card_blur = get_option('argon_card_blur', '20');
|
||||
$card_saturate = get_option('argon_card_saturate', '180');
|
||||
$bg_opacity = get_option('argon_page_background_opacity', '1');
|
||||
|
||||
// 顶栏模糊度为卡片模糊度的 60%(12px / 20px = 0.6)
|
||||
$toolbar_blur = round($card_blur * 0.6);
|
||||
|
||||
// 如果透明度为空或为1,使用推荐默认值
|
||||
if ($card_opacity == '' || $card_opacity == '1') {
|
||||
$card_opacity = '0.7';
|
||||
}
|
||||
if ($bg_opacity == '') {
|
||||
$bg_opacity = '1';
|
||||
}
|
||||
?>
|
||||
|
||||
<style id="theme_card_effect_css">
|
||||
:root {
|
||||
--bg-opacity: <?php echo $bg_opacity; ?>;
|
||||
--card-opacity: <?php echo $card_opacity; ?>;
|
||||
--card-blur: <?php echo $card_blur; ?>px;
|
||||
--card-saturate: <?php echo $card_saturate; ?>%;
|
||||
--toolbar-blur: <?php echo $toolbar_blur; ?>px;
|
||||
--page-background-opacity: <?php echo $bg_opacity; ?>;
|
||||
--banner-mask-height: 120px;
|
||||
--banner-mask-opacity-top: 0.25;
|
||||
--banner-mask-opacity-mid: 0.15;
|
||||
--banner-mask-stop-mid: 35%;
|
||||
--banner-title-shadow: 0 5px 15px rgba(0, 0, 0, .2);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1168,11 +1183,7 @@ if ($card_opacity == '' || $card_opacity == '1') {
|
||||
background-size: cover;
|
||||
|
||||
background-repeat: no-repeat;
|
||||
|
||||
opacity: <?php echo (get_option('argon_page_background_opacity') == '' ? '1' : get_option('argon_page_background_opacity')); ?>;
|
||||
|
||||
transition: opacity .5s ease;
|
||||
|
||||
opacity: var(--page-background-opacity);
|
||||
}
|
||||
|
||||
html.darkmode #content:before{
|
||||
@@ -1217,7 +1228,7 @@ if ($card_opacity == '' || $card_opacity == '1') {
|
||||
|
||||
html.darkmode #content:after {
|
||||
|
||||
opacity: <?php echo (get_option('argon_page_background_opacity') == '' ? '1' : get_option('argon_page_background_opacity')); ?>;
|
||||
opacity: var(--page-background-opacity);
|
||||
|
||||
}
|
||||
|
||||
@@ -1246,9 +1257,9 @@ if ($card_opacity == '' || $card_opacity == '1') {
|
||||
.post-navigation.card,
|
||||
.related-posts.card,
|
||||
.card.bg-white {
|
||||
background-color: rgba(255, 255, 255, <?php echo $post_bg_opacity_inline; ?>) !important;
|
||||
backdrop-filter: blur(<?php echo $card_blur_inline; ?>px) saturate(<?php echo $card_saturate_inline; ?>%);
|
||||
-webkit-backdrop-filter: blur(<?php echo $card_blur_inline; ?>px) saturate(<?php echo $card_saturate_inline; ?>%);
|
||||
background-color: rgba(255, 255, 255, var(--card-opacity)) !important;
|
||||
backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
|
||||
-webkit-backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
|
||||
background-clip: padding-box;
|
||||
-webkit-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
@@ -1264,13 +1275,13 @@ if ($card_opacity == '' || $card_opacity == '1') {
|
||||
html.darkmode .post-navigation.card,
|
||||
html.darkmode .related-posts.card,
|
||||
html.darkmode .card.bg-white {
|
||||
background-color: rgba(66, 66, 66, <?php echo $post_bg_opacity_inline; ?>) !important;
|
||||
background-color: rgba(66, 66, 66, var(--card-opacity)) !important;
|
||||
}
|
||||
#leftbar .card,
|
||||
#leftbar_part1,
|
||||
#leftbar_part2 {
|
||||
backdrop-filter: blur(<?php echo $card_blur_inline; ?>px) saturate(<?php echo $card_saturate_inline; ?>%);
|
||||
-webkit-backdrop-filter: blur(<?php echo $card_blur_inline; ?>px) saturate(<?php echo $card_saturate_inline; ?>%);
|
||||
backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
|
||||
-webkit-backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1298,9 +1309,9 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
|
||||
.post-navigation.card,
|
||||
.related-posts.card,
|
||||
.card.bg-white {
|
||||
background-color: rgba(255, 255, 255, <?php echo $post_bg_opacity_standalone; ?>) !important;
|
||||
backdrop-filter: blur(<?php echo $card_blur_standalone; ?>px) saturate(<?php echo $card_saturate_standalone; ?>%);
|
||||
-webkit-backdrop-filter: blur(<?php echo $card_blur_standalone; ?>px) saturate(<?php echo $card_saturate_standalone; ?>%);
|
||||
background-color: rgba(255, 255, 255, var(--card-opacity)) !important;
|
||||
backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
|
||||
-webkit-backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
|
||||
background-clip: padding-box;
|
||||
-webkit-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
@@ -1316,13 +1327,13 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
|
||||
html.darkmode .post-navigation.card,
|
||||
html.darkmode .related-posts.card,
|
||||
html.darkmode .card.bg-white {
|
||||
background-color: rgba(66, 66, 66, <?php echo $post_bg_opacity_standalone; ?>) !important;
|
||||
background-color: rgba(66, 66, 66, var(--card-opacity)) !important;
|
||||
}
|
||||
#leftbar .card,
|
||||
#leftbar_part1,
|
||||
#leftbar_part2 {
|
||||
backdrop-filter: blur(<?php echo $card_blur_standalone; ?>px) saturate(<?php echo $card_saturate_standalone; ?>%);
|
||||
-webkit-backdrop-filter: blur(<?php echo $card_blur_standalone; ?>px) saturate(<?php echo $card_saturate_standalone; ?>%);
|
||||
backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
|
||||
-webkit-backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
|
||||
}
|
||||
</style>
|
||||
<?php endif; ?>
|
||||
@@ -1344,9 +1355,9 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
|
||||
|
||||
top: 0;
|
||||
|
||||
height: 120px;
|
||||
height: var(--banner-mask-height);
|
||||
|
||||
background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.15) 35%, rgba(0,0,0,0) 100%);
|
||||
background: linear-gradient(180deg, rgba(0,0,0,var(--banner-mask-opacity-top)) 0%, rgba(0,0,0,var(--banner-mask-opacity-mid)) var(--banner-mask-stop-mid), rgba(0,0,0,0) 100%);
|
||||
|
||||
display: block;
|
||||
|
||||
@@ -1356,7 +1367,7 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
|
||||
|
||||
.banner-title {
|
||||
|
||||
text-shadow: 0 5px 15px rgba(0, 0, 0, .2);
|
||||
text-shadow: var(--banner-title-shadow);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user