小优化
This commit is contained in:
@@ -315,24 +315,15 @@ trait ScriptsPart1b {
|
||||
);
|
||||
}
|
||||
|
||||
// 关注脚本
|
||||
$follow_js_path = get_template_directory() . '/assets/js/follow.js';
|
||||
if (file_exists($follow_js_path)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-follow',
|
||||
$base_uri . '/assets/js/follow.js',
|
||||
['aksrt-notyf'],
|
||||
filemtime($follow_js_path) ?: $version,
|
||||
true
|
||||
);
|
||||
}
|
||||
// 关注脚本已在全局栈注册(ScriptsPart1c),data-aksrt-follow 按钮
|
||||
// 也渲染于文章页作者栏与各处用户卡片,不能仅限本路由加载。
|
||||
|
||||
$author_js_path = get_template_directory() . '/assets/js/author.js';
|
||||
if (file_exists($author_js_path)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-author',
|
||||
$base_uri . '/assets/js/author.js',
|
||||
['loader_js'],
|
||||
['loader_js', 'aksrt-notyf'],
|
||||
(string) filemtime($author_js_path),
|
||||
true
|
||||
);
|
||||
|
||||
@@ -164,6 +164,21 @@ trait ScriptsPart1c {
|
||||
);
|
||||
}
|
||||
|
||||
// Follow toggle: delegated [data-aksrt-follow] handler; the buttons render on
|
||||
// user home / user center / single author bar and user cards anywhere.
|
||||
// Depends on aksrt-runtime because aksrtData (REST root + nonce) is localized
|
||||
// onto that handle and follow.js reads it at parse time.
|
||||
$follow_js = get_template_directory() . '/assets/js/follow.js';
|
||||
if (file_exists($follow_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-follow',
|
||||
$base_uri . '/assets/js/follow.js',
|
||||
['aksrt-notyf', 'aksrt-runtime'],
|
||||
(string) filemtime($follow_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Core modules (split from main.js) — register with AksrtFrontend
|
||||
$core_modules = [
|
||||
'aksrt-core-article' => 'article.js',
|
||||
|
||||
Reference in New Issue
Block a user