사용자:Kwj2772/UserMessages.js

위키백과, 우리 모두의 백과사전.

참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다. 구글 크롬, 파이어폭스, 마이크로소프트 엣지, 사파리: ⇧ Shift 키를 누른 채 "새로 고침" 버튼을 클릭하십시오. 더 자세한 정보를 보려면 위키백과:캐시 무시하기 항목을 참고하십시오.

importScript('사용자:Kwj2772/wiki.js');
var uTemplate = {
    0: '되돌림',
    1: '주의',
    2: '경고',
    3: '삭제 신청 알림',
    4: '중립 알림',
    5: '출처 요구',
    6: '광고 알림',
    7: '독자연구 알림',
    8: '분류 달기 알림',
    9: '기계 번역 알림',
    10: '미리 보기 알림',
    11: '토론 알림',
    12: '서명 달기 알림',
    13: '훼손 알림',
    14: '계정명 변경 권고',
    15: '저작권 침해 알림',
    16: '문서 저작권 불명',
    17: '그림 저작권 불명'
};
var uMessageHeader = {
    0: '되돌림 알림',
    1: '주의',
    2: '경고!',
    3: '삭제 신청 알림',
    4: '중립적 시각',
    5: '출처 필요',
    6: '광고',
    7: '독자 연구',
    8: '분류',
    9: '기계 번역',
    10: '미리 보기',
    11: '토론에서의 예의를 지키세요',
    12: '서명을 해 주세요',
    13: '문서 훼손',
    14: '부적절한 계정명',
    15: '저작권 침해',
    16: null,
    17: '그림 저작권 불명'
};

var UserMessageId = parseInt(getParamValue('usermessage'));
var wpSection = getParamValue('section');
var uMessageParam = getParamValue('param');
function userMessage() {
    if (wgNamespaceNumber == 3 && wpSection == 'new' && typeof (getParamValue('usermessage')) != 'undefined') {
        if (uMessageParam == null) {
            document.editform.wpTextbox1.value = '\{\{subst:' + uTemplate[id] + '\}\} \~\~\~\~'
            document.editform.wpSummary.value = uMessageHeader[id];
        } else {
            document.editform.wpTextbox1.value = '\{\{subst:' + uTemplate[id] + '|'+ decodeURIComponent(uMessageParam) + '}} \~\~\~\~'
            document.editform.wpSummary.value = uMessageHeader[id];
        }
    }
}

// From [[en:Wikipedia:WikiProject User scripts/Scripts/addLink]]
function addLink(where, url1, name1, id, title, key, after, url2, name2)
{
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
    //
    //* url1 is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //
    //* name1 is what will appear as the name of the button.
    //
    //* id is the id of the button; it's best to define one.
    //   Use a prefix to make sure its unique. Optional.
    //
    //* title is the tooltip title that gives a longer description
    //   of the button; if you define a accesskey, mention it here. Optional.
    //
    //* key is the char you want for the accesskey. Optional.
    //
    //* after is the id of the button you want to follow this one. Optional.
    //
    //* url2 is a second url to add. Optional
    //
    //*name2 is the name of the second url; defaults to name1. Optional
    var na = document.createElement('a');
    na.href = url1;
    na.appendChild(document.createTextNode(name1));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
 
    if (url2) { //Another link, brother of the previous.
       var na = document.createElement('a');
       na.href = url2;
       na.appendChild(document.createTextNode(name2 ? name2 : name1));
       li.appendChild(document.createTextNode(" · ")); //separate them a bit
       li.appendChild(na);
    }
 
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];}
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

function template_load () {
    if (wgNamespaceNumber == 3) {
        var usermsg_mark_url = 'http://ko.wikipedia.org/w/index.php?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit&section=new&usermessage=';
        addLink('p-tb', usermsg_mark_url+0+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[0]);
        addLink('p-tb', usermsg_mark_url+1+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[1]);
        addLink('p-tb', usermsg_mark_url+2+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[2]);
        addLink('p-tb', usermsg_mark_url+3+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[3]);
        addLink('p-tb', usermsg_mark_url+4+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[4]);
        addLink('p-tb', usermsg_mark_url+5+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[5]);
        addLink('p-tb', usermsg_mark_url+6+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[6]);
        addLink('p-tb', usermsg_mark_url+7+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[7]);
        addLink('p-tb', usermsg_mark_url+8+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[8]);
        addLink('p-tb', usermsg_mark_url+9+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[9]);
        addLink('p-tb', usermsg_mark_url+10+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[10]);
        addLink('p-tb', usermsg_mark_url+11+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[11]);
        addLink('p-tb', usermsg_mark_url+12+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[12]);
        addLink('p-tb', usermsg_mark_url+13+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[13]);
        addLink('p-tb', usermsg_mark_url+14+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[14]);
        addLink('p-tb', usermsg_mark_url+15+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[15]);
        addLink('p-tb', usermsg_mark_url+16+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[16]);
        addLink('p-tb', usermsg_mark_url+17+'&param='+prompt('틀의 변수를 입력해주세요',''), uTemplate[17]);
    }
}
$(template_load);
$(userMessage);