mirror of
https://github.com/tuna/mirror-web.git
synced 2025-12-25 20:32:46 +00:00
fix filter
This commit is contained in:
parent
2d7d80c20d
commit
6e7114689a
|
|
@ -44,31 +44,16 @@
|
|||
<script>
|
||||
(function () {
|
||||
'use strict'
|
||||
|
||||
var userInput = document.getElementById('search')
|
||||
var repoList = document.querySelectorAll('.filelist > tbody > tr')
|
||||
|
||||
userInput.addEventListener('input', function (evt) {
|
||||
var pat = new RegExp(userInput.value, 'i')
|
||||
Array.prototype.slice.call(repoList).forEach(function (tr) {
|
||||
var a = tr.querySelector('a')
|
||||
if (!pat.test(a.text)) {
|
||||
tr.classList.add('hidden')
|
||||
} else {
|
||||
tr.classList.remove('hidden')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
document.body.onkeyup = function (evt) {
|
||||
document.body.addEventListener('keyup', function (evt) {
|
||||
if (evt.keyCode === 83 && document.activeElement.tagName !== 'INPUT') {
|
||||
userInput.scrollIntoView()
|
||||
userInput.focus()
|
||||
var userInput = document.getElementById('search');
|
||||
userInput.scrollIntoView();
|
||||
userInput.focus();
|
||||
}
|
||||
}
|
||||
})
|
||||
})()
|
||||
</script>
|
||||
<!-- Designed by Miaomiao Li. It's a wonderful life! -->
|
||||
<!--
|
||||
vim:ai:et:sta:ts=4:sts=4:sw=4
|
||||
-->
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<script src="/static/js/jquery.min.js?{{ site.data['hash'] }}"></script>
|
||||
<script src="/static/js/bootstrap.min.js?{{ site.data['hash'] }}"></script>
|
||||
<script src="/static/js/bootstrap-select.min.js?{{ site.data['hash'] }}"></script>
|
||||
<script src="/static/js/vue.min.js?{{ site.data['hash'] }}"></script>
|
||||
<script src="/static/js/vue.min.js?{{ site.data['hash'] }}"></script>
|
||||
<script src="/static/js/timeago.min.js?{{ site.data['hash'] }}"></script>
|
||||
<script src="/static/js/markup.min.js?{{ site.data['hash'] }}"></script>
|
||||
<script src="/static/js/webfont.js?{{ site.data['hash'] }}"></script>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<div id="filelist">
|
||||
<div>
|
||||
<h3 id="filetitle">文件列表</h3>
|
||||
<input placeholder="按 S 过滤" id="search" type="search" autocomplete="off" />
|
||||
<input placeholder="按 S 过滤" v-model.trim="filter" id="search" type="search" autocomplete="off" />
|
||||
</div>
|
||||
<table class="filelist">
|
||||
<thead>
|
||||
|
|
|
|||
Loading…
Reference in New Issue