User:Kwj2772/monobook.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
//<source lang=javascript>
/* Global JavaScript */
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Kwj2772/remote.js&action=raw&ctype=text/javascript');

if (mw.config.get('wgNamespaceNumber') == 4) {
    var wgCanonicalNamespace = 'Commons';
}
function isAdmin () {
    for (var k=0; k < wgUserGroups.length; k++) {
        if (wgUserGroups[k] == 'sysop') {
            return true;
        } else {
            return false;
        }
    }
}
/*************************************
 *       Commons Edit Summary         *
 *************************************/
/* from ru.wikipedia (현재 제안 중) */

function SummaryButtons(){
  if (mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit' || mw.config.get('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('SVG', '{{SVG}}', 'SVG')
    addSumButton('SVGAv', '{{SVG available}}', 'SVG Available')
    addSumButton('Copyvio', '[[COM:L|Copyright violation]]', 'Copyright violation')
    addSumButton('Request for Deletion', '[[COM:DR|Request for deletion]]', 'delete')
    addSumButton('renameX:translatetoen', '[[COM:RENAME|File renaming rejected: There is no need to translate/move into English]]', 'File renaming rejected: There is no need to translate/move into English')
    addSumButton('renamed', 'File renamed', 'File renamed')
    addSumButton('nld', 'nld', 'No license info')
    addSumButton('passed', 'Flickr review passed', 'flickr review passed')
    addSumButton('failed', 'Flickr review failed', 'flickr review failed')
    addSumButton('commonsdelink', 'Replaced image manually per [[commmons:User:CommonsDelinker/commands]] since CommonsDelinker is down.', 'commonsdelinker')

    if (mw.config.get('wgNamespaceNumber') == 0) {
      addSumButton('seetalk', '[[Talk:'+mw.config.get('wgTitle')+']]', 'see talk page')
    } else {
      addSumButton('seetalk', '[['+mw.config.get('wgCanonicalNamespace')+ ' talk:'+mw.config.get('wgTitle')+']]', 'see talk page')
    }
  }
}

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
}

$(SummaryButtons)

// [[위키백과:사랑방/2007년 10월#미리 보기 강제 실시]] 참고
// 소스: 프랑스어 위키백과
/**
  * Force IP to preview before saving changes.
  * Copyright Marc Mongenet, 2006
  */
for ( var g in wgRestrictionEdit ) {
    function forcePreview() {
      if (mw.config.get('wgAction') != "edit") return;
      saveButton = document.getElementById("wpSave");
      if (!saveButton) return;
      saveButton.disabled = true;
      saveButton.value = "저장 (미리 보기 후)";
      saveButton.style.fontWeight = "normal";
      document.getElementById("wpPreview").style.fontWeight = "bold";
    }
    if (wgRestrictionEdit[g] == "sysop" || mw.config.get('wgNamespaceNumber') == 8) {
          $(forcePreview);
    }
}


importScript('User:Kwj2772/temp.js');


/* Easy-copying Current Revision ID */
function logCurrentRevsID () {
   var logCurrentRevsID_execute = getParamValue("log_currevsid");
   if (logCurrentRevsID_execute == 'execute') {
      var permaLinkURL = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&oldid=' + wgCurRevisionId;
      window.clipboardData.setData("Text", permaLinkURL);
      alert('클립보드에 복사되었습니다.');
   }
   if (mw.config.get('wgNamespaceNumber') != -1 && isIE() == true) {
      mw.util.addPortletLink('p-tb', mw.config.get('wgServer') + mw.config.get('wgScript') + '?log_currevsid=execute&title=' + encodeURIComponent(mw.config.get('wgPageName')), '고유링크 복사', 't-logCurRevsID', '문서의 현재 판 고유링크를 클립보드에 복사합니다');
   }
}
$(logCurrentRevsID);

/* Add "Show Betawiki" link for MediaWiki namespace */
$(function () {
  if (mw.config.get('wgCanonicalNamespace') != "MediaWiki") return;

  var body = document.getElementById ('contentSub');

  body.innerHTML += '<p><a href="http://translatewiki.net/wiki/MediaWiki:'+mw.config.get('wgTitle')+'">베타위키에서 이 메시지 보기</a></p>';

});

/* Flickrreview */
importScript('User:ZooFari/licensereview.js');
/*Browser distinction */
function isChrome() {
    if (navigator.userAgent.toLowerCase().indexOf('chrome') != -1) return true;
    return false;
}
function isIE () {
    if (navigator.userAgent.toLowerCase().indexOf('trident') != -1) return true;
    return false;
}
function isGecko() {
    if (navigator.userAgent.toLowerCase().indexOf('gecko') != -1) return true;
    return false;
}


function addSULLink() {
if (mw.config.get('wgNamespaceNumber') == 2 || mw.config.get('wgNamespaceNumber') == 3) {
if (mw.config.get('wgTitle').indexOf("/") != -1) {
    return;
} else {
    var username = encodeURIComponent( mw.config.get('wgTitle') );
    global_append_tab ('http://toolserver.org/~vvv/sulutil.php?user=' + username, 'SUL status', 'tab-sul');
}
}
}
$(addSULLink);

/* +Admin tab */
function moreadmintabs () {
  if (mw.config.get('wgTitle').indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history
     return;
  if (mw.config.get('wgCanonicalNamespace') == "User" || mw.config.get('wgCanonicalNamespace') == "User_talk") {
     var username = encodeURIComponent( mw.config.get('wgTitle') );
     for (var a in wgUserGroups) {
         if (wgUserGroups[a] == "sysop") {
             mw.util.addPortletLink("p-cactions", mw.config.get('wgServer') + "/wiki/Special:Block/" + username, "차단", "ca-blockuser", "Block this user");
             mw.util.addPortletLink("p-cactions", mw.config.get('wgServer') + "/wiki/Special:UserRights/" + username, "권한 조정", "ca-userrights", "Change user right");
         }
     }
  }
}
$(moreadmintabs);
importScript('User:Kwj2772/validator.js');
//importScript('User:Kwj2772/massblock.js');
//importScript('User:Kwj2772/commonsdelinker.js');

window.disableAjaxTranslation = true;

if (isChrome() == true || isGecko() == true) {
importScript('User:Kwj2772/gecko.js');
}

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Mr.Z-man/moverevert2.js&action=raw&ctype=text/javascript');


//</source>