사용자:하늘/common.js: 두 판 사이의 차이

편집 요약 없음
잔글 (Chirho님이 사용자:Cerulean/common.js 문서를 넘겨주기를 만들지 않고 사용자:하늘/common.js 문서로 이동했습니다: "Cerulean" 사용자의 이름을 "하늘"(으)로 바꿀 때 문서를 자동으로 이동했습니다)
(차이 없음)

2022년 5월 11일 (수) 10:30 판

/*** 다크모드 감지 ***/
/*if (1) {
	var body = document.querySelector('body');
	if ('rgb(0, 0, 0)' == window.getComputedStyle(body).backgroundColor) {

		mw.loader.load('/index.php?title=사용자:Cerulean/liberty-dark.css&action=raw&ctype=text/css', 'text/css');
		body.classList.add('Liberty-dark');
	}
}*/
// EditTools 커스텀
//mw.loader.load('/index.php?title=사용자:Cerulean/EditTools.js&action=raw&ctype=text/javascript');
//mw.loader.load('/index.php?title=사용자:Cerulean/EditTools-custom.js&action=raw&ctype=text/javascript');

// 사용자 문서 상태
mw.loader.load('/index.php?title=사용자:Cerulean/userinfo.js&action=raw&ctype=text/javascript');

// Imagemap 에디터
if (mw.config.get('wgNamespaceNumber') == 6 && mw.config.get('wgAction') == 'view') {
	mw.loader.load('//imagemapedit.toolforge.org/ime.js');
}

//상용구 버튼 추가
mw.loader.load('/index.php?title=사용자:Cerulean/addbutton.js&action=raw&ctype=text/javascript');

//파일 저장 스크립트
//mw.loader.load('/index.php?title=사용자:Cerulean/filesaver.js&action=raw&ctype=text/javascript');

// 로컬 파일 설명 안 보고 바로 공용으로 넘기기(영어 위키백과, 위키데이터에서 퍼옴)
mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-imagelinks.js&action=raw&ctype=text/javascript');

//커스텀 navbar 리버티
mw.loader.load('/index.php?title=사용자:Cerulean/custom-navbar.js&action=raw&ctype=text/javascript');

//한자 사전 툴
mw.loader.load('/index.php?title=사용자:Cerulean/hanja-dict-tools.js&action=raw&ctype=text/javascript');

//개선된 문법 강조
mw.loader.load('/index.php?title=사용자:Cerulean/syntaxhightlight.js&action=raw&ctype=text/javascript');

mw.loader.load('/index.php?title=사용자:Cerulean/addArticleMenuItem.js&action=raw&ctype=text/javascript');
mw.loader.load('/index.php?title=사용자:Cerulean/move_to_series_han_dict.js&action=raw&ctype=text/javascript');
//다른 위키로 변경 사항 저장
//mw.loader.load('/index.php?title=사용자:Cerulean/push.js&action=raw&ctype=text/javascript');

//분류 문서에 편집 링크 추가
document.querySelectorAll('.mw-category-generated a:not(.image, .galleryfilename)').forEach(function (link) {
	var catLinksEdit = document.createElement('a');
	catLinksEdit.title = link.title + ' 편집하기';
	catLinksEdit.href = link.href + '?action=edit';
	catLinksEdit.style.paddingLeft = '0.2em';
	catLinksEdit.innerHTML = '편집';
	// 글자 살짝 작게 표시
	catLinksEdit.style.fontSize = '0.9em';
	// 스타일링을 위해 별도의 클래스 추가
	catLinksEdit.classList.add('fw-edit-link');
	link.after(catLinksEdit);
});

//최근 읽은 기록
mw.loader.load('//librewiki.net/index.php?title=사용자:Cerulean/BreadCrumb.js&action=raw&ctype=text/javascript');

//바로가기 키 추가, 페이지 정보
var pageinfo = document.querySelectorAll('a[href*="action=info"]');
if (pageinfo.length) {
	pageinfo[0].accessKey = 'i';
	pageinfo[0].title += ' [' + pageinfo[0].accessKey + ']';
}

//리버티-타임리스 스킨 전환
mw.loader.load('/index.php?title=사용자:Cerulean/switchskin.js&action=raw&ctype=text/javascript');

mw.loader.load('/index.php?title=사용자:Cerulean/addCopyButtonToCode.js&action=raw&ctype=text/javascript');

//코드 편집기 테마 적용.
mw.hook('codeEditor.configure').add(function () {
	const editarea = document.querySelector('.ace_editor');
	const aceInstance = ace.edit(editarea);
	aceInstance.setOptions({
		wrap: true,
		theme: './theme/tomorrow_night',
		enableLiveAutocompletion: true
	});
});
/*** 폰트 설정 ***/
var UserAgent = navigator.userAgent;
if (UserAgent.match(/iPhone|iPod|Android|Opera Mini|Opera Mobi|IEMobile/) !== null || UserAgent.match(/LG|SAMSUNG|Samsung/) !== null) {
} else {
	console.log('webfont');
	/*** 폰트 설정 ***/
if (window.getComputedStyle(document.querySelector('body')).fontFamily == "Noto Sans KR") {
    if (document.querySelectorAll('[lang="ja"], [lang="zh"], [lang="zh-hk"], [lang="zh-tw"]').length) {
        var link = document.createElement("link");
        link.href = "https://fonts.googleapis.com", link.rel = "preconnect", document.head.append(link);
        link = document.createElement("link");
        link.href = "https://fonts.gstatic.com", link.rel = "preconnect", link.setAttribute("crossorigin", ""), document.head.append(link);
        
        if (document.querySelectorAll('[lang="ja"]').length) {
        	link = document.createElement("link")
            link.href = "https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@100;300;400;500;700;900&display=swap";
            link.rel = "stylesheet";
            document.head.append(link)
        }
        if (document.querySelectorAll('[lang="zh"], [lang="zh-cn"]').length) {
        	link = document.createElement("link")
            link.href = "https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@100;300;400;500;700;900&display=swap";
            link.rel = "stylesheet";
            document.head.append(link)
        }
        if (document.querySelectorAll('[lang="zh-hk"]').length) {
        	link = document.createElement("link")
            link.href = "https://fonts.googleapis.com/css2?family=Noto+Serif+HK:wght@100;300;400;500;700;900&display=swap";
            link.rel = "stylesheet";
            document.head.append(link)
        }
        if (document.querySelectorAll('[lang="zh-tw"]').length) {
        	link = document.createElement("link")
            link.href = "https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@100;300;400;500;700;900&display=swap";
            link.rel = "stylesheet";
            document.head.append(link)
        }
    }
}}