|
|
| (같은 사용자의 중간 판 111개는 보이지 않습니다) |
| 1번째 줄: |
1번째 줄: |
| //Naver Analytics | | //Naver Analytics |
| var NaverCdn = document.createElement('script'); | | (function () { |
| NaverCdn.src = '//wcs.naver.net/wcslog.js'; | | function loadNaverAnalytics() { |
| document.body.appendChild(NaverCdn); | | var NaverCdn = document.createElement('script'); |
| if (!wcs_add) var wcs_add = {};
| | NaverCdn.src = 'https://wcs.naver.net/wcslog.js'; |
| wcs_add['wa'] = 'ab0e0ecee3c040';
| | NaverCdn.async = true; |
| | document.head.appendChild(NaverCdn); |
|
| |
|
| //Google Analytics
| | window.wcs_add = window.wcs_add || {}; |
| var GoogleCdn = document.createElement('script');
| | window.wcs_add.wa = 'ab0e0ecee3c040'; |
| GoogleCdn.src = 'https://www.googletagmanager.com/gtag/js?id=G-YGT3D2Q9QW';
| | } |
| document.body.appendChild(GoogleCdn);
| |
| window.dataLayer = window.dataLayer || []; | |
| function gtag() {
| |
| dataLayer.push(arguments);
| |
| }
| |
| gtag('js', new Date());
| |
| gtag('config', 'G-YGT3D2Q9QW');
| |
|
| |
|
| /* TOP 버튼 */
| | if (document.readyState === 'loading') { |
| var topButton = document.createElement('div');
| | document.addEventListener('DOMContentLoaded', loadNaverAnalytics); |
| topButton.id = 'top-button';
| | } else { |
| document.body.appendChild(topButton); | | loadNaverAnalytics(); |
| 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);
| |
| }
| |
| });
| |
|
| |
|
| /* 대문 섹션 토글 */ | | /* GA4: single ID + language tagging (MediaWiki 1.42.3) */ |
| if (mw.config.get('wgPageName') == '대문' || mw.config.get('wgPageName') == '대문테스트') {
| | (function () { |
| window.location.href = 'https://churchofgod.wiki/%ED%95%98%EB%82%98%EB%8B%98%EC%9D%98_%EA%B5%90%ED%9A%8C_%EC%A7%80%EC%8B%9D%EC%82%AC%EC%A0%84';
| | // 중복 로드 방지 |
| }
| | if (window.__GA4_LOADED__) return; |
| if (mw.config.get('wgPageName') == '하나님의_교회_지식사전') { | | window.__GA4_LOADED__ = true; |
| var titles = document.querySelectorAll('.cog-box-title');
| | |
| for (var i = 0; i < titles.length; i++) {
| | var GA_ID = 'G-YGT3D2Q9QW'; |
| titles[i].addEventListener('click', function (e) {
| |
| if (e.currentTarget.classList.contains('open')) {
| |
| e.currentTarget.classList.remove('open');
| |
| } else {
| |
| e.currentTarget.classList.add('open');
| |
| }
| |
| });
| |
| }
| |
| }
| |
|
| |
|
| /*모든 문서 */ | | // 언어 결정: 가장 신뢰도 높은 wgContentLanguage, 없으면 경로 프리픽스로 보완 |
| if (mw.config.get('wgPageName').toLowerCase() == '모든_문서_목록') {
| | var pathLang = (location.pathname.split('/')[1] || '').toLowerCase(); |
| var list = document.querySelectorAll('.mw-allpages-body li');
| | var lang = (mw.config && mw.config.get('wgContentLanguage')) |
| for (var i = 0; i < list.length; i++) {
| | || (['en','es','ko','vi','pt','ne'].includes(pathLang) ? pathLang : 'ko'); |
| var title = list[i].querySelector('a').title;
| | // <head>에 gtag 로더 삽입 |
| if (title.indexOf(':') != -1) {
| | var s = document.createElement('script'); |
| list[i].parentNode.removeChild(list[i]);
| | s.async = true; |
| }
| | s.src = 'https://www.googletagmanager.com/gtag/js?id=' + encodeURIComponent(GA_ID); |
| } | | document.head.appendChild(s); |
| document.querySelector('.cog-commonpages').style.display = ''; | | |
| } | | window.dataLayer = window.dataLayer || []; |
| | function gtag(){ dataLayer.push(arguments); } |
| | window.gtag = gtag; |
| | |
| | gtag('js', new Date()); |
| | |
| | // 🔹 자동 page_view 끄기 |
| | gtag('config', GA_ID, { |
| | send_page_view: false, |
| | debug_mode: true |
| | }); |
| | |
| | // 사용자 속성 |
| | gtag('set', 'user_properties', { |
| | site_language: lang, |
| | browser_language: navigator.language || navigator.userLanguage |
| | }); |
| | gtag('event', 'page_view', { |
| | page_location: location.href, |
| | page_path: location.pathname + location.search, |
| | page_title: document.title, |
| | content_group: lang |
| | }); |
| | })(); |
|
| |
|
| /* 각주 팝업창 위치 보정 */
| | mw.loader.load('/resources/assets/common/common.js'); |
| document.body.addEventListener(
| |
| 'DOMNodeInserted',
| |
| function (e) {
| |
| if (e.target.classList && e.target.classList.contains('mwe-popups')) {
| |
| requestAnimationFrame(function () {
| |
| var bodyLeft = document.body.getBoundingClientRect().left;
| |
| var left = parseInt(window.getComputedStyle(e.target).left);
| |
| e.target.style.left = left - bodyLeft + 'px';
| |
| });
| |
| }
| |
| },
| |
| false
| |
| );
| |
| | |
| /* 우클릭 방지 */
| |
| window.oncontextmenu = function (e) {
| |
| return e.preventDefault();
| |
| };
| |
| window.onselectstart = function (e) {
| |
| return e.preventDefault();
| |
| };
| |
| | |
| /* 존재하지 않는 문서 페이지의 '기록' 링크 삭제 */
| |
| if (mw.config.get('wgUserId') == null && document.querySelector('.plainlinks a')) {
| |
| document.querySelector('.plainlinks a').removeAttribute('href');
| |
| document.querySelector('.plainlinks a').classList.add('disable');
| |
| }
| |
| | |
| // 대문 공유 버튼 | |
| var sharebox = document.querySelector('.wikishare_toolbox');
| |
| if (sharebox) {
| |
| sharebox.classList.add('a2a_kit_size_20');
| |
| sharebox.classList.add('a2a_kit');
| |
| var shares = ['Facebook', 'Twitter', 'Email', 'Line', 'Kakao', 'SMS'];
| |
| for (var i in shares) {
| |
| var elem = document.querySelector('[title="Share on ' + shares[i] + '"] a');
| |
| elem.href = '';
| |
| elem.classList.add('a2a_button_' + shares[i].toLowerCase());
| |
| }
| |
| document.querySelector('[title="Share on KakaoTalk"] a').href = '#';
| |
| document.querySelector('[title="Share on KakaoTalk"] a').removeAttribute('target');
| |
| | |
| var share_cdn = document.createElement('script');
| |
| share_cdn.src = 'https://static.addtoany.com/menu/page.js';
| |
| var kakao_cdn = document.createElement('script');
| |
| kakao_cdn.src = 'https://developers.kakao.com/sdk/js/kakao.min.js';
| |
| document.body.appendChild(share_cdn);
| |
| document.body.appendChild(kakao_cdn);
| |
| | |
| // 페이지 로딩 이후 초기화해야할 내용 정의
| |
| initScript();
| |
| function initScript() {
| |
| var retry = false;
| |
| | |
| // 카카오 링크 초기화
| |
| if (window.initKakaoLink != true) {
| |
| var $kakao = document.querySelector('[title="Share on KakaoTalk"]');
| |
| if (window.Kakao && $kakao) {
| |
| // 사용할 앱의 JavaScript 키를 설정해 주세요.
| |
| Kakao.init('5bbf33cb4d93dd3d2100996872cf8e44');
| |
| $kakao.children[0].style.display = 'inline';
| |
| $kakao.onclick = function () {
| |
| // 카카오 Link 공유 API 사용
| |
| Kakao.Link.sendScrap({
| |
| requestUrl: location.href,
| |
| });
| |
| };
| |
| window.initKakaoLink = true;
| |
| } else retry = true;
| |
| }
| |
| | |
| // 링크 복사 초기화
| |
| if (window.initCopyLink != true) {
| |
| var $copy = document.querySelector('.wikishare_button_Copy');
| |
| if ($copy) {
| |
| $copy.style.display = 'inline';
| |
| $copy.addEventListener('click', function (e) {
| |
| copyStringToClipboard(decodeURI(location.href));
| |
| alert('링크를 클립보드에 저장했습니다.');
| |
| e.preventDefault();
| |
| });
| |
| window.initCopyLink = true;
| |
| } else retry = true;
| |
| }
| |
| | |
| // 애널리틱스
| |
| if (window.initWcs != true) {
| |
| if (window.wcs) {
| |
| wcs_do();
| |
| window.initWcs = true;
| |
| } else retry = true;
| |
| }
| |
| | |
| if (retry) setTimeout(initScript, 300);
| |
| }
| |
| }
| |
| | |
| // 문자열을 클립보드에 저장
| |
| function copyStringToClipboard(str) {
| |
| var el = document.createElement('textarea');
| |
| el.value = str;
| |
| el.setAttribute('readonly', '');
| |
| el.style = { position: 'absolute', left: '-9999px' };
| |
| document.body.appendChild(el);
| |
| el.select();
| |
| document.execCommand('copy');
| |
| document.body.removeChild(el);
| |
| }
| |