미디어위키:Common.js
참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다.
- 파이어폭스 / 사파리: Shift 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5 또는 Ctrl-R을 입력 (Mac에서는 ⌘-R)
- 구글 크롬: Ctrl-Shift-R키를 입력 (Mac에서는 ⌘-Shift-R)
- 엣지: Ctrl 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5를 입력.
//window.addEventListener('DOMContentLoaded', function() {
// if (window.location.href.indexOf("action=tinymceedit") > -1) {
// document.querySelector('.wikiEditor-ui-top').style.display = 'none';
// }
//});
/* TOP 버튼 */
var topButton = document.createElement('div');
topButton.id="top-button";
document.body.appendChild(topButton);
window.addEventListener('scroll', function(e){
if(window.scrollY > 300){
topButton.classList.add('active');
} else {
topButton.classList.remove('active');
}
});
topButton.addEventListener('click', function(e){
try{
window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth'
});
} catch(e){
window.scrollTo(0, 0);
}
});
/* 대문 섹션 토글 */
if(mw.config.get( 'wgPageName' ) == '대문' || mw.config.get( 'wgPageName' ) == '대문테스트'){
var titles = document.querySelectorAll('.cog-box-title');
for(var i=0; i<titles.length; i++){
titles[i].addEventListener('click', function(e){
if(e.currentTarget.classList.contains('open')){
e.currentTarget.classList.remove('open');
} else {
e.currentTarget.classList.add('open');
}
});
}
}
/*모든 문서 */
if (mw.config.get('wgPageName').toLowerCase() == '미디어위키:commonpages') {
var list = document.querySelectorAll('.mw-allpages-body li');
for (var i = 0; i < list.length; i++) {
var title = list[i].querySelector('a').title;
if (title.indexOf(':') != -1) {
list[i].parentNode.removeChild(list[i]);
}
}
document.querySelector('.cog-commonpages').style.display = '';
}