대문: 두 판 사이의 차이
보이기
편집 요약 없음 |
편집 요약 없음 |
||
| 2번째 줄: | 2번째 줄: | ||
<form id="radioSearch" action="/wiki/index.php/Special:Search" method="get"> | <form id="radioSearch" action="/wiki/index.php/Special:Search" method="get"> | ||
<!-- 검색 범위 | <!-- 검색 범위 --> | ||
<div style="margin-bottom:6px;"> | <div style="margin-bottom:6px;"> | ||
<label> | <label> | ||
| 20번째 줄: | 20번째 줄: | ||
</div> | </div> | ||
<!-- | <!-- 사용자 입력용 (항상 깨끗) --> | ||
<input | <input | ||
type="search" | type="search" | ||
id="query" | id="query" | ||
placeholder="검색어 입력" | placeholder="검색어 입력" | ||
style="width:360px; padding:6px;" | style="width:360px; padding:6px;" | ||
/> | /> | ||
<!-- 실제 검색에 전달되는 값 --> | |||
<input type="hidden" name="search" id="searchValue" /> | |||
<button type="submit">검색</button> | <button type="submit">검색</button> | ||
| 34번째 줄: | 36번째 줄: | ||
<script> | <script> | ||
document.getElementById('radioSearch').onsubmit = function () { | document.getElementById('radioSearch').onsubmit = function () { | ||
const | const raw = document.getElementById('query').value.trim(); | ||
const scope = document.querySelector('input[name="scope"]:checked').value; | const scope = document.querySelector('input[name="scope"]:checked').value; | ||
const target = document.getElementById('searchValue'); | |||
let q = raw; | |||
if (scope === 'site') { | if (scope === 'site') { | ||
q | q += ' incategory:유적'; | ||
} else if (scope === 'concept') { | } else if (scope === 'concept') { | ||
q | q += ' incategory:개념'; | ||
} | } | ||
target.value = q; | |||
}; | }; | ||
</script> | </script> | ||


