다국어인구학사전입니다. 여러분들의 많은 이용바랍니다. The Demopaedia team will be present at the next International Population Conference in Busan.
If you attend the conference, please, come to our oral communication which will be held on Tuesday August 27, from 15:30 to 17:00 (Bexco, room 213). The new Korean dictionary will also be presented in a side meeting organized by the Planned Population Federation of Korea (PPFK) on "Population Issues & Official development assistance" (open to all) at 19:00 (Bexco, room 110).

다국어인구학사전, 두 번째 통합본, 한국어판

미디어위키:RefToolbarBaseTextTerm.js

Demopædia
Nicolas Brouard (토론 | 기여)님의 2012년 8월 30일 (목) 19:24 판 (판 1개: Importing TextTermJavaTemplate from fr-ii)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
이동: 둘러보기, 검색

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

  • 파이어폭스 / 사파리: Shift 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5 또는 Ctrl-R을 입력 (Mac에서는 ⌘-R)
  • 구글 크롬: Ctrl-Shift-R키를 입력 (Mac에서는 ⌘-Shift-R)
  • 인터넷 익스플로러: Ctrl 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5를 입력.
  • 오페라: 메뉴 → 설정(맥의 경우 오페라 → 환경 설정)으로 이동한 다음 개인 정보 보호 및 보안 → 검색 데이터 지우기 → 캐시한 이미지 및 파일을 누름.
// Global object
if (typeof CiteTB == 'undefined') {
  var CiteTB = {
    "Templates" : {}, // All templates
    "Options" : {}, // Global options
    "UserOptions" : {}, // User options
    "DefaultOptions" : {}, // Script defaults
    "ErrorChecks" : {} // Error check functions
  };
}

if (typeof mw.usability == 'undefined') {
  mw.usability = {};
  mw.usability.getMsg = function(m) { return mw.messages.get(m); }
  mw.usability.addMessages = function(msgs) { mw.messages.set(msgs); };
}

// Object for cite templates
function citeTemplate(templatename, shortform, basicfields, expandedfields) {
  // Properties
  this.templatename = templatename; // The template name - "cite web", "cite book", etc.
  this.shortform = shortform; // A short form, used for the dropdown box
  this.basic = basicfields; // Basic fields - author, title, publisher...
  // Less common - quote, archiveurl - should be everything the template supports minus the basic ones
  this.extra = expandedfields;

  // Add it to the list
  CiteTB.Templates[this.templatename] = this;
  // Methods
  this.makeFormInner = function(fields) {
    var i=0;
    var trs = new Array();
    for (i=0; i<fields.length; i++) {
      var fieldobj = fields[i];
      var field = fieldobj.field;
      var ad = false;
      if ($j.inArray(field, CiteTB.getOption('autodate fields')) != -1 ) {
        im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Nuvola_apps_date.svg/20px-Nuvola_apps_date.svg.png');
        im.attr('alt', mw.usability.getMsg('cite-insert-date')).attr('title', mw.usability.getMsg('cite-insert-date'));
        var ad = $j('<a />').attr('href', '#');
        ad.append(im);
        ad.attr('id', 'cite-date-'+CiteTB.escStr(this.shortform)+'-'+field);
        $j('#cite-date-'+CiteTB.escStr(this.shortform)+'-'+field).live('click', CiteTB.fillAccessdate);
      }
	  
      if (fieldobj.autofillid) {
        var autotype = fieldobj.autofillid;
        im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/1/17/System-search.svg/20px-System-search.svg.png');
        im.attr('alt', mw.usability.getMsg('cite-autofill-alt')).attr('title', mw.usability.getMsg('cite-autofill-alt'));
        var ad = $j('<a />').attr('href', '#');
        ad.append(im);
        ad.attr('id', 'cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype);
        $j('#cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype).live('click', CiteTB.initAutofill);	  
      }
	  
      var display = mw.usability.getMsg('cite-'+field+'-label');
      var tooltip = fieldobj.tooltip ? $j('<abbr />').attr('title', mw.usability.getMsg(fieldobj.tooltip)).text('*') : false;
      
      var input = '';
      if (ad) {
        input = $j('<input tabindex="1" style="width:85%" type="text" />');
      } else {
        input = $j('<input tabindex="1" style="width:100%" type="text" />');
      }
      input.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field);
	  if (fieldobj.autofillprop) {
	    input.addClass('cite-'+CiteTB.escStr(this.shortform)+'-'+fieldobj.autofillprop);
	  }
      var label = $j('<label />');
      label.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field).text(display);
      if (tooltip) {
        label.append(tooltip);
      }
      var style = 'text-align:right; width:20%;';
      if (i%2 == 1) {
        style += ' padding-left:1em;';
      } else {
        var tr = $j('<tr />');
      }
      var td1 = $j('<td class="cite-form-td" />').attr('style', style);
      td1.append(label);
      tr.append(td1);
      var td2 = $j('<td class="cite-form-td" style="width:30%" />');
      td2.append(input);
      if (ad) {
        td2.append(ad);
      }
      tr.append(td2);
      if (i%2 == 0) {
        trs.push(tr);
      }
    }
    return trs;
  
  }
  
  // gives a little bit of HTML so the open form can be identified
  this.getInitial = function() {
    var hidden = $j('<input type="hidden" class="cite-template" />');
    hidden.val(this.templatename);
    return hidden;
  }
  
  // makes the form used in the dialog boxes
  this.getForm = function() {
    var main = $j("<div class='cite-form-container' />");
    var form1 = $j('<table style="width:100%; background-color:transparent;" class="cite-basic-fields" />');
    var i=0;
    var trs = this.makeFormInner(this.basic);
    for (var i=0; i<trs.length; i++) {
      form1.append(trs[i]);
    }
    
    var form2 = $j('<table style="width:100%; background-color:transparent; display:none" class="cite-extra-fields">');
    trs = this.makeFormInner(this.extra);
    for (var i=0; i<trs.length; i++) {
      form2.append(trs[i]);
    }    
    main.append(form1).append(form2);
    
    var form3 = $j('<table style="width:100%; background-color:transparent;padding-top:1em" class="cite-other-fields">');
    var tr = $j('<tr />');
    var td1 = $j('<td class="cite-form-td" style="text-align:right; width:20%" />');
    var label1 = $j('<label />');
    label1.attr('for', "cite-"+CiteTB.escStr(this.shortform)+'-name').text(mw.usability.getMsg('cite-name-label'));
    td1.append(label1);
    var td2 = $j('<td class="cite-form-td" style="width:30%" />');
    var input1 = $j('<input tabindex="1" style="width:100%" type="text" />');
    input1.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-name');
    td2.append(input1);
    var td3 = $j('<td class="cite-form-td" style="text-align:right; padding-left:1em; width:20%">');
    var label2 = $j('<label />');
    label2.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-group').text(mw.usability.getMsg('cite-group-label'));
    td3.append(label2);
    var td4 = $j('<td class="cite-form-td" style="width:30%" />');
    var input2 = $j('<input tabindex="1" style="width:100%" type="text" />');
    input2.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-group');
    td4.append(input2);
    tr.append(td1).append(td2).append(td3).append(td4);
    form3.append(tr);
    main.append(form3);
    var extras = $j('<div />');
    extras.append('<input type="hidden" class="cite-form-status" value="closed" />');
    var hidden = $j('<input type="hidden" class="cite-template" />');
    hidden.val(this.templatename);
    extras.append(hidden);
    var span1 = $j('<span class="cite-preview-label" style="display:none;" />');
    span1.text(mw.usability.getMsg('cite-raw-preview'));
    extras.append(span1).append('<div class="cite-ref-preview" style="padding:0.5em; font-size:110%" />');
    var span2 = $j('<span class="cite-prev-parsed-label" style="display:none;" />');
    span2.text(mw.usability.getMsg('cite-parsed-label'));
    extras.append(span2).append('<div class="cite-preview-parsed" style="padding-bottom:0.5em; font-size:110%" />');
    var link = $j('<a href="#" class="cite-prev-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');
    link.text(mw.usability.getMsg('cite-form-parse'));
    extras.append(link);    
    main.append(extras);
    
    return main;
  }
}

/* Class for error checks
    FIXME: DOCS OUT OF DATE
   type - type of error check - current options:
    * 'refcheck' - apply a function on each ref individually
      * function should accept a ref object, return a string
    * 'reflist' - apply a function on the entire ref list
      * function should accept an array of ref objects, return an array of strings
    * 'search' - apply a function ro the page text
      * function should accept the page text as a string, return an array of strings
   The strings returned by the function should be valid HTML
   
   func - The function described above
   testname - Name of the error check, must not contain spaces
   desc - A short description of the test
*/

function citeErrorCheck(obj) {
  this.obj = obj
  CiteTB.ErrorChecks[this.obj.testname] = this;
  
  this.run = function() {
    var errors = [];
    switch(this.obj['type']) {
      case "refcheck":
        CiteTB.loadRefs();
        for(var i=0; i<CiteTB.mainRefList.length; i++) {
          var e = this.obj.func(CiteTB.mainRefList[i]);
          if (e) {
            errors.push(e);
          }
        }
        break;
      case "reflist":
        CiteTB.loadRefs();
        errors = this.obj.func(CiteTB.mainRefList);
        break;
      case "search":
        var func = this.obj.func
        CiteTB.getPageText(function(text) {
          errors = func(text);
        });
        break;
    }
    return errors;
  }
  
  this.getRow = function() {
    var row = $j("<li />");
    var check = $j("<input type='checkbox' name='cite-err-test' />");
    check.attr('value', this.obj.testname);
    var label = $j("<label />").html(mw.usability.getMsg(this.obj.desc));
    label.attr('for', this.obj.testname); 
    row.append(check).append(' &ndash; ').append(label);
    return row;
  }
}
$j('head').trigger('reftoolbarbase');