참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다.
- 파이어폭스 / 사파리: Shift 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5 또는 Ctrl-R을 입력 (Mac에서는 ⌘-R)
- 구글 크롬: Ctrl-Shift-R키를 입력 (Mac에서는 ⌘-Shift-R)
- 인터넷 익스플로러 / 엣지: Ctrl 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5를 입력.
- 오페라: Ctrl-F5를 입력.
/* 이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다. */
/**
* Autofocus search input on mobile
* Triggered when MobileFrontend search UI opens
* Improves UX by immediately opening the virtual keyboard
*/
(function () {
function focusSearchInput() {
const input =
document.querySelector('.citizen-search__input') ||
document.querySelector('#searchInput') ||
document.querySelector('input[type="search"]');
if (!input) return false;
// iOS는 visible/enable 상태 아니면 focus 무시하는 경우 많음
input.focus({ preventScroll: true });
// 어떤 iOS 버전/스킨 조합에서는 click이 키보드 트리거에 도움됨
input.click();
return document.activeElement === input;
}
// "유저 제스처"로 인정받기 좋은 이벤트들
const EVENTS = ['touchend', 'pointerup', 'mouseup', 'click'];
EVENTS.forEach((evt) => {
document.addEventListener(
evt,
function (e) {
// 검색 버튼/아이콘 후보들(필요하면 여기 셀렉터만 너 환경에 맞게 좁히면 됨)
const isSearchButton = e.target.closest(
'.citizen-search__button, .mw-ui-icon-search, .search-toggle, a[title="Search"], button[title="Search"]'
);
if (!isSearchButton) return;
// 1) 즉시 시도 (가장 iOS 친화적)
if (focusSearchInput()) return;
// 2) UI가 한 프레임 늦게 뜨면 1~2 프레임 양보
requestAnimationFrame(() => {
if (focusSearchInput()) return;
requestAnimationFrame(() => focusSearchInput());
});
},
true // 캡처링: 스킨/확장이 stopPropagation 해도 이쪽이 먼저 받을 확률 ↑
);
});
})();