User:Kwj2772/modern.js

From translatewiki.net
Jump to: navigation, search
//importScriptURI('http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-UTCLiveClock.js&action=raw&ctype=text/javascript');
/** extract a URL parameter from the current URL **********
 * From [[en:User:Lupin/autoedit.js]]
 *
 * paramName  : the name of the parameter to extract
 *
 * Local Maintainer: [[User:Dschwen]]
 */
 
function getParamValue( paramName, url) {
 if (typeof (url) == 'undefined' ) url = document.location.href;
 var cmdRe=RegExp( '[&?]' + paramName + '=([^&]*)' );
 var m=cmdRe.exec(url);
 if (m) {
  try {
   return decodeURIComponent(m[1]);
  } catch (someError) {}
 }
 return null;
}
 


function SummaryButtons(){
  if (wgAction == 'edit' || wgAction == 'submit' || wgAction == 'editredlink') {
    var wpSummary = document.getElementById('wpSummary')
    if (!wpSummary || (wpSummary.form.wpSection && wpSummary.form.wpSection.value == 'new')) return
    wpSummaryBtn = document.createElement('span')
    wpSummaryBtn.id = 'usrSumBtn'
    wpSummary.parentNode.insertBefore(wpSummaryBtn, wpSummary.nextSibling)
    addSumButton('FUZZY', '!!FUZZY!!', 'FUZZY')
  }
}
 
function addSumButton(name, text, title) {
  var btn = document.createElement('sumBtn')
  btn.appendChild(document.createTextNode(name))
  btn.title = title
  btn.onclick = function() { insertSummary(text) }
  wpSummaryBtn.appendChild(btn)
}
 
function insertSummary(text) {
  var wpSummary = document.getElementById('wpSummary')
  if (wpSummary.value.indexOf(text) != -1) return 
  if (wpSummary.value.match(/[^,; \/]$/)) wpSummary.value += ','
  if (wpSummary.value.match(/[^ ]$/)) wpSummary.value += ' '
  wpSummary.value += text
}
 
addOnloadHook(SummaryButtons);

var translatable_namespace = [8, 1214, 1202, 1210, 1212, 1204, 1216, 1200];
function remove_fuzzy () {
    var rmfuzzy = getParamValue("remove_fuzzy");
    if (rmfuzzy == 'execute') {
        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace('!!FUZZY!!','');
        document.editform.wpDiff.click();
    }
  for (var g in translatable_namespace) {
     if (translatable_namespace[g] == wgNamespaceNumber) {
        addPortletLink('p-cactions', 'http://translatewiki.net/w/i.php?title=' + encodeURIComponent(wgPageName) + '&action=edit&remove_fuzzy=execute', 'remove fuzzy', 'ca-fuzzy', 'remove fuzzy', null, null);
     }
  }
}
//addOnloadHook(remove_fuzzy);

function cc_generator () {
    var cc_gen = getParamValue('cc_gen');
    var cc_country = getParamValue('cc_country');
    var cc_version = getParamValue('cc_version');
    var cc_type = getParamValue('cc_type');
    var cc_typeText = { 
        'by': '저작자표시',
        'by-sa': '저작자표시-동일조건변경허락'
};
    var cc_countryText = {
        'ar': '아르헨티나',
        'at': '오스트리아',
        'au': '오스트레일리아',
        'be': '벨기에',
        'bg': '불가리아',
        'br': '브라질',
        'ca': '캐나다',
        'ch': '스위스',
        'cl': '칠레',
        'cn': '중국',
        'co': '콜롬비아',
        'cz': '체코',
        'de': '독일',
        'dk': '덴마크',
        'es': '스페인',
        'fi': '핀란드',
        'fr': '프랑스',
        'gr': '그리스',
        'gt': '과테말라',
        'hk': '홍콩',
        'hu': '헝가리',
        'hr': '크로아티아',
        'il': '이스라엘',
        'in': '인도',
        'it': '이탈리아',
        'jp': '일본',
        'kr': '대한민국',
        'lu': '룩셈부르크',
        'mk': '마케도니아',
        'mt': '몰타',
        'my': '말레이시아',
        'mx': '멕시코',
        'nl': '네덜란드',
        'no': '노르웨이',
        'nz': '뉴질랜드',
        'pe': '페루',
        'ph': '필리핀',
        'pl': '폴란드',
        'pr': '푸에르토리코',
        'pt': '포르투갈',
        'ro': '루마니아',
        'rs': '세르비아',
        'scotland': '영국: 스코틀랜드',
        'si': '슬로베니아',
        'sg': '싱가포르',
        'th': '타이',
        'tw': '중화민국',
        'uk': '영국: 잉글랜드 & 웨일즈',
        'us': '미국',
        'unported': '일반'
};
    var cc_text = '이 파일은 [[{{int:wm-license-cc-wiki-link}}|크리에이티브 커먼즈]] [http://creativecommons.org/licenses/'+cc_type+'/'+cc_version+'/'+cc_country+'/deed.ko '+ cc_typeText[cc_type] +' ' + cc_version + ' '+cc_countryText[cc_country]+'] 라이선스로 배포됩니다.';
    if (cc_gen == 'enable' && wgNamespaceNumber == 8 && wgAction== 'edit') {
        document.editform.wpTextbox1.value = cc_text.split('/unported').join('');
    }
}
importScriptURI('http://bits.wikimedia.org/skins-1.5/common/jquery.min.js');

//addOnloadHook(cc_generator);
function skipFS() {
    if(wgCanonicalSpecialPageName=="FirstSteps") {
        window.location="http://translatewiki.net/w/i.php?title=Special%3ALanguageStats&code=ko&suppresscomplete=1";
    }
}
addOnloadHook(skipFS);