미디어위키:RefToolbarLocal.js

참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다.

  • 파이어폭스 / 사파리: Shift 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5 또는 Ctrl-R을 입력 (Mac에서는 ⌘-R)
  • 구글 크롬: Ctrl-Shift-R키를 입력 (Mac에서는 ⌘-Shift-R)
  • 인터넷 익스플로러 / 엣지: Ctrl 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5를 입력.
  • 오페라: Ctrl-F5를 입력.
/* Sitewide options for the the Cite toolbar button:
* All options should be specified
*
* "date format" sets the date format used for the function to insert the current date
* Current available options:
* date - the day of the month
* zdate - day of the month, zero padded to 2 digits
* monthname - The month name
* month - The numberic month (1-12)
* zmonth - numeric month, zero padded to 2 digits
* year - The full year (4 digits)
*
* "autodate fields" is a list of template fields that should have a button to insert the current date
* 
* "months" is a list of localized month names
*
* "modal" - if true, the dialogs will be modal windows, blocking access to the rest of the window.
* See //en.wikipedia.org/wiki/Modal_window
* All dialogs in the toolbar are modal by default
*
* "autoparse" - if true, previewing a ref will automatically trigger a preview of the parsed wikitext.
* Its not recommended to set this to true as a global setting as it may slow the script down for people
* with slow connections
*
* "expandtemplates" - if true, templates and parser functions will be expanded when getting page text
* (templates inside of ref tags will not be expanded). This will allow references inside of templates or
* references using {{#tag:ref}} to be listed in the named refs dialog and searched by error checks.
* This may slow loading the named refs and error check dialogs.
*/

CiteTB.Options = {
"date format" : "<year>-<zmonth>-<zdate>",
"autodate fields" : ['확인날짜'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};

// Cite template definitions
new citeTemplate('웹 인용', '웹',
[ // Basic fields
{"field": "성", "autofillprop":"last1"},
{"field": "이름", "autofillprop":"first1"}, 
{"field": "제목", "autofillprop":"title"},
{"field": "url", "label":"URL"},
{"field": "작품명", "tooltip": "cite-work-tooltip", "autofillprop":"journal"},
{"field": "출판사"},
{"field": "확인날짜"}
],
[ // Expanded fields
{"field": "저자"},
{"field": "저자고리", "tooltip":"cite-authorlink-tooltip"},
{"field": "공저자", "autofillprop":"coauthors"},
{"field": "보존url"},
{"field": "보존날짜"},
{"field": "쪽", "autofillprop":"pages"},
{"field": "언어"},
{"field": "형식"},
{"field": "doi", "label":"DOI", "autofillid":"doi"},
{"field": "날짜", "autofillprop":"date"},
{"field": "월"},
{"field": "연도"},
{"field": "인용문"}
]);

new citeTemplate('뉴스 인용', '뉴스',
[ // Basic fields
{"field": "성"},
{"field": "이름"}, 
{"field": "제목"},
{"field": "url", "label":"URL"},
{"field": "확인날짜"},
{"field": "출판사"},
{"field": "날짜"}
],
[ // Expanded fields
{"field": "저자"},
{"field": "공저자"},
{"field": "저자고리", "tooltip":"cite-authorlink-tooltip"},
{"field": "보존url"},
{"field": "보존날짜"},
{"field": "쪽"},
{"field": "여러쪽"},
{"field": "언어"},
{"field": "형식"},
{"field": "doi", "label":"DOI"},
{"field": "월"},
{"field": "연도"},
{"field": "인용문"}
]);

new citeTemplate('서적 인용', '서적',
[ // Basic fields
{"field": "성", "autofillprop":"last1"},
{"field": "이름", "autofillprop":"first1"}, 
{"field": "제목", "autofillprop":"title"},
{"field": "연도", "autofillprop":"year"},
{"field": "출판사", "autofillprop":"publisher"},
{"field": "위치", "autofillprop":"location"},
{"field": "isbn", "label": "ISBN", "autofillid":"isbn"},
{"field": "쪽"},
{"field": "url", "label":"URL"}
],
[ // Expanded fields
{"field": "저자"},
{"field": "판", "autofillprop":"edition"},
{"field": "저자고리", "tooltip":"cite-authorlink-tooltip"},
{"field": "공저자", "autofillprop":"coauthors"},
{"field": "초판연도"},
{"field": "편집자"},
{"field": "확인날짜"},
{"field": "보존url"},
{"field": "보존날짜"},
{"field": "언어"},
{"field": "형식"},
{"field": "장"},
{"field": "날짜"},
{"field": "월"},
{"field": "인용문"}
]);

new citeTemplate('저널 인용', '저널',
[ // Basic fields
{"field": "성", "autofillprop":"last1"},
{"field": "이름", "autofillprop":"first1"},
{"field": "저자"},
{"field": "저자고리"},
{"field": "공저자", "autofillprop":"coauthors"},
{"field": "제목", "autofillprop":"title"},
{"field": "저널", "autofillprop":"journal"},
{"field": "날짜", "autofillprop":"date"},

{"field": "권", "autofillprop":"volume"},
{"field": "호", "autofillprop":"issue"},
{"field": "쪽", "autofillprop":"pages"},
{"field": "doi", "label":"DOI", "autofillid":"doi"},
{"field": "pmid", "label":"PMID", "autofillid":"pmid"},
{"field": "url", "label":"URL"},
{"field": "확인날짜"}
],
[ // Expanded fields
{"field": "연도"},
{"field": "계절"},
{"field": "월"},
{"field": "출판사"},
{"field": "위치"},
{"field": "언어"},
{"field": "형식"},
{"field": "issn", "label":"ISSN"},
{"field": "인용문"},
]);

new citeErrorCheck({'type':'reflist', 'testname':'samecontent', 'desc': "내용이 서로 같은 주석 검사",
'func': function(reflist) {
  var errors = [];
  var refs2 = [];
  for(var i=0; i<reflist.length; i++) {
    if (!reflist[i].shorttag) {
      if ($.inArray(reflist[i].content, refs2) != -1) {
        if ($.inArray(reflist[i].content, errors) == -1) {
          errors.push(reflist[i].content);
        }
      } else {
        refs2.push(reflist[i].content);
      }
    }
  }
  ret = [];
  for(var j=0; j<errors.length; j++) {
    ret.push({'msg':'여러 개의 주석이 내용이 같을 경우', 'err':errors[j]});
  }
  return ret;
}}
);
 
new citeErrorCheck({'type':'reflist', 'testname':'repeated', 'desc':'이름이 같은 여러 개의 주석',
'func': function(reflist) {
  var errors = [];
  var refs2 = [];
  for(var i=0; i<reflist.length; i++) {
    if (!reflist[i].shorttag && reflist[i].refname) {
      if ($.inArray(reflist[i].refname, refs2) != -1) {
        if ($.inArray(reflist[i].refname, errors) == -1) {
          errors.push(reflist[i].refname);
        }
      } else {
        refs2.push(reflist[i].refname);
      }
    }
  }
  ret = [];
  for(var j=0; j<errors.length; j++) {
    ret.push({'msg':'같은 이름을 쓰고 있는 주석이 여러 개일 경우', 'err':errors[j]});
  }
  return ret;
}}
);
 
new citeErrorCheck({'type':'reflist', 'testname':'undefined', 'desc':'정의되지 않은 이름 달린 주석',
'func': function(reflist) {
  var errors = [];
  var longrefs = [];
  for(var i=0; i<reflist.length; i++) {
    if (!reflist[i].shorttag && reflist[i].refname) {
      longrefs.push(reflist[i].refname);
    }
  }
  for(var j=0; i<reflist.length; j++) {
    if (reflist[i].shorttag && $.inArray(reflist[i].refname, errors) == -1 && $.inArray(reflist[i].refname, longrefs) == -1) {
      errors.push(reflist[i].refname);
    }
  }
  ret = [];
  for(var j=0; j<errors.length; j++) {
    ret.push({'msg':'이름이 있는 주석이 쓰이고 있지만 내용이 정의되지 않은 경우', 'err':errors[j]});
  }
  return ret;
}}
);

// All user-facing messages
// TODO: Document usage
$(document).ready( function() {
mw.usability.addMessages( { "cite-section-label" : "인용",
"cite-template-list" : "틀",
"cite-named-refs-label" : "이름 있는 주석",
"cite-named-refs-title" : "이름 있는 주석을 삽입",
"cite-named-refs-button" : "이름 있는 주석",
"cite-named-refs-dropdown" : "이름 달린 주석", // Used on the top of the named refs list dropsown
"cite-errorcheck-label" : "오류 확인",
"cite-errorcheck-button" : "오류 확인",
"cite-dialog-base" : "인용",
"cite-form-submit" : "삽입",
"cite-form-showhide" : "더 많은 칸 보이기/숨기기",
"cite-no-namedrefs" : "이 문서에 이름이 달린 주석이 없습니다.",
"cite-namedrefs-intro" : "Select a name from the list to see the ref content. Click \"Insert\" to insert a reference to it in the text.",
"cite-raw-preview" : "위키문법:",
"cite-parsed-label" : "미리 보기 결과:",
"cite-form-parse" : "미리 보기",
"cite-refpreview" : "미리 보기",
"cite-name-label" : "주석 이름",
"cite-group-label" : "주석 그룹",
"cite-errorcheck-submit" : "확인",
"cite-errorcheck-heading" : "다음 오류를 확인해보십시오:",
"cite-error-unclosed" : "<span style='font-family:monospace'>&lt;ref&gt;</span> 태그가 열려 있습니다.",
"cite-error-samecontent" : "내용이 같은 주석 있음",
"cite-error-templates" : "<a href='//en.wikipedia.org/wiki/Wikipedia:Citation_templates'>인용 틀</a>을 쓰지 않은 주석",
"cite-error-repeated" : "이름이 같은 여러 개의 주석",
"cite-error-undef" : "이름이 있지만 내용이 없는 주석 사용",
"cite-error-samecontent-msg" : "여러 개의 주석이 내용이 똑같습니다: $1",
"cite-error-repeated-msg" : "여러 개의 주석이 같은 이름을 쓰고 있습니다: \"$1\"",
"cite-error-templates-msg" : "틀을 사용하고 있지 않습니다 $1",
"cite-form-reset" : "양식 초기화",
"cite-loading" : "데이터를 불러오는 중", // Shown while pagetext is being downloaded from the API
"cite-insert-date" : "현재 날짜를 입력", // Alt/title text for "insert date" icon
"cite-err-report-heading" : "인용 오류 보고서", // Heading for error report table
"cite-err-report-close" : "닫기", // Alt/title text for "close" icon on error report
"cite-err-report-empty" : "오류가 없습니다.", // Message displayed in the error report list if there are no errors
"cite-autofill-alt" : "자동기입" // Alt text for autofill button image
});
 
CiteTB.init();
});