<!DOCTYPE html><html lang="zh" data-theme="dark"><head><meta charset="utf-8"><meta name="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><title>谈模仿学习与身份误区 · Cytrogen 的个人博客</title><meta name="description" content="我在网络冲浪时看到了一位网友的求助。他自小就没有被教导如何和人打交道,长大后先是被母亲认定是一个孤僻的人,又被学校的环境误导,以为优秀的道路注定是孤独的、维持人际关系不重要。 这些因素堆叠在一起,当他意识到的时候,自己已经错过了积累社交经验的黄金期。 在此背景下,我真挚地给出了自己的建议:你只是不知道怎么说而已,你可以通过学习他人的对话来补上这个技术缺陷。这却遭到了第三人的反对,他认为这会让当事人丢失自己,不如让当事人以自己的方法来。"><link rel="icon" href="../favicon.png"><link rel="canonical" href="https://cytrogen.icu/posts/9412.html"><link rel="webmention" href="https://webmention.io/cytrogen.icu/webmention"><link rel="me" href="https://m.otter.homes/@Cytrogen"><link rel="me" href="https://github.com/cytrogen"><meta name="fediverse:creator" content="@Cytrogen@m.otter.homes"><link rel="preload" href="../fonts/opensans-regular-latin.woff2" as="font" type="font/woff2" crossorigin="anonymous"><style>@font-face {
font-family: 'Open Sans';
src: url('../fonts/opensans-regular-latin.woff2') format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
size-adjust: 107%;
ascent-override: 97%;
descent-override: 25%;
line-gap-override: 0%;
}
</style><script>(function() {
try {
// 优先级:用户选择 > 系统偏好 > 默认浅色
const saved = localStorage.getItem('theme');
const theme = saved ||
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', theme);
document.documentElement.style.colorScheme = theme;
} catch (error) {
// 失败时使用默认主题,不阻塞渲染
document.documentElement.setAttribute('data-theme', 'light');
}
})();
</script><link rel="stylesheet" href="../css/ares.css"><script data-netlify-skip-bundle="true">(function() {
document.addEventListener('DOMContentLoaded', function() {
const theme = document.documentElement.getAttribute('data-theme');
const pageWrapper = document.getElementById('page-wrapper');
if (pageWrapper && theme) {
pageWrapper.setAttribute('data-theme', theme);
}
});
})();
</script><!-- hexo injector head_end start -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hexo-math@4.0.0/dist/style.css">
<!-- hexo injector head_end end --><meta name="generator" content="Hexo 8.1.1"><link rel="alternate" href="atom.xml" title="Cytrogen 的个人博客" type="application/atom+xml">
</head><body><div id="page-wrapper"><a class="skip-link" href="#main-content">跳到主要内容</a><div class="wrap"><header><a class="logo-link" href="../index.html"><img src="../favicon.png" alt="logo"></a><div class="h-card visually-hidden"><img class="u-photo" src="https://cytrogen.icu/favicon.png" alt="Cytrogen"><a class="p-name u-url u-uid" href="https://cytrogen.icu">Cytrogen</a><p class="p-note">Cytrogen 的个人博客,Cytrogen's Blog</p><a class="u-url" rel="me noopener" target="_blank" href="https://m.otter.homes/@Cytrogen">Mastodon</a><a class="u-url" rel="me noopener" target="_blank" href="https://github.com/cytrogen">GitHub</a></div><nav class="site-nav"><div class="nav-main"><div class="nav-primary"><ul class="nav-list hidden-mobile"><li class="nav-item"><a class="nav-link" href="../index.html">首页</a></li></ul><div class="nav-tools"><div class="language-menu"><button class="language-toggle" type="button"><svg class="icon icon-globe" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" focusable="false"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 0 0 5.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 0 1 .64-1.539 6.7 6.7 0 0 1 .597-.933A7.025 7.025 0 0 0 2.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 0 0-.656 2.5h2.49zM4.847 5a12.5 12.5 0 0 0-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 0 0-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 0 0 .337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 0 1-.597-.933A9.268 9.268 0 0 1 4.09 12H2.255a7.024 7.024 0 0 0 3.072 2.472zM3.82 11a13.652 13.652 0 0 1-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0 0 13.745 12H11.91a9.27 9.27 0 0 1-.64 1.539 6.688 6.688 0 0 1-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855A7.97 7.97 0 0 0 10.855 12H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 0 1-.312 2.5zm2.802-3.5a6.959 6.959 0 0 0-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 0 0-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 0 0-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"></path></svg><span>中文</span></button><div class="language-dropdown"></div></div></div><div class="nav-controls"><div class="more-menu hidden-mobile"><button class="more-toggle" type="button"><span>更多</span><svg class="icon icon-chevron-down" width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true" focusable="false"><path d="M6 8.825c-.2 0-.4-.1-.5-.2l-3.3-3.3c-.3-.3-.3-.8 0-1.1s.8-.3 1.1 0l2.7 2.7 2.7-2.7c.3-.3.8-.3 1.1 0s.3.8 0 1.1l-3.3 3.3c-.1.1-.3.2-.5.2z"></path></svg></button><div class="more-dropdown"><ul class="dropdown-list"><li class="dropdown-item"><a class="nav-link" href="../archives/index.html">归档</a></li><li class="dropdown-item"><a class="nav-link" href="../categories/index.html">分类</a></li><li class="dropdown-item"><a class="nav-link" href="../tags/index.html">标签</a></li><li class="dropdown-item"><a class="nav-link" href="../about/index.html">关于</a></li><li class="dropdown-item"><a class="nav-link" href="../sitemap/index.html">领地地图</a></li></ul></div></div><div class="theme-switcher"><button class="theme-toggle" type="button" role="switch" aria-pressed="false" aria-label="切换主题"><div class="theme-icon moon-icon"><svg class="icon icon-moon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" focusable="false"><path d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"></path></svg></div><div class="theme-icon sun-icon"><svg class="icon icon-sun" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" focusable="false"><path d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"></path></svg></div></button></div><details class="mobile-menu-details hidden-desktop"><summary class="hamburger-menu" aria-label="nav.menu"><svg class="icon icon-bars" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" focusable="false"><path d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"></path></svg><span class="menu-text">nav.menu</span></summary><div class="mobile-menu-dropdown"><ul class="mobile-nav-list"><li class="mobile-nav-item"><a class="mobile-nav-link" href="../index.html">首页</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../archives/index.html">归档</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../categories/index.html">分类</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../tags/index.html">标签</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../about/index.html">关于</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../sitemap/index.html">领地地图</a></li></ul></div></details></div></div></div></nav></header><main class="container" id="main-content" tabindex="-1"><div class="post"><article class="post-block h-entry"><div class="post-meta p-author h-card visually-hidden"><img class="author-avatar u-photo" src="../favicon.png" alt="Cytrogen"><span class="p-name">Cytrogen</span><a class="u-url" href="https://cytrogen.icu">https://cytrogen.icu</a></div><a class="post-permalink u-url u-uid visually-hidden" href="https://cytrogen.icu/posts/9412.html">永久链接</a><div class="p-summary visually-hidden"><p>我在网络冲浪时看到了一位网友的求助。他自小就没有被教导如何和人打交道,长大后先是被母亲认定是一个孤僻的人,又被学校的环境误导,以为优秀的道路注定是孤独的、维持人际关系不重要。</p>
<p>这些因素堆叠在一起,当他意识到的时候,自己已经错过了积累社交经验的黄金期。</p>
<p>在此背景下,我真挚地给出了自己的建议:你只是不知道怎么说而已,你可以通过学习他人的对话来补上这个技术缺陷。这却遭到了第三人的反对,他认为这会让当事人丢失自己,不如让当事人以自己的方法来。</p></div><div class="visually-hidden"><a class="p-category" href="../categories/%E4%B8%AA%E4%BA%BA%E9%9A%8F%E6%83%B3/">个人随想</a><a class="p-category" href="../tags/%E5%BF%83%E7%90%86%E5%AD%A6/">心理学</a><a class="p-category" href="../tags/%E7%A4%BE%E4%BC%9A%E5%AD%A6/">社会学</a></div><a class="u-syndication visually-hidden" target="_blank" rel="noopener" href="https://m.otter.homes/@Cytrogen/115925217613160841">https://m.otter.homes/@Cytrogen/115925217613160841</a><h1 class="post-title p-name">谈模仿学习与身份误区</h1><div class="post-info"><time class="post-date dt-published" datetime="2026-01-16T05:00:00.000Z">1/16/2026</time><time class="dt-updated visually-hidden" datetime="2026-02-19T07:42:07.357Z"></time></div><div class="post-content e-content"><html><head></head><body><p>我在网络冲浪时看到了一位网友的求助。他自小就没有被教导如何和人打交道,长大后先是被母亲认定是一个孤僻的人,又被学校的环境误导,以为优秀的道路注定是孤独的、维持人际关系不重要。</p>
<p>这些因素堆叠在一起,当他意识到的时候,自己已经错过了积累社交经验的黄金期。</p>
<p>在此背景下,我真挚地给出了自己的建议:你只是不知道怎么说而已,你可以通过学习他人的对话来补上这个技术缺陷。这却遭到了第三人的反对,他认为这会让当事人丢失自己,不如让当事人以自己的方法来。</p>
<span id="more"></span>
<hr>
<p>我们常说大学是一个「小社会」,此话不假。对于社交能力的缺失让他开始感到痛苦;他其实很渴望别人能靠近自己,也希望自己能够回应别人的好意。</p>
<p>但因为他从未学习过如何社交,许多本可以拉近别人距离的社交场合都被他无一例外地搞砸。在其他人眼里,他看上去是那么冷漠或者奇怪,但他根本不是那个意思,他只是不知道如何接话。</p>
<p><strong>社交本质上是一套由符号、编码和反馈构成的系统</strong>。这听上去像是把人以计算机来看待,颇有股「只要学了计算机就可以把所有东西用它来解释」的傲慢劲儿。但实际上,这是许多人没有注意到的社交的另一面。</p>
<p>具体而言,对于社交经验匮乏的人们来说,他们面临的挑战通常不是缺乏表达欲,而是将内在意图转化为有效社交信号的能力。如果一个人都无法分辨笑话,那要求对方「做自己」不过是一个伪命题。当事人缺乏表达手段,展示出来的自己往往是 <span class="emphasis">受限且扭曲</span> 的。</p>
<p>社交能力充其量也只是一种技能,数年来人们对其的误解导致了大众对它的敬畏:「我不知道如何回复,这意味着那是我的性格,我只是不愿意和他人交流。」但这很多时候又是不对的,因为人们实际上很渴望与人交流和联系。大家一边承受着孤独,一边却又无动于衷。交流是人类的本能,社交是一种从小人们就要学习的技能。用这个角度来看,我们的「孤独」就可以是被改变的了!</p>
<p>当然,如果你是一个沟通能力没有问题的孤独人,那就是另一码事了…… 未来我会对此发表一些暴论,敬请期待?</p>
<p>社会学家 Erving Goffman 提出过 <u>拟剧论</u>:社会生活分为前台和后台。社交能力和人格无关,人们是可以采取 <u>工具性沟通</u> 的。在这种模式下,社交不再投射自我,更多是为了达成特定的目标的手段。这也不是一个应当被批评的行为,很多时候人们会下意识采用工具性沟通来适配社会规则,和「背叛自我」没有半毛钱关系。</p>
<p>回到我的观点。既然社交能力是一种技能,就和画画、编程一样,那么要如何学会它呢?在我看来,许多东西都需要经历这样的一套流程: <strong>模仿-内化-创新</strong>。孩童学习一件事情几乎就是依赖着「模仿」和「重复」,他们会模仿自己看到的所有人,然后不停地重复。这也是为什么长时间陪伴孩子的那个人在孩子的成长里是最重要的,通常来说这个人是父母。至于重复,只要你带过小孩子,就会知道他们有多么热衷于只做一件事情、只看一个电视频道……</p>
<p>一个画家必须先通过大量临摹来掌握透视、色彩和线条等技术手段,才能最终创作出具有个人风格的作品;如果画家拒绝学习技术,其画作呈现出的笨拙并非「真我」,仅仅只是「无能」。既然孩童是通过模仿他人才学会的社交,那错过了这一时期的人们也必须得让自己再次变成孩子。</p>
<p>认知科学认为,社交能力并非由抽象的理论构成,而是由无数个具体的「条件-反应」链条组成。当能力达到一定程度,个体自然会从「完全模仿」过渡到「选择性采纳」,最终形成带有个人色彩的社交风格。只有当社交动作不再占据一个人的全部认知资源时,他才有余力将真实的自己注入到谈话中。</p>
<p>值得注意的是,模仿他人说话与保持自我从来都不是此消彼长的关系,这也是为什么我十分排斥第三人的回复。他错将当事人的技能缺失认为是他的真实一面,完全无视了他对此的烦恼和痛苦,轻飘飘地反驳了我的建设性建议,要求当事人继续「当自己」—— 当事人的「自己」到底是什么?我认为肯定不是因为不知道该说什么、而被同学们误以为高冷的那个他。要知道,社交中的「自我」是动态构建的,而非静态存在的。</p>
<p>总之, <strong>强大的社交能力反而意味着我们可以更好地表达出自己</strong>。这是一个反直觉的概念:我们模仿他人是为了展现出完全、真实的自己。但是事情就是如此运转的。</p>
<p>缺乏社交技巧的人往往因为无法融入群体而感到自卑,这种负面情绪反而会极大地侵蚀自我的独特性。通过学习社交技巧,个体如果能获得更顺畅的社交反馈,反而可能建立起更强的自信,从而更有能力在公共场合展示出真实的自我。</p>
<p><strong>技能缺陷从来都不是一种性格选择</strong>。我认为现在的社会经常将这两点搞混 —— 不,你不是 <em>自闭症、抑郁症、ADHD</em>…… 你只是不会「社交」这个能力而已。自然,我不是说所有自闭症、抑郁症、ADHD 等患者都是如此,这只是夸张式表达而已。</p>
<p>更进一步说,当事人被母亲贴上了「孤僻」的标签,并被误导认为优秀的人不需要人际关系。这些事情对于一个还未稳定的个体而言,是一瓶瓶毒药。我会这么评价,是因为我也经历过同样的事情。我很高兴我身边有一位讲话十分直白的人,教会了我许多过去从未被教导过的社交礼仪。这也让我愈发对自己的父母感到不满,他们为了自己,数次伤害还是孩童的我,最终将我的惨状视为笑柄。</p>
<p>自然,第三人的考量不是并无道理。个体为了融入社交环境,可能会刻意压抑本能反应、模仿他人的行为。只是放在当事人的案例里,这只是 <span class="emphasis">廉价且无效</span> 的安慰,还回避了当事人正在经历的认知困境和技术门槛。这其实让我想起了另一个现象:只看简单的一段,然后只以事情的一面来发表意见或者建议,最终得出的结果牛头不对马嘴。事情是多面性的,你怎么可以因为我说了「模仿」,所以认定我的建议必定会让当事人压抑自我呢?</p>
<p>:PROPERTIES:<br>
:CAPTURED: [2026-01-16 Fri 12:52]<br>
:END:</p>
</body></html></div></article></div></main><footer><div class="paginator"><a class="prev" href="53f4.html">上一篇</a><a class="next" href="4420.html">下一篇</a></div><!-- Webmention 显示区域--><div class="webmention-section webmention-empty" data-page-url="posts/9412.html" data-full-url="https://cytrogen.icu/posts/9412.html" data-mode="static">
<h3 class="webmention-title">Webmentions (<span class="webmention-count">0</span>)</h3>
<div class="webmention-list"></div>
<span>暂无 Webmentions</span>
</div><div class="copyright"><p class="footer-links"><a href="../friends/index.html">友链</a><span class="footer-separator"> ·</span><a href="../links/index.html">邻邦</a><span class="footer-separator"> ·</span><a href="../contact/index.html">联络</a><span class="footer-separator"> ·</span><a href="../colophon/index.html">营造记</a><span class="footer-separator"> ·</span><a href="../atom.xml">RSS订阅</a></p><p>© 2025 - 2026 <a href="https://cytrogen.icu">Cytrogen</a>, powered by <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/cytrogen/hexo-theme-ares" target="_blank">hexo-theme-ares</a>.</p><p><a href="https://blogscn.fun" target="_blank" rel="noopener">BLOGS·CN</a></p></div></footer></div></div><a class="back-to-top" href="#top" aria-label="返回顶部"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path d="M3.293 9.707a1 1 0 010-1.414L9.586 2a2 2 0 012.828 0l6.293 6.293a1 1 0 01-1.414 1.414L11 3.414V17a1 1 0 11-2 0V3.414L2.707 9.707a1 1 0 01-1.414 0z"></path></svg></a><script>document.addEventListener('DOMContentLoaded', function() {
const codeBlocks = document.querySelectorAll('figure.highlight');
codeBlocks.forEach(block => {
let caption = block.querySelector('figcaption');
if (!caption) {
caption = document.createElement('figcaption');
block.insertBefore(caption, block.firstChild);
}
const info = document.createElement('div');
info.className = 'info';
const filename = caption.querySelector('span');
if (filename) {
filename.className = 'filename';
info.appendChild(filename);
}
const lang = block.className.split(' ')[1];
if (lang) {
const langSpan = document.createElement('span');
langSpan.className = 'lang-name';
langSpan.textContent = lang;
info.appendChild(langSpan);
}
const sourceLink = caption.querySelector('a');
if (sourceLink) {
sourceLink.className = 'source-link';
info.appendChild(sourceLink);
}
const actions = document.createElement('div');
actions.className = 'actions';
const codeHeight = block.scrollHeight;
const threshold = 300;
if (codeHeight > threshold) {
block.classList.add('folded');
const toggleBtn = document.createElement('button');
toggleBtn.textContent = '展开';
toggleBtn.addEventListener('click', () => {
block.classList.toggle('folded');
toggleBtn.textContent = block.classList.contains('folded') ? '展开' : '折叠';
});
actions.appendChild(toggleBtn);
}
const copyBtn = document.createElement('button');
copyBtn.textContent = '复制';
copyBtn.addEventListener('click', async () => {
const codeLines = block.querySelectorAll('.code .line');
const code = Array.from(codeLines)
.map(line => line.textContent)
.join('\n')
.replace(/\n\n/g, '\n');
try {
await navigator.clipboard.writeText(code);
copyBtn.textContent = '已复制';
copyBtn.classList.add('copied');
setTimeout(() => {
copyBtn.textContent = '复制';
copyBtn.classList.remove('copied');
}, 3000);
} catch (err) {
console.error('复制失败:', err);
copyBtn.textContent = '复制失败';
setTimeout(() => {
copyBtn.textContent = '复制';
}, 3000);
}
});
actions.appendChild(copyBtn);
caption.innerHTML = '';
caption.appendChild(info);
caption.appendChild(actions);
const markedLines = block.getAttribute('data-marked-lines');
if (markedLines) {
const lines = markedLines.split(',');
lines.forEach(range => {
if (range.includes('-')) {
const [start, end] = range.split('-').map(Number);
for (let i = start; i <= end; i++) {
const line = block.querySelector(`.line-${i}`);
if (line) line.classList.add('marked');
}
} else {
const line = block.querySelector(`.line-${range}`);
if (line) line.classList.add('marked');
}
});
}
});
});</script><script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" id="MathJax-script"></script><script>(function() {
document.addEventListener('DOMContentLoaded', function() {
const themeToggle = document.querySelector('.theme-toggle');
if (!themeToggle) return;
const getCurrentTheme = () => {
return document.documentElement.getAttribute('data-theme') || 'light';
};
const updateUI = (theme) => {
const isDark = theme === 'dark';
themeToggle.setAttribute('aria-pressed', isDark.toString());
};
const setTheme = (theme) => {
document.documentElement.setAttribute('data-theme', theme);
document.documentElement.style.colorScheme = theme;
const pageWrapper = document.getElementById('page-wrapper');
if (pageWrapper) {
pageWrapper.setAttribute('data-theme', theme);
}
// Find and remove the temporary anti-flicker style tag if it exists.
// This ensures the main stylesheet takes full control after the initial load.
const antiFlickerStyle = document.getElementById('anti-flicker-style');
if (antiFlickerStyle) {
antiFlickerStyle.remove();
}
localStorage.setItem('theme', theme);
updateUI(theme);
};
const toggleTheme = () => {
const current = getCurrentTheme();
const newTheme = current === 'light' ? 'dark' : 'light';
setTheme(newTheme);
};
updateUI(getCurrentTheme());
themeToggle.addEventListener('click', toggleTheme);
if (window.matchMedia) {
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
mediaQuery.addEventListener('change', function(e) {
if (!localStorage.getItem('theme')) {
const theme = e.matches ? 'dark' : 'light';
setTheme(theme);
}
});
}
});
})();
</script><script src="../js/details-toggle.js" defer></script><script>(function() {
document.addEventListener('DOMContentLoaded', function() {
const backToTopBtn = document.querySelector('.back-to-top');
if (!backToTopBtn) return;
const toggleButtonVisibility = () => {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
const shouldShow = scrollTop > 200;
if (shouldShow) {
backToTopBtn.classList.add('is-visible');
} else {
backToTopBtn.classList.remove('is-visible');
}
};
let ticking = false;
const handleScroll = () => {
if (!ticking) {
requestAnimationFrame(() => {
toggleButtonVisibility();
ticking = false;
});
ticking = true;
}
};
const scrollToTop = (event) => {
event.preventDefault();
window.scrollTo({
top: 0,
behavior: 'smooth'
});
};
window.addEventListener('scroll', handleScroll);
backToTopBtn.addEventListener('click', scrollToTop);
toggleButtonVisibility();
});
})();</script></body></html>