feat(navigation): hard-switch to Zibll navigation and Font Awesome 5
This commit is contained in:
1 parent
3c3ddac8be
commit
a0b84977a2
630 files changed
+101647
-11293
No files matched your search
@@ -108,7 +108,7 @@ class HomeModules {
|
||||
* 全屏模块类型(不受侧栏约束)。
|
||||
*/
|
||||
public static function fullbleed_types(): array {
|
||||
return ['hero'];
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,7 +177,7 @@ class HomeModules {
|
||||
|
||||
public static function allowed_types(): array {
|
||||
return [
|
||||
'hero', 'banner', 'category', 'tabs', 'ranking',
|
||||
'banner', 'category', 'tabs', 'ranking',
|
||||
'recent', 'tag_cloud', 'friend_links', 'html', 'hotspot',
|
||||
'category_recommend_cards',
|
||||
// Phase 5: 运营型模块
|
||||
@@ -203,7 +203,6 @@ class HomeModules {
|
||||
|
||||
case 'mixed':
|
||||
return [
|
||||
['type' => 'hero', 'config' => []],
|
||||
['type' => 'recent', 'config' => ['count' => 6, 'layout' => 'card']],
|
||||
['type' => 'category', 'config' => ['count' => 6, 'columns' => 3]],
|
||||
['type' => 'category', 'config' => ['count' => 6, 'columns' => 3]],
|
||||
@@ -212,7 +211,6 @@ class HomeModules {
|
||||
case 'resource_standard':
|
||||
default:
|
||||
return [
|
||||
['type' => 'hero', 'config' => []],
|
||||
['type' => 'tabs', 'config' => ['count' => 8]],
|
||||
['type' => 'recent', 'config' => ['count' => 8, 'layout' => 'card']],
|
||||
['type' => 'ranking', 'config' => ['metric' => 'downloads', 'count' => 6]],
|
||||
|
||||
+1
-24
@@ -34,32 +34,9 @@ class Scripts {
|
||||
add_action('wp_footer', [$this, 'output_custom_footer_codes'], 99);
|
||||
add_action('wp_ajax_aksrt_frontend_debug', [$this, 'handle_frontend_debug']);
|
||||
add_action('wp_ajax_nopriv_aksrt_frontend_debug', [$this, 'handle_frontend_debug']);
|
||||
add_action('wp_ajax_aksrt_search_history', [$this, 'handle_search_history']);
|
||||
add_action('wp_ajax_aksrt_search_suggestions', [$this, 'handle_search_suggestions']);
|
||||
add_action('wp_ajax_nopriv_aksrt_search_suggestions', [$this, 'handle_search_suggestions']);
|
||||
add_filter('body_class', [$this, 'body_classes']);
|
||||
add_filter('wp_resource_hints', [$this, 'resource_hints'], 10, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字体 CDN 的 preconnect 提示(提前 DNS + TLS 握手,加速首屏字体加载)
|
||||
*/
|
||||
public function resource_hints(array $hints, string $relation): array {
|
||||
if ('preconnect' === $relation) {
|
||||
$hints[] = [
|
||||
'href' => 'https://fonts.googleapis.com',
|
||||
'crossorigin',
|
||||
];
|
||||
$hints[] = [
|
||||
'href' => 'https://fonts.gstatic.com',
|
||||
'crossorigin',
|
||||
];
|
||||
$hints[] = [
|
||||
'href' => 'https://cdn.jsdelivr.net',
|
||||
'crossorigin',
|
||||
];
|
||||
}
|
||||
return $hints;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+45
-154
@@ -13,7 +13,19 @@ trait ScriptsPart1b {
|
||||
$base_uri = get_template_directory_uri();
|
||||
$version = AKSRT_VERSION;
|
||||
|
||||
wp_enqueue_script('jquery');
|
||||
$zibll_uri = $base_uri . '/assets/vendor/zibll';
|
||||
$fa5_uri = $base_uri . '/assets/vendor/fontawesome5';
|
||||
|
||||
// Zibll's frontend runtime is the single public dependency stack.
|
||||
wp_deregister_script('jquery');
|
||||
wp_register_script(
|
||||
'jquery',
|
||||
$zibll_uri . '/js/libs/jquery.min.js',
|
||||
[],
|
||||
'1.9.1',
|
||||
false
|
||||
);
|
||||
wp_enqueue_script('jquery');
|
||||
|
||||
wp_enqueue_script(
|
||||
'aksrt-passive-events',
|
||||
@@ -23,22 +35,12 @@ trait ScriptsPart1b {
|
||||
false
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'bootstrap5',
|
||||
'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css',
|
||||
[],
|
||||
'5.3.3'
|
||||
);
|
||||
wp_enqueue_style('_bootstrap', $zibll_uri . '/css/bootstrap.min.css', [], '3.4.1');
|
||||
wp_enqueue_style('_fontawesome', $fa5_uri . '/css/all.min.css', [], '5.15.4');
|
||||
wp_enqueue_style('_main', $zibll_uri . '/css/main.min.css', ['_bootstrap', '_fontawesome'], $version);
|
||||
wp_enqueue_script('bootstrap', $zibll_uri . '/js/libs/bootstrap.min.js', ['jquery'], '3.4.1', true);
|
||||
|
||||
wp_enqueue_script(
|
||||
'bootstrap5',
|
||||
'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js',
|
||||
['jquery'],
|
||||
'5.3.3',
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_style('aksrt-style', get_stylesheet_uri(), ['bootstrap5'], $version);
|
||||
wp_enqueue_style('aksrt-style', get_stylesheet_uri(), ['_main'], $version);
|
||||
$lazy_animation = class_exists('\AKSRT\Settings\Settings')
|
||||
? (string) \AKSRT\Settings\Settings::get_value('lazy_animation', 'blur')
|
||||
: 'blur';
|
||||
@@ -101,41 +103,16 @@ trait ScriptsPart1b {
|
||||
);
|
||||
};
|
||||
|
||||
// 4a. 全站必加 — 优先使用合并文件
|
||||
$frontend_bundle = get_template_directory() . '/assets/css/build/frontend-base.min.css';
|
||||
if (file_exists($frontend_bundle)) {
|
||||
wp_enqueue_style(
|
||||
'aksrt-frontend-bundle',
|
||||
$base_uri . '/assets/css/build/frontend-base.min.css',
|
||||
[$core_dep],
|
||||
filemtime($frontend_bundle) ?: $version
|
||||
);
|
||||
|
||||
// Keep shell-level source overrides live during the refactor.
|
||||
foreach (['base', 'nav', 'footer'] as $shell_slug) {
|
||||
$shell_css_path = get_template_directory() . '/assets/css/frontend/' . $shell_slug . '.css';
|
||||
if (file_exists($shell_css_path)) {
|
||||
wp_enqueue_style(
|
||||
'aksrt-shell-' . $shell_slug,
|
||||
$base_uri . '/assets/css/frontend/' . $shell_slug . '.css',
|
||||
['aksrt-frontend-bundle'],
|
||||
filemtime($shell_css_path) ?: $version
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$enqueue_module('base');
|
||||
$enqueue_module('zibll-compat-vars');
|
||||
$enqueue_module('card-primitives');
|
||||
$enqueue_module('overlay-primitives');
|
||||
$enqueue_module('nav');
|
||||
$enqueue_module('layout');
|
||||
$enqueue_module('footer');
|
||||
$enqueue_module('floating-buttons');
|
||||
$enqueue_module('theme-background');
|
||||
$enqueue_module('menu-decorations');
|
||||
$enqueue_module('enhancements');
|
||||
}
|
||||
// AKSRT domain styles load after Zibll main.css. The old aggregate is
|
||||
// intentionally not used because it contains the removed navigation CSS.
|
||||
$enqueue_module('base');
|
||||
$enqueue_module('card-primitives');
|
||||
$enqueue_module('overlay-primitives');
|
||||
$enqueue_module('layout');
|
||||
$enqueue_module('footer');
|
||||
$enqueue_module('floating-buttons');
|
||||
$enqueue_module('theme-background');
|
||||
$enqueue_module('enhancements');
|
||||
|
||||
// 4a-b. 全局补充样式(骨架屏、空状态、分页、加载指示器)
|
||||
foreach (['skeleton', 'empty-state', 'pagination', 'ajax-spinner', 'modal-runtime'] as $slug) {
|
||||
@@ -150,73 +127,6 @@ trait ScriptsPart1b {
|
||||
}
|
||||
}
|
||||
|
||||
// Header user-box density (check-in / wallet / signout modal)
|
||||
$hub_css = get_template_directory() . '/assets/css/frontend/nav/header-userbox.css';
|
||||
if (file_exists($hub_css)) {
|
||||
wp_enqueue_style(
|
||||
'aksrt-header-userbox',
|
||||
$base_uri . '/assets/css/frontend/nav/header-userbox.css',
|
||||
[$core_dep],
|
||||
(string) filemtime($hub_css)
|
||||
);
|
||||
}
|
||||
$hub_js = get_template_directory() . '/assets/js/header-userbox.js';
|
||||
if (file_exists($hub_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-header-userbox',
|
||||
$base_uri . '/assets/js/header-userbox.js',
|
||||
['aksrt-notyf'],
|
||||
(string) filemtime($hub_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Header multi-function publish/VIP cluster
|
||||
$hmb_css = get_template_directory() . '/assets/css/frontend/nav/header-menu-buttons.css';
|
||||
if (file_exists($hmb_css)) {
|
||||
wp_enqueue_style(
|
||||
'aksrt-header-menu-buttons',
|
||||
$base_uri . '/assets/css/frontend/nav/header-menu-buttons.css',
|
||||
[$core_dep],
|
||||
(string) filemtime($hmb_css)
|
||||
);
|
||||
}
|
||||
|
||||
// Final nav alignment overrides AFTER header-menu-buttons (zibll text/icon baseline).
|
||||
// Re-enqueue shell nav.css last so inline critical rules win the cascade.
|
||||
$nav_css = get_template_directory() . '/assets/css/frontend/nav.css';
|
||||
if (file_exists($nav_css)) {
|
||||
wp_enqueue_style(
|
||||
'aksrt-nav-align',
|
||||
$base_uri . '/assets/css/frontend/nav.css',
|
||||
['aksrt-header-menu-buttons'],
|
||||
(string) filemtime($nav_css)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$inline_search_js = get_template_directory() . '/assets/js/header-inline-search.js';
|
||||
if (file_exists($inline_search_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-header-inline-search',
|
||||
$base_uri . '/assets/js/header-inline-search.js',
|
||||
[],
|
||||
(string) filemtime($inline_search_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
if (file_exists($hmb_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-header-newadd',
|
||||
$base_uri . '/assets/js/header-newadd.js',
|
||||
[],
|
||||
(string) filemtime($hmb_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Shared VIP purchase/poll coordinator for modal and credits surfaces.
|
||||
$vip_on = class_exists('\AKSRT\Settings\Settings')
|
||||
&& !empty(\AKSRT\Settings\Settings::get_payment_vip_settings()['enabled']);
|
||||
@@ -256,7 +166,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-pay-vip',
|
||||
$base_uri . '/assets/js/pay-vip.js',
|
||||
['aksrt-script', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-vip-coordinator', 'aksrt-notyf'],
|
||||
['loader_js', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-vip-coordinator', 'aksrt-notyf'],
|
||||
(string) filemtime($vip_js),
|
||||
true
|
||||
);
|
||||
@@ -325,21 +235,6 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
$enqueue_module('breadcrumb');
|
||||
}
|
||||
|
||||
// 顶部多功能组件:按 page-type 启用结果入队(对齐 zibll,不绑死首页)
|
||||
if (function_exists('aksrt_header_slide_is_show') && aksrt_header_slide_is_show()) {
|
||||
// flex/gutters used by icon cards (same helpers single-post loads via zibll-utilities)
|
||||
$zu_path = get_template_directory() . '/assets/css/frontend/zibll-utilities.css';
|
||||
if (file_exists($zu_path)) {
|
||||
wp_enqueue_style(
|
||||
'aksrt-zibll-utilities',
|
||||
$base_uri . '/assets/css/frontend/zibll-utilities.css',
|
||||
is_string($deps[0] ?? null) ? [$deps[0]] : (array) $deps,
|
||||
filemtime($zu_path) ?: $version
|
||||
);
|
||||
}
|
||||
$enqueue_module('header-components');
|
||||
}
|
||||
|
||||
// 单篇文章:所有 single 相关样式
|
||||
if ($is_single_post) {
|
||||
// Prefer discrete enqueues over CSS @import (cache-bust + parallel load).
|
||||
@@ -433,7 +328,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-author',
|
||||
$base_uri . '/assets/js/author.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($author_js_path),
|
||||
true
|
||||
);
|
||||
@@ -493,7 +388,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-order-center',
|
||||
$base_uri . '/assets/js/order-center.js',
|
||||
['aksrt-script', 'aksrt-rehydrate', 'aksrt-core-request', 'aksrt-core-modal-runtime'],
|
||||
['loader_js', 'aksrt-rehydrate', 'aksrt-core-request', 'aksrt-core-modal-runtime'],
|
||||
(string) filemtime($order_center_js),
|
||||
true
|
||||
);
|
||||
@@ -505,14 +400,14 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-route-user-center-auth',
|
||||
$base_uri . '/assets/js/routes/user-center-auth.js',
|
||||
['aksrt-script', 'aksrt-core-request', 'aksrt-core-modal-runtime'],
|
||||
['loader_js', 'aksrt-core-request', 'aksrt-core-modal-runtime'],
|
||||
(string) filemtime($identity_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
$user_center_deps = file_exists($identity_js)
|
||||
? ['aksrt-script', 'aksrt-route-user-center-auth', 'aksrt-notyf']
|
||||
: ['aksrt-script', 'aksrt-notyf'];
|
||||
? ['loader_js', 'aksrt-route-user-center-auth', 'aksrt-notyf']
|
||||
: ['loader_js', 'aksrt-notyf'];
|
||||
if ($has_orders_panel && wp_script_is('aksrt-order-center', 'registered')) {
|
||||
$user_center_deps[] = 'aksrt-order-center';
|
||||
}
|
||||
@@ -668,7 +563,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-messages',
|
||||
$base_uri . '/assets/js/messages.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($messages_js),
|
||||
true
|
||||
);
|
||||
@@ -678,7 +573,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-conversation',
|
||||
$base_uri . '/assets/js/conversation.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($conversation_js),
|
||||
true
|
||||
);
|
||||
@@ -693,7 +588,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-share-data',
|
||||
$base_uri . '/assets/js/share-data-builder.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($share_data_js),
|
||||
true
|
||||
);
|
||||
@@ -707,7 +602,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-poster-share',
|
||||
$base_uri . '/assets/js/poster-share.js',
|
||||
['aksrt-script', 'aksrt-share-data'],
|
||||
['loader_js', 'aksrt-share-data'],
|
||||
(string) filemtime($poster_js),
|
||||
true
|
||||
);
|
||||
@@ -742,7 +637,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-sign-register',
|
||||
$base_uri . '/assets/js/sign-register.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($sign_js_path),
|
||||
true
|
||||
);
|
||||
@@ -780,7 +675,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-cms-download',
|
||||
$base_uri . '/assets/js/cms-download.js',
|
||||
['aksrt-script', 'aksrt-runtime'],
|
||||
['loader_js', 'aksrt-runtime'],
|
||||
file_exists($cms_download_js_path) ? (string) filemtime($cms_download_js_path) : $version,
|
||||
true
|
||||
);
|
||||
@@ -794,23 +689,19 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
if ($is_cms_home || $is_preview) {
|
||||
$enqueue_module('home-modules');
|
||||
$enqueue_module('post-card'); // 模块内复用
|
||||
$enqueue_module('header-components'); // header components 模块依赖
|
||||
|
||||
wp_enqueue_script(
|
||||
'aksrt-cms-home-modules',
|
||||
$base_uri . '/assets/js/cms-home-modules.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
$version,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if ($is_fixed_homepage) {
|
||||
$enqueue_module('header-components'); // header-slider / hero
|
||||
$enqueue_module('post-card');
|
||||
$homepage_style_deps = file_exists($frontend_bundle)
|
||||
? ['aksrt-frontend-bundle', 'aksrt-header-components', 'aksrt-post-card']
|
||||
: ['aksrt-zibll-compat-vars', 'aksrt-layout', 'aksrt-header-components', 'aksrt-post-card'];
|
||||
$homepage_style_deps = ['_main', 'aksrt-layout', 'aksrt-post-card'];
|
||||
$homepage_style_deps = array_values(array_filter(
|
||||
$homepage_style_deps,
|
||||
static fn(string $handle): bool => wp_style_is($handle, 'registered')
|
||||
@@ -855,7 +746,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-credits',
|
||||
$base_uri . '/assets/js/credits.js',
|
||||
['aksrt-script', 'aksrt-core-modal-runtime', 'aksrt-vip-coordinator', 'aksrt-notyf'],
|
||||
['loader_js', 'aksrt-core-modal-runtime', 'aksrt-vip-coordinator', 'aksrt-notyf'],
|
||||
file_exists($credits_js_path) ? (string) filemtime($credits_js_path) : $version,
|
||||
true
|
||||
);
|
||||
@@ -865,7 +756,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-user-badges',
|
||||
$base_uri . '/assets/js/user-badges.js',
|
||||
['aksrt-script', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-core-modal-triggers'],
|
||||
['loader_js', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-core-modal-triggers'],
|
||||
(string) filemtime($badges_js_path),
|
||||
true
|
||||
);
|
||||
@@ -886,7 +777,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-user-badges',
|
||||
$base_uri . '/assets/js/user-badges.js',
|
||||
['aksrt-script', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-core-modal-triggers'],
|
||||
['loader_js', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-core-modal-triggers'],
|
||||
(string) filemtime($badges_js_path_global),
|
||||
true
|
||||
);
|
||||
|
||||
+89
-181
@@ -20,100 +20,86 @@ trait ScriptsPart1c {
|
||||
* Fonts / FA / global JS stack / aksrtData (split from enqueue_public).
|
||||
*/
|
||||
private function enqueue_public_fonts_js_and_data($base_uri, $core_dep, $deps, $is_fixed_homepage, $is_home_or_archive, $is_single_post, $is_single_resource, $version): void {
|
||||
// ===== 5. 字体 =====
|
||||
// 5a. 拉丁字体 - Inter (UI) + Source Serif 4 (正文)
|
||||
wp_enqueue_style(
|
||||
'aksrt-fonts',
|
||||
'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;0,8..60,700;1,8..60,400&display=swap',
|
||||
[],
|
||||
null
|
||||
);
|
||||
|
||||
// 5b. 中文字体 - jsDelivr CDN (思源黑体 / 思源宋体)
|
||||
// 仅 regular 字重,避免拖慢首屏;其它字重通过 system fallback (PingFang/微软雅黑)
|
||||
// Fontsource v5 已按 unicode-range 自动分包,浏览器只会下载用到的简中子集
|
||||
wp_enqueue_style(
|
||||
'aksrt-fonts-cn',
|
||||
'https://cdn.jsdelivr.net/npm/@fontsource/noto-sans-sc@5.2.9/400.css',
|
||||
[],
|
||||
null
|
||||
);
|
||||
wp_enqueue_style(
|
||||
'aksrt-fonts-cn-serif',
|
||||
'https://cdn.jsdelivr.net/npm/@fontsource/noto-serif-sc@5.2.9/400.css',
|
||||
[],
|
||||
null
|
||||
);
|
||||
|
||||
// ===== 6. 图标系统 =====
|
||||
// Font Awesome 5 全站加载(评论回复、单篇互动栏、profile 联系方式等
|
||||
// 多处模板使用 fa-* 类名,作为全主题图标包统一使用)
|
||||
wp_enqueue_style(
|
||||
'aksrt-font-awesome-5',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css',
|
||||
[],
|
||||
'5.15.4'
|
||||
);
|
||||
// FA4 class aliases (fa-diamond, fa-file-text-o, ...) used by zibll-style markup.
|
||||
wp_enqueue_style(
|
||||
'aksrt-font-awesome-5-v4-shims',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/v4-shims.min.css',
|
||||
['aksrt-font-awesome-5'],
|
||||
'5.15.4'
|
||||
);
|
||||
|
||||
$notyf_css = get_template_directory() . '/assets/css/frontend/notyf.css';
|
||||
wp_enqueue_style(
|
||||
'aksrt-notyf',
|
||||
$base_uri . '/assets/css/frontend/notyf.css',
|
||||
[$core_dep, 'aksrt-font-awesome-5-v4-shims'],
|
||||
file_exists($notyf_css) ? (string) filemtime($notyf_css) : $version
|
||||
);
|
||||
$notyf_css = get_template_directory() . '/assets/css/frontend/notyf.css';
|
||||
wp_enqueue_style(
|
||||
'aksrt-notyf',
|
||||
$base_uri . '/assets/css/frontend/notyf.css',
|
||||
[$core_dep, '_fontawesome'],
|
||||
file_exists($notyf_css) ? (string) filemtime($notyf_css) : $version
|
||||
);
|
||||
|
||||
// ===== 7. JS =====
|
||||
|
||||
// Swiper.js(文章列表媒体及单篇资源页加载)
|
||||
$needs_post_list_media = wp_style_is('aksrt-post-card', 'enqueued');
|
||||
$needs_swiper = $needs_post_list_media || $is_home_or_archive || $is_single_post || $is_single_resource;
|
||||
if ($needs_swiper) {
|
||||
wp_enqueue_style(
|
||||
'aksrt-swiper',
|
||||
$base_uri . '/assets/css/frontend/swiper-bundle.min.css',
|
||||
[],
|
||||
'11.2.10'
|
||||
);
|
||||
wp_enqueue_script(
|
||||
'aksrt-swiper',
|
||||
$base_uri . '/assets/js/swiper-bundle.min.js',
|
||||
[],
|
||||
'11.2.10',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
wp_enqueue_script(
|
||||
'aksrt-qrcode',
|
||||
'https://cdn.jsdelivr.net/npm/kjua@0.9.0/dist/kjua.min.js',
|
||||
[],
|
||||
'0.9.0',
|
||||
true
|
||||
);
|
||||
$zibll_uri = $base_uri . '/assets/vendor/zibll';
|
||||
wp_enqueue_script(
|
||||
'loader_js',
|
||||
$zibll_uri . '/js/loader.js',
|
||||
['jquery', 'bootstrap'],
|
||||
$version,
|
||||
true
|
||||
);
|
||||
wp_localize_script(
|
||||
'loader_js',
|
||||
'_win',
|
||||
[
|
||||
'views' => '',
|
||||
'www' => home_url('/'),
|
||||
'uri' => $zibll_uri,
|
||||
'ver' => $version,
|
||||
'pay_mark' => '¥',
|
||||
'pay_currency_unit' => __('元', 'aksrt'),
|
||||
'imgbox' => false,
|
||||
'imgbox_type' => 'group',
|
||||
'imgbox_thumbs' => false,
|
||||
'imgbox_zoom' => false,
|
||||
'imgbox_full' => false,
|
||||
'imgbox_play' => false,
|
||||
'imgbox_down' => false,
|
||||
'sign_type' => 'page',
|
||||
'signin_url' => wp_login_url(home_url('/' . ltrim((string) ($GLOBALS['wp']->request ?? ''), '/'))),
|
||||
'signup_url' => wp_registration_url(),
|
||||
'ajax_url' => admin_url('admin-ajax.php'),
|
||||
'ajaxpager' => '',
|
||||
'ajax_trigger' => __('加载更多', 'aksrt'),
|
||||
'ajax_nomore' => __('没有更多了', 'aksrt'),
|
||||
'qj_loading' => __('加载中...', 'aksrt'),
|
||||
'highlight_kg' => false,
|
||||
'highlight_hh' => false,
|
||||
'highlight_btn' => false,
|
||||
'highlight_zt' => 'enlighter',
|
||||
'highlight_white_zt' => 'enlighter',
|
||||
'highlight_dark_zt' => 'dracula',
|
||||
'upload_img_size' => 3,
|
||||
'img_upload_multiple' => 6,
|
||||
'upload_video_size' => 30,
|
||||
'upload_file_size' => 30,
|
||||
'upload_ext' => implode('|', array_keys(get_allowed_mime_types())),
|
||||
'user_upload_nonce' => wp_create_nonce('user_upload'),
|
||||
'post_action_nonce' => wp_create_nonce('post_action'),
|
||||
'is_split_upload' => false,
|
||||
'split_minimum_size' => 10,
|
||||
'comment_upload_img' => false,
|
||||
'translate_config' => [],
|
||||
'qrcode_signin' => ['url' => false, 'state' => false],
|
||||
'i18n' => [
|
||||
'load_more' => __('加载更多', 'aksrt'),
|
||||
'processing' => __('处理中...', 'aksrt'),
|
||||
'please_wait' => __('请稍候', 'aksrt'),
|
||||
'done' => __('操作完成', 'aksrt'),
|
||||
'confirm_clear_search' => __('确认清空搜索记录?', 'aksrt'),
|
||||
'search_loading' => __('搜索中...', 'aksrt'),
|
||||
'search_min_chars' => __('至少输入 %s 个字符', 'aksrt'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Zibll lazySizes is the only media lazy-loading runtime.
|
||||
$lazysizes_js = get_template_directory() . '/assets/js/lazysizes.js';
|
||||
wp_enqueue_script(
|
||||
'aksrt-lazysizes',
|
||||
$base_uri . '/assets/js/lazysizes.js',
|
||||
[],
|
||||
file_exists($lazysizes_js) ? (string) filemtime($lazysizes_js) : $version,
|
||||
true
|
||||
);
|
||||
|
||||
// Rehydrate system — must load before aksrt-script so AksrtFrontend is available
|
||||
wp_enqueue_script(
|
||||
'aksrt-rehydrate',
|
||||
$base_uri . '/assets/js/rehydrate.js',
|
||||
['aksrt-lazysizes'],
|
||||
// AKSRT-only modules register after the Zibll loader; navigation is owned by main.min.js.
|
||||
wp_enqueue_script(
|
||||
'aksrt-rehydrate',
|
||||
$base_uri . '/assets/js/rehydrate.js',
|
||||
['loader_js'],
|
||||
file_exists(get_template_directory() . '/assets/js/rehydrate.js')
|
||||
? (string) filemtime(get_template_directory() . '/assets/js/rehydrate.js')
|
||||
: $version,
|
||||
@@ -153,13 +139,7 @@ trait ScriptsPart1c {
|
||||
}
|
||||
|
||||
// Core modules (split from main.js) — register with AksrtFrontend
|
||||
$core_modules = [
|
||||
'aksrt-core-theme' => 'theme.js',
|
||||
'aksrt-core-nav' => 'nav.js',
|
||||
'aksrt-core-search' => 'search.js',
|
||||
'aksrt-core-dropdown' => 'dropdown.js',
|
||||
'aksrt-core-scroll' => 'scroll.js',
|
||||
'aksrt-core-slider' => 'slider.js',
|
||||
$core_modules = [
|
||||
'aksrt-core-article' => 'article.js',
|
||||
'aksrt-core-comments' => 'comments.js',
|
||||
'aksrt-core-comment-fixed' => 'comment-fixed-input.js',
|
||||
@@ -183,9 +163,7 @@ trait ScriptsPart1c {
|
||||
if (file_exists($path)) {
|
||||
// Depend on aksrt-runtime so window.aksrtData (localized below) is available.
|
||||
$deps = ['aksrt-rehydrate', 'aksrt-runtime'];
|
||||
if ($handle === 'aksrt-core-slider') {
|
||||
$deps = array_merge($deps, $needs_swiper ? ['aksrt-swiper'] : []);
|
||||
} elseif ($handle === 'aksrt-core-misc' && $needs_post_list_media) {
|
||||
if ($handle === 'aksrt-core-misc' && $needs_post_list_media) {
|
||||
$deps[] = 'aksrt-grade';
|
||||
} elseif ($handle === 'aksrt-core-modal-runtime') {
|
||||
$deps = array_merge($deps, [
|
||||
@@ -208,54 +186,6 @@ trait ScriptsPart1c {
|
||||
}
|
||||
}
|
||||
|
||||
wp_enqueue_script(
|
||||
'aksrt-script',
|
||||
$base_uri . '/assets/js/main.js',
|
||||
array_merge(
|
||||
['jquery', 'bootstrap5', 'aksrt-rehydrate', 'aksrt-runtime'],
|
||||
$core_handles
|
||||
),
|
||||
file_exists(get_template_directory() . '/assets/js/main.js')
|
||||
? (string) filemtime(get_template_directory() . '/assets/js/main.js')
|
||||
: $version,
|
||||
true
|
||||
);
|
||||
|
||||
// SVG icon data + helper (must load before other scripts that use icons)
|
||||
$svg_icon_js = get_template_directory() . '/assets/js/svg-icon.js';
|
||||
if (file_exists($svg_icon_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-svg-icon',
|
||||
$base_uri . '/assets/js/svg-icon.js',
|
||||
['jquery'],
|
||||
(string) filemtime($svg_icon_js),
|
||||
true // load after <body> exists
|
||||
);
|
||||
}
|
||||
|
||||
$svg_helper_js = get_template_directory() . '/assets/js/svg-icon-helper.js';
|
||||
if (file_exists($svg_helper_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-svg-icon-helper',
|
||||
$base_uri . '/assets/js/svg-icon-helper.js',
|
||||
['aksrt-svg-icon'],
|
||||
(string) filemtime($svg_helper_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Page loading indicator (top progress bar)
|
||||
$loader_js = get_template_directory() . '/assets/js/loader.js';
|
||||
if (file_exists($loader_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-loader',
|
||||
$base_uri . '/assets/js/loader.js',
|
||||
[],
|
||||
(string) filemtime($loader_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Code block enhancements (copy button + language label)
|
||||
$precode_js = get_template_directory() . '/assets/js/precode.js';
|
||||
if (file_exists($precode_js)) {
|
||||
@@ -292,18 +222,6 @@ trait ScriptsPart1c {
|
||||
);
|
||||
}
|
||||
|
||||
// Touch gesture support (swipe, pull-to-dismiss)
|
||||
$mini_touch_js = get_template_directory() . '/assets/js/mini-touch.js';
|
||||
if (file_exists($mini_touch_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-mini-touch',
|
||||
$base_uri . '/assets/js/mini-touch.js',
|
||||
[],
|
||||
(string) filemtime($mini_touch_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Section navs: article TOC / scrollspy
|
||||
$section_navs_js = get_template_directory() . '/assets/js/section-navs.js';
|
||||
if (file_exists($section_navs_js)) {
|
||||
@@ -356,7 +274,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-enhancements',
|
||||
$base_uri . '/assets/js/enhancements.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($enhancements_js),
|
||||
true
|
||||
);
|
||||
@@ -367,7 +285,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-enhancements2',
|
||||
$base_uri . '/assets/js/enhancements2.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($enhancements2_js),
|
||||
true
|
||||
);
|
||||
@@ -379,7 +297,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-reward',
|
||||
$base_uri . '/assets/js/reward.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($reward_js),
|
||||
true
|
||||
);
|
||||
@@ -391,7 +309,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-effects',
|
||||
$base_uri . '/assets/js/effects.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($effects_js),
|
||||
true
|
||||
);
|
||||
@@ -450,7 +368,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-modal-auth',
|
||||
$base_uri . '/assets/js/modal-auth.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($modal_auth_js),
|
||||
true
|
||||
);
|
||||
@@ -462,7 +380,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-homepage-fixed',
|
||||
$base_uri . '/assets/js/homepage-fixed.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
file_exists($homepage_js_path) ? (string) filemtime($homepage_js_path) : $version,
|
||||
true
|
||||
);
|
||||
@@ -476,7 +394,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-comment-tools',
|
||||
$base_uri . '/assets/js/comment-tools.js',
|
||||
['aksrt-script', 'aksrt-core-comment-fixed', 'aksrt-core-comment-move'],
|
||||
['loader_js', 'aksrt-core-comment-fixed', 'aksrt-core-comment-move'],
|
||||
file_exists($comment_tools_path) ? (string) filemtime($comment_tools_path) : $version,
|
||||
true
|
||||
);
|
||||
@@ -499,7 +417,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-comment-ajax',
|
||||
$base_uri . '/assets/js/comment-ajax.js',
|
||||
['aksrt-script', 'aksrt-core-comments'],
|
||||
['loader_js', 'aksrt-core-comments'],
|
||||
(string) filemtime($comment_ajax_path),
|
||||
true
|
||||
);
|
||||
@@ -512,7 +430,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-page-template',
|
||||
$base_uri . '/assets/js/page-template.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($page_template_path),
|
||||
true
|
||||
);
|
||||
@@ -526,7 +444,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-weixin-share',
|
||||
$base_uri . '/assets/js/weixin-share.js',
|
||||
['aksrt-script'],
|
||||
['loader_js'],
|
||||
(string) filemtime($weixin_share_path),
|
||||
true
|
||||
);
|
||||
@@ -537,7 +455,7 @@ trait ScriptsPart1c {
|
||||
wp_enqueue_script(
|
||||
'aksrt-post-share',
|
||||
$base_uri . '/assets/js/post-share.js',
|
||||
['aksrt-script', 'aksrt-weixin-share', 'aksrt-share-data'],
|
||||
['loader_js', 'aksrt-weixin-share', 'aksrt-share-data'],
|
||||
(string) filemtime($post_share_path),
|
||||
true
|
||||
);
|
||||
@@ -557,7 +475,7 @@ trait ScriptsPart1c {
|
||||
// exist before pagination/search/article handlers run.
|
||||
$aksrt_data_handle = wp_script_is('aksrt-runtime', 'registered') || wp_script_is('aksrt-runtime', 'enqueued')
|
||||
? 'aksrt-runtime'
|
||||
: 'aksrt-script';
|
||||
: 'loader_js';
|
||||
wp_localize_script($aksrt_data_handle, 'aksrtData', [
|
||||
'ajaxUrl' => admin_url('admin-ajax.php'),
|
||||
'nonce' => wp_create_nonce('aksrt_public_nonce'),
|
||||
@@ -578,7 +496,7 @@ trait ScriptsPart1c {
|
||||
'homeListSortEnabled' => !class_exists('\AKSRT\Settings\Settings') || \AKSRT\Settings\Settings::home_list_sort_enabled(),
|
||||
'homeListSortDropdown' => class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::home_list_sort_dropdown(),
|
||||
// AJAX 翻页文案
|
||||
'ajaxTrigger' => (class_exists('\AKSRT\Settings\Settings') && ($t = \AKSRT\Settings\Settings::get_post_list_style_settings()['ajax_trigger'] ?? '') !== '') ? $t : '<i class="fa fa-angle-right"></i>加载更多',
|
||||
'ajaxTrigger' => (class_exists('\AKSRT\Settings\Settings') && ($t = \AKSRT\Settings\Settings::get_post_list_style_settings()['ajax_trigger'] ?? '') !== '') ? $t : '<i class="fa fas fa-angle-right"></i>加载更多',
|
||||
'ajaxNomore' => (class_exists('\AKSRT\Settings\Settings') && ($n = \AKSRT\Settings\Settings::get_post_list_style_settings()['ajax_nomore'] ?? '') !== '') ? $n : __('没有更多内容了', 'aksrt'),
|
||||
'ajaxLoading' => __('正在加载...', 'aksrt'),
|
||||
'iasMax' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['ias_max'] : 3,
|
||||
@@ -602,16 +520,6 @@ trait ScriptsPart1c {
|
||||
'stickyPages' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_s'] : ['home', 'cat'],
|
||||
'badgeShow' => class_exists('\AKSRT\Settings\Settings') ? !empty(\AKSRT\Settings\Settings::get_post_list_style_settings()['list_badge_show']) : true,
|
||||
'badgeTypes' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['list_badge_show'] : ['pay', 'tag', 'cat'],
|
||||
'search' => [
|
||||
'mode' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::search_mode() : 'default',
|
||||
'placeholder' => function_exists('aksrt_get_search_placeholder') ? aksrt_get_search_placeholder() : __('开启精彩搜索...', 'aksrt'),
|
||||
'historyEnabled' => function_exists('aksrt_search_history_enabled') ? aksrt_search_history_enabled() : true,
|
||||
'suggestionsEnabled' => function_exists('aksrt_search_suggestions_enabled') ? aksrt_search_suggestions_enabled() : false,
|
||||
'hotKeywords' => function_exists('aksrt_get_search_hot_keywords') ? aksrt_get_search_hot_keywords() : [],
|
||||
'popularTitle' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::search_popular_title() : __('热门搜索', 'aksrt'),
|
||||
'contentTypes' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_search_content_types()['types'] : ['post', 'category', 'tag'],
|
||||
'defaultType' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_search_content_types()['default'] : 'post',
|
||||
],
|
||||
// 用户状态
|
||||
'isLoggedIn' => is_user_logged_in(),
|
||||
'userId' => get_current_user_id(),
|
||||
|
||||
@@ -83,7 +83,7 @@ class Shortcodes {
|
||||
$message = $atts['message'] ?: __('此内容仅 VIP 用户可见', 'aksrt');
|
||||
$html = '<div class="aksrt-hidden-content aksrt-hidden-content--locked aksrt-hidden-content--vip">';
|
||||
$html .= '<div class="aksrt-hidden-content__message">';
|
||||
$html .= '<i class="fas fa-crown" aria-hidden="true"></i> ';
|
||||
$html .= '<i class="fa fas fa-certificate" aria-hidden="true"></i> ';
|
||||
$html .= '<span>' . esc_html($message) . '</span>';
|
||||
$html .= '</div>';
|
||||
if ($uid <= 0) {
|
||||
@@ -133,7 +133,7 @@ class Shortcodes {
|
||||
}
|
||||
|
||||
return '<div class="aksrt-hidden-content aksrt-hidden-content--locked aksrt-hidden-content--payshow">'
|
||||
. '<div class="aksrt-hidden-content__message"><i class="fas fa-lock" aria-hidden="true"></i><span>'
|
||||
. '<div class="aksrt-hidden-content__message"><i class="fa fas fa-lock" aria-hidden="true"></i><span>'
|
||||
. esc_html($message)
|
||||
. '</span></div></div>';
|
||||
}
|
||||
@@ -241,7 +241,7 @@ class Shortcodes {
|
||||
$message = $atts['message'] ?: ($default_msgs[$type] ?? __('此内容已隐藏', 'aksrt'));
|
||||
$html = '<div class="aksrt-hidden-content aksrt-hidden-content--locked aksrt-hidden-content--role">';
|
||||
$html .= '<div class="aksrt-hidden-content__message">';
|
||||
$html .= '<i class="fas fa-eye-slash" aria-hidden="true"></i> ';
|
||||
$html .= '<i class="fa fas fa-eye-slash" aria-hidden="true"></i> ';
|
||||
$html .= '<span>' . esc_html($message) . '</span>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
Reference in new issue
Block a user