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

(새 문서: function getRootPageName() { var title = mw.config.get("wgTitle"); return title.split("/")[0]; } var tools = document.querySelector(".content-tools"); var namespace = mw.config.get...)
 
편집 요약 없음
4번째 줄: 4번째 줄:
}
}


var tools = document.querySelector(".content-tools");
var tools = document.querySelector(".btn-group");
var namespace = mw.config.get("wgNamespaceNumber");
var namespace = mw.config.get("wgNamespaceNumber");
if (namespace === 2 || namespace === 3) {
if (namespace === 2 || namespace === 3) {
11번째 줄: 11번째 줄:
link.textContent = "기여";
link.textContent = "기여";
link.href = mw.config.get("wgServer") + mw.config.get("wgArticlePath").replace("$1", "Special:Contributions/" + getRootPageName());
link.href = mw.config.get("wgServer") + mw.config.get("wgArticlePath").replace("$1", "Special:Contributions/" + getRootPageName());
        link.className="new-css-1, new-css-2";
item.appendChild(link);
item.appendChild(link);
tools.appendChild(item);
tools.appendChild(item);
}
}

2016년 5월 14일 (토) 01:06 판

function getRootPageName() {
	var title = mw.config.get("wgTitle");
	return title.split("/")[0];
}

var tools = document.querySelector(".btn-group");
var namespace = mw.config.get("wgNamespaceNumber");
if (namespace === 2 || namespace === 3) {
	var item = document.createElement("li");
	var link = document.createElement("a");
	link.textContent = "기여";
	link.href = mw.config.get("wgServer") + mw.config.get("wgArticlePath").replace("$1", "Special:Contributions/" + getRootPageName());
        link.className="new-css-1, new-css-2";
	item.appendChild(link);
	tools.appendChild(item);
}