MCPcopy Create free account
hub / github.com/ChinaGodMan/UserScripts / toggleSearch

Function toggleSearch

missav-explorer/missav-explorer.user.js:2310–2322  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2308 //搜索
2309 //---------------
2310 function toggleSearch() {
2311 if (searchButton.textContent === '搜索列表') {
2312 // 如果当前是搜索状态,则进行搜索
2313 const searchTerm = prompt('请输入搜索内容:') // 弹出输入框等待用户输入搜索内容
2314 if (searchTerm !== null) { // 用户点击了确定按钮
2315 filterFiles(searchTerm) // 调用过滤文件函数,传入搜索关键词
2316 searchButton.textContent = '回到列表' // 将搜索按钮文本改为"Back"
2317 }
2318 } else {
2319 // 如果当前是Back状态,则恢复初始文件列表
2320 resetFileList()
2321 }
2322 }
2323
2324 function filterFiles(searchTerm) {
2325 const files = Array.from(fileListContainer.children) // 获取文件列表的所有子元素(文件项)

Callers

nothing calls this directly

Calls 2

filterFilesFunction · 0.85
resetFileListFunction · 0.85

Tested by

no test coverage detected