Fix blur effect, implement skeleton loading, and add Duolingo JWT friend streak feature
This commit is contained in:
21
sidebar.php
21
sidebar.php
@@ -564,16 +564,17 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
var headIndexInstance = $(document).data('headIndex');
|
||||
|
||||
// 添加额外的滚动监听,确保目录跟随
|
||||
var scrollTimer = null;
|
||||
var scrollTicking = false;
|
||||
$(window).on('scroll.desktopCatalog', function() {
|
||||
if (scrollTimer) {
|
||||
clearTimeout(scrollTimer);
|
||||
if (!scrollTicking) {
|
||||
scrollTicking = true;
|
||||
requestAnimationFrame(function() {
|
||||
if (headIndexInstance && typeof headIndexInstance.updateCurrent === 'function') {
|
||||
headIndexInstance.updateCurrent();
|
||||
}
|
||||
scrollTicking = false;
|
||||
});
|
||||
}
|
||||
scrollTimer = setTimeout(function() {
|
||||
if (headIndexInstance && typeof headIndexInstance.updateCurrent === 'function') {
|
||||
headIndexInstance.updateCurrent();
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// PJAX 后重新绑定
|
||||
@@ -663,8 +664,10 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
$duo_data = argon_get_duolingo_data();
|
||||
if ($duo_data !== false) :
|
||||
$is_today_done = isset($duo_data['today']) && $duo_data['today'];
|
||||
$duo_friend_streak = isset($duo_data['friend_streak']) ? $duo_data['friend_streak'] : '';
|
||||
$tooltip_attr = !empty($duo_friend_streak) ? ' data-toggle="tooltip" data-placement="bottom" title="' . esc_attr(sprintf(__('友情连胜: %s天', 'argon'), $duo_friend_streak)) . '"' : '';
|
||||
?>
|
||||
<span class="duolingo-streak<?php echo $is_today_done ? '' : ' not-done'; ?>">
|
||||
<span class="duolingo-streak<?php echo $is_today_done ? '' : ' not-done'; ?>"<?php echo $tooltip_attr; ?>>
|
||||
<img src="<?php echo get_template_directory_uri(); ?>/assets/icons/duolingo-streak<?php echo $is_today_done ? '' : '-empty'; ?>.svg" class="duolingo-flame" alt="streak">
|
||||
<?php echo $duo_data['streak']; ?>
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user