feat(share): align social sharing runtime
This commit is contained in:
1 parent
26ac8167f3
commit
cf6c11852e
33 files changed
+802
-1919
No files matched your search
@@ -551,34 +551,6 @@ trait ScriptsPart1b {
|
||||
}
|
||||
}
|
||||
|
||||
// Unified share-data builder — only when the article renders share controls.
|
||||
if (!empty($singular_assets['needs_share'])) {
|
||||
$share_data_js = get_template_directory() . '/assets/js/share-data-builder.js';
|
||||
if (file_exists($share_data_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-share-data',
|
||||
$base_uri . '/assets/js/share-data-builder.js',
|
||||
['loader_js'],
|
||||
(string) filemtime($share_data_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Poster generation is part of the article share dropdown.
|
||||
if (!empty($singular_assets['needs_share'])) {
|
||||
$poster_js = get_template_directory() . '/assets/js/poster-share.js';
|
||||
if (file_exists($poster_js)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-poster-share',
|
||||
$base_uri . '/assets/js/poster-share.js',
|
||||
['loader_js', 'aksrt-share-data'],
|
||||
(string) filemtime($poster_js),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Unified authentication page shell.
|
||||
if ($is_auth_page) {
|
||||
$enqueue_module('pages');
|
||||
|
||||
@@ -424,26 +424,16 @@ trait ScriptsPart1c {
|
||||
}
|
||||
}
|
||||
|
||||
// Post/resource share functionality
|
||||
if (!empty($singular_assets['needs_share'])) {
|
||||
$weixin_share_path = get_template_directory() . '/assets/js/weixin-share.js';
|
||||
if (file_exists($weixin_share_path)) {
|
||||
// Reference-theme share runtime: direct platform links need no JS;
|
||||
// only poster generation is loaded when a share surface can render.
|
||||
if (!empty($singular_assets['needs_share']) || is_page_template('templates/pages/page-posts-navs.php')) {
|
||||
$poster_share_path = get_template_directory() . '/assets/js/poster-share.js';
|
||||
if (file_exists($poster_share_path)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-weixin-share',
|
||||
$base_uri . '/assets/js/weixin-share.js',
|
||||
['loader_js'],
|
||||
(string) filemtime($weixin_share_path),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$post_share_path = get_template_directory() . '/assets/js/post-share.js';
|
||||
if (file_exists($post_share_path)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-post-share',
|
||||
$base_uri . '/assets/js/post-share.js',
|
||||
['loader_js', 'aksrt-weixin-share', 'aksrt-share-data'],
|
||||
(string) filemtime($post_share_path),
|
||||
'aksrt-poster-share',
|
||||
$base_uri . '/assets/js/poster-share.js',
|
||||
['loader_js'],
|
||||
(string) filemtime($poster_share_path),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user