미디어위키:Common.js: 두 판 사이의 차이
둘러보기로 이동
검색으로 이동
Resultofunion (토론 | 기여) 편집 요약 없음 |
Resultofunion (토론 | 기여) 편집 요약 없음 |
||
| 1번째 줄: | 1번째 줄: | ||
/ | //window.addEventListener('DOMContentLoaded', function() { | ||
// if (window.location.href.indexOf("action=tinymceedit") > -1) { | |||
// document.querySelector('.wikiEditor-ui-top').style.display = 'none'; | |||
// } | |||
//}); | |||
/* TOP 버튼 */ | /* TOP 버튼 */ | ||
| 23번째 줄: | 27번째 줄: | ||
} | } | ||
}); | }); | ||
/* 대문 섹션 토글 */ | |||
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'); | |||
} | |||
}); | |||
} | |||
} | |||
2022년 1월 13일 (목) 16:36 판
//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');
}
});
}
}