사용자:Senouis/RPGinCity.js: 두 판 사이의 차이
imported>Senouis 잔글편집 요약 없음 |
imported>Senouis 잔글편집 요약 없음 |
||
25번째 줄: | 25번째 줄: | ||
let MWContent = document.getElementById("mw-content-text"); | let MWContent = document.getElementById("mw-content-text"); | ||
let GotoLink= document.createElement("a"); | let GotoLink= document.createElement("a"); | ||
GotoLink.href = mw.util.getUrl( | GotoLink.href = mw.util.getUrl((JSONDatalist[0].innerText.substring(1, JSONDatalist[0].innerText.length-2))); | ||
console.log(GotoLink.href); | console.log(GotoLink.href); | ||
GotoLink.innerText = "게임 계속하기"; | GotoLink.innerText = "게임 계속하기"; |
2020년 12월 2일 (수) 10:46 판
let usernameStr = mw.user.getName();
let currentpage = mw.config.get("wgPageName");
console.log(currentpage);
function RPGinCity_Title() {
let startbuttondiv = document.getElementById("RPGinCityStart");
if (startbuttondiv !== null){
if (usernameStr === null) {
startbuttondiv.innerHTML = "<p>로그인이 필요합니다</p>";
} else {
let UserDBTitle = new mw.Title("사용자:"+usernameStr+"/RPG in City.json", 2);
if (UserDBTitle.exists === true){
startbuttondiv.innerHTML = "<p><big><a href=\""+mw.util.getUrl(UserDBTitle.toText())+ "\">계속하기</a></big></p>";
} else {
startbuttondiv.innerHTML = "<p><big><a href=\""+mw.util.getUrl(UserDBTitle.toText(),{action: 'edit', preload : '틀:RPG_in_City_DB_양식', summary:'생성'})+ "\">새 데이터 만들기</a></big></p>";
}
}
}
}
function RPGinCity_GoToCheckpoint () {
let JSONDatalist = document.getElementsByClassName("mw-json-value");
if (currentpage === ("사용자:"+usernameStr+"/RPG_in_City.json") && JSONDatalist.length !== 0) {
let MWContent = document.getElementById("mw-content-text");
let GotoLink= document.createElement("a");
GotoLink.href = mw.util.getUrl((JSONDatalist[0].innerText.substring(1, JSONDatalist[0].innerText.length-2)));
console.log(GotoLink.href);
GotoLink.innerText = "게임 계속하기";
MWContent.appendChild(GotoLink);
}
}
RPGinCity_Title();
RPGinCity_GoToCheckpoint();