사용자:Kwj2772/refToolbar2config.js

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

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

/* 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 http://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.
*/

if (typeof(CiteTB) == 'undefined') {
    importScript('사용자:Kwj2772/refToolbar2.js');
}

CiteTB.Options = {
"date format" : "<year>년 <monthname> <date>일",
"autodate fields" : ['확인일자'],
"months" : ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};

// Cite template definitions
new citeTemplate('웹 인용', '웹',
[ // Basic fields
{"field": "성", "label":"성"},
{"field": "이름", "label":"이름"}, 
{"field": "제목"},
{"field": "url", "label":"URL"},
{"field": "작품명", "tooltip": "인용한 내용이 큰 작품의 일부일 때 작품명을 적어줍니다"},
{"field": "출판사"},
{"field": "확인일자"}
],
[ // Expanded fields
{"field": "저자"},
{"field": "저자고리", "label":"저자 고리", "tooltip":"저자에 대해 문서가 있다면 문서의 이름을 적어줍니다."},
{"field": "공저자"},
{"field": "원본url"},
{"field": "원본일자"},
{"field": "출판위치"},
{"field": "쪽"},
{"field": "언어"},
{"field": "형식"},
{"field": "doi", "label":"DOI"},
{"field": "작성일자"},
{"field": "작성월"},
{"field": "작성년도"},
{"field": "인용"}
]);

new citeTemplate('뉴스 인용', '뉴스',
[ // Basic fields
{"field": "성", "label":"성"},
{"field": "이름", "label":"이름"}, 
{"field": "제목"},
{"field": "url", "label":"URL"},
{"field": "출판사"},
{"field": "확인일자"},
{"field": "작성일자"},
],
[ // Expanded fields
{"field": "저자"},
{"field": "공저자"},
{"field": "저자고리", "label":"저자 고리", "tooltip":"저자에 대해 문서가 있다면 문서의 이름을 적어줍니다."},
{"field": "원본url"},
{"field": "원본일자"},
{"field": "출판위치"},
{"field": "쪽"},
{"field": "언어"},
{"field": "형식"},
{"field": "doi", "label":"DOI"},
{"field": "인용"}
]);

new citeTemplate('서적 인용', '서적',
[ // Basic fields
{"field": "성"},
{"field": "이름"}, 
{"field": "제목"},
{"field": "발행년도"},
{"field": "출판사"},
{"field": "isbn", "label":"ISBN"},
{"field": "쪽"},
{"field": "url", "label":"URL"}
],
[ // Expanded fields
{"field": "저자"},
{"field": "저자고리", "label":"저자 고리", "tooltip":"저자에 대해 문서가 있다면 문서의 이름을 적어줍니다."},
{"field": "공저자"},
{"field": "편집자"},
{"field": "확인일자"},
{"field": "원본url"},
{"field": "원본일자"},
{"field": "출판위치"},
{"field": "쪽"},
{"field": "언어"},
{"field": "형식"},
{"field": "장"},
{"field": "발행일자"},
{"field": "발행월"},
{"field": "인용문"}
]);

new citeTemplate('저널 인용', '저널',
[ // Basic fields
{"field": "성"},
{"field": "이름"},
{"field": "공저자"},
{"field": "제목"},
{"field": "저널"},
{"field": "작성일자"},
{"field": "작성년도"},
{"field": "작성월"},
{"field": "volume"},
{"field": "series"},
{"field": "issue"},
{"field": "쪽"},
{"field": "doi", "label":"DOI"},
{"field": "pmid", "label":"PMID"},
{"field": "url", "label":"URL"},
{"field": "확인일자"}
],
[ // Expanded fields
{"field": "저자"},
{"field": "저자고리", "label":"저자에 관한 문서"},
{"field": "출판사"},
{"field": "출판위치"},
{"field": "언어"},
{"field": "형식"},
{"field": "issn", "label":"ISSN"},
{"field": "pmc", "label":"PMC"},
{"field": "oclc", "label":"OCLC"},
{"field": "bibcode"},
{"field": "id", "label":"ID"},
{"field": "인용"},
{"field": "작성계절"}
]);

new citeTemplate('백과사전 인용', '백과사전',
[ // Basic fields
{"field": "성"},
{"field": "이름"},
{"field": "공저자"},
{"field": "제목"},
{"field": "url", "label":"URL"},
{"field": "백과사전이름"},
{"field": "작성일자"},
{"field": "작성연도"},
{"field": "작성월일"},
{"field": "확인일자"},
{"field": "확인연도"}
],
[ //Expanded fields
{"field": "저자"},
{"field": "저자링크", "label":"저자에 관한 문서"},
{"field": "판"},
{"field": "권"},
{"field": "쪽"},
{"field": "편집인"},
{"field": "출판사"},
{"field": "출판위치"},
{"field": "언어"},
{"field": "인용"},
{"field": "id"},
{"field": "doi"}
]);


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",
"cite-template-list" : "틀",
"cite-named-refs-label" : "Named refs",
"cite-named-refs-title" : "Insert a named reference",
"cite-named-refs-button" : "Named references",
"cite-named-refs-dropdown" : "Named refs", // 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" : "Show/hide extra fields",
"cite-no-namedrefs" : "Cannot find any named refs on the page",
"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" : "Wikitext:",
"cite-parsed-label" : "Parsed wikitext:",
"cite-form-parse" : "Show parsed preview",
"cite-refpreview" : "Preview",
"cite-name-label" : "Ref name",
"cite-group-label" : "Ref group",
"cite-errorcheck-submit" : "확인",
"cite-errorcheck-heading" : "Check for the following errors:",
"cite-error-unclosed" : "Unclosed <span style='font-family:monospace'>&lt;ref&gt;</span> tags",
"cite-error-samecontent" : "References with the same content",
"cite-error-templates" : "References not using a <a href='http://en.wikipedia.org/wiki/Wikipedia:Citation_templates'>citation template</a>",
"cite-error-repeated" : "Multiple references with the same name",
"cite-error-undef" : "Usage of undefined named references",
"cite-error-samecontent-msg" : "Multiple refs contain the same content: $1",
"cite-error-repeated-msg" : "Mutiple refs are given the name: \"$1\"",
"cite-error-templates-msg" : "Does not use a template: $1",
"cite-form-reset" : "Reset form",
"cite-loading" : "Loading data", // Shown while pagetext is being downloaded from the API
"cite-insert-date" : "Insert current date", // Alt/title text for "insert date" icon
"cite-err-report-heading" : "Citation error report", // Heading for error report table
"cite-err-report-close" : "닫기", // Alt/title text for "close" icon on error report
"cite-err-report-empty" : "No errors found" // Message displayed in the error report list if there are no errors
});

CiteTB.init();
});

$(window).load(function() {
  CiteTB.init();
});