미디어위키:Common.js: 두 판 사이의 차이

하나님의 교회 지식사전
둘러보기로 이동 검색으로 이동
편집 요약 없음
편집 요약 없음
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');
			}
		});
	}
}