mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed occasional flickering of dismissed announcement bar
This commit is contained in:
parent
920b9130fb
commit
9b581ae19e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -240,7 +240,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.3e1761d0.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.ce72ebac.min.js' | url }}"></script>
|
||||
{% for path in config.extra_javascript %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -2,23 +2,42 @@
|
||||
This file was automatically generated - do not edit
|
||||
-#}
|
||||
{% macro t(key) %}{{ {
|
||||
"language": "zh-Hant",
|
||||
"language": "zh-TW",
|
||||
"action.edit": "編輯此頁",
|
||||
"action.skip": "跳轉到",
|
||||
"action.view": "查看此頁原始碼",
|
||||
"announce.dismiss": "不再顯示此訊息",
|
||||
"blog.archive": "封存",
|
||||
"blog.categories": "分類",
|
||||
"blog.categories.in": "於",
|
||||
"blog.continue": "繼續閱讀",
|
||||
"blog.draft": "草稿",
|
||||
"blog.index": "回到主頁",
|
||||
"blog.meta": "元數據",
|
||||
"blog.references": "相關連結",
|
||||
"clipboard.copy": "複製",
|
||||
"clipboard.copied": "已複製",
|
||||
"consent.accept": "同意",
|
||||
"consent.manage": "管理設定",
|
||||
"consent.reject": "拒絕",
|
||||
"footer": "頁腳",
|
||||
"footer.next": "下一頁",
|
||||
"footer.previous": "上一頁",
|
||||
"header": "頁首",
|
||||
"meta.comments": "留言",
|
||||
"meta.source": "來源",
|
||||
"nav": "導覽列",
|
||||
"readtime.one": "需要 1 分鐘閱讀時間",
|
||||
"readtime.other": "需要 # 分鐘閱讀時間",
|
||||
"rss.created": "RSS 訂閱",
|
||||
"rss.updated": "RSS 訂閱內容已更新",
|
||||
"search": "搜尋",
|
||||
"search.config.lang": "ja",
|
||||
"search.config.pipeline": "stemmer",
|
||||
"search.config.separator": "[\\s\\- 、。,.?;]+",
|
||||
"search.placeholder": "搜尋",
|
||||
"search.share": "分享",
|
||||
"search.reset": "清除",
|
||||
"search.result.initializer": "正在初始化搜尋引擎",
|
||||
"search.result.placeholder": "打字進行搜尋",
|
||||
"search.result.none": "沒有符合的項目",
|
||||
@ -26,8 +45,14 @@
|
||||
"search.result.other": "找到 # 個符合的項目",
|
||||
"search.result.more.one": "此頁尚有 1 個符合的項目",
|
||||
"search.result.more.other": "此頁尚有 # 個符合的項目",
|
||||
"search.result.term.missing": "缺少字詞",
|
||||
"select.language": "選擇語言",
|
||||
"select.version": "選擇版本",
|
||||
"source": "前往倉庫",
|
||||
"source.file.contributors": "貢獻者",
|
||||
"source.file.date.created": "建立日期",
|
||||
"source.file.date.updated": "最後更新",
|
||||
"toc": "目錄"
|
||||
"tabs": "標籤",
|
||||
"toc": "目錄",
|
||||
"top": "回到頂端"
|
||||
}[key] }}{% endmacro %}
|
||||
|
@ -38,7 +38,7 @@ theme:
|
||||
name: material
|
||||
custom_dir: material/.overrides
|
||||
features:
|
||||
# - announce.dismiss
|
||||
- announce.dismiss
|
||||
- content.action.edit
|
||||
- content.action.view
|
||||
- content.code.annotate
|
||||
|
@ -28,7 +28,6 @@ import {
|
||||
finalize,
|
||||
fromEvent,
|
||||
map,
|
||||
startWith,
|
||||
tap
|
||||
} from "rxjs"
|
||||
|
||||
@ -86,18 +85,12 @@ export function mountAnnounce(
|
||||
/* Mount component on subscription */
|
||||
return defer(() => {
|
||||
const push$ = new Subject<Announce>()
|
||||
push$
|
||||
.pipe(
|
||||
startWith({ hash: __md_get<number>("__announce") })
|
||||
)
|
||||
.subscribe(({ hash }) => {
|
||||
if (hash && hash === (__md_get<number>("__announce") ?? hash)) {
|
||||
el.hidden = true
|
||||
push$.subscribe(({ hash }) => {
|
||||
el.hidden = true
|
||||
|
||||
/* Persist preference in local storage */
|
||||
__md_set<number>("__announce", hash)
|
||||
}
|
||||
})
|
||||
/* Persist preference in local storage */
|
||||
__md_set<number>("__announce", hash)
|
||||
})
|
||||
|
||||
/* Create and return component */
|
||||
return watchAnnounce(el)
|
||||
|
Loading…
Reference in New Issue
Block a user