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

편집 요약 없음
(문서를 비움)
태그: 비우기
 
(사용자 2명의 중간 판 31개는 보이지 않습니다)
1번째 줄: 1번째 줄:
function dropdownItem() {
    this.lastDropDownItem = document.querySelector('.content-tools .dropdown-item:last-child');
    this.AddItem = function ( func ) {
        var toAddItem = this.lastDropDownItem.cloneNode(true);
        toAddItem.href = 'javascript:;';
        toAddItem.innerHTML = '본문으로 이전';
        toAddItem.accessKey = '';
        toAddItem.title = '사용자 문서를 본문으로 이동합니다.';
        toAddItem.onclick = func;
        this.lastDropDownItem.after(toAddItem);
    }
}


new dropdownItem.AddItem( function () {
    wgPageName = mw.config.get('wgPageName');
    mw.notification.autoHideSeconds = { 'short': 2 };
    const to = wgPageName.split('/').pop(); //시리즈:리브레 한자사전/櫻
    new mw.Api().postWithToken('csrf', {
        "action": "move",
        "format": "json",
        "formatversion": "latest",
        "utf8": 1,
        "from": wgPageName,
        "to": to,
        "reason": "시리즈 이전",
        "movetalk": 1,
        "noredirect": 1,
        "movesubpages": 1
    }).done(data => {
        mw.notify('이동 완료!');
        location.href = mw.config.values.wgServer + "/wiki/" + to;
    }).fail(data => {
        mw.notify('이동 실패');
        console.log(data);
    });
})

2024년 1월 6일 (토) 17:33 기준 최신판