diff --git a/_layouts/index.html b/_layouts/index.html index ffdee91..cfe2ca9 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -35,7 +35,7 @@

{% fa_svg fas.fa-cube %} 镜像列表

{% unless page.legacy %} - + {% endunless %}
diff --git a/static/js/index.es6 b/static/js/index.es6 index 32d90f9..b3faf7a 100644 --- a/static/js/index.es6 +++ b/static/js/index.es6 @@ -30,6 +30,10 @@ var vmMirList = new Vue({ }, created () { this.refreshMirrorList(); + window.addEventListener("keypress", this.onKeyPress); + }, + beforeDestroy() { + window.removeEventListener("keypress", this.onKeyPress); }, updated () { $('.mirror-item-label').popover(); @@ -76,6 +80,12 @@ var vmMirList = new Vue({ self.rawMirrorList = status_data; setTimeout(() => {self.refreshMirrorList()}, 10000); }); + }, + onKeyPress(event) { + if (event.key === '/' && document.activeElement !== this.$refs.search) { + event.preventDefault(); + this.$refs.search.focus(); + } } } })