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

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";
+
         link.className="btn btn-secondary tools-btn";
 
item.appendChild(link);
 
item.appendChild(link);
 
tools.appendChild(item);
 
tools.appendChild(item);
 
}
 
}

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

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="btn btn-secondary tools-btn";
	item.appendChild(link);
	tools.appendChild(item);
}