"미디어위키:Common.js"의 두 판 사이의 차이
(새 문서: →이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다.: function episodeFilter() { var input, filter, tbody, rows, i, txtValue; input =...) |
(차이 없음)
|
2025년 11월 26일 (수) 16:47 판
/* 이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다. */
function episodeFilter() {
var input, filter, tbody, rows, i, txtValue;
input = document.getElementById("myInput");
if (!input) return;
filter = input.value.toUpperCase();
tbody = document.querySelector(".divTable .tbody");
if (!tbody) return;
rows = tbody.getElementsByClassName("row");
for (i = 0; i < rows.length; i++) {
txtValue = rows[i].textContent || rows[i].innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
rows[i].style.display = "";
} else {
rows[i].style.display = "none";
}
}
}
document.addEventListener("DOMContentLoaded", function () {
var input = document.getElementById("myInput");
if (!input) return;
input.addEventListener("keyup", episodeFilter);
});