사용자:Ksiom/monobook.js

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

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

// addPurge
$(function () {
    var hist; var url;
    if (!(hist = document.getElementById('ca-history') )) return;
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
                   '새로 고침', 'ca-purge', '이 페이지의 캐시를 새로 고칩니다.', '0');
});
//

// wikiEd
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

importScript('사용자:IRTC1015/wikEd_international_ko.js');
// 

// Revert tools
function getElementsByClass(searchClass,node,tag) {
  var classElements = new Array();
  if ( node == null )
    node = document;
  if ( tag == null )
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}

var _GET = new Array();
var _uri = location.href;

var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&");

var _temp_get_arr_1 = new Array();

for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){
  _temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("=");
  _GET[decodeURI(_temp_get_arr_1[0])] = decodeURI(_temp_get_arr_1[1]);
}

delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;

function getMessage (where, user1, user2) {
  var message = prompt ('편집 요약을 입력해주세요.', '');
  window.location = 'http://ko.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
}

function getWarnReason (level, user2, otitle) {
  var reason = prompt ('되돌리는 이유를 입력해주세요.(훼손/광고/장난/부적절/비방/왜곡/욕설/저작권/중립/인신/독자/사전/넘김/토론/사용자/편집)', '훼손');
  window.location = 'http://ko.wikipedia.org/w/index.php?title=사용자토론:'+user2+'&action=edit&section=new&warn='+level+'&otitle='+otitle+'&reason='+reason;
}

$(function (){
  if (location.href.match(/diff=/)) {
    // Get username of submitter
    var user1 = getElementsByClass('diff-otitle',null,'td'); user1 = user1[0].getElementsByTagName('a')[2].innerHTML;
    var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[3].innerHTML;
    var otitle = getElementsByClass('firstHeading',null,'h1'); otitle = otitle[0].innerHTML;
    document.getElementById('contentSub').innerHTML = '(<a href="http://ko.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=1&user1='+user1+'&user2='+user2+'">되돌리기</a> / <a href="javascript:var message = getMessage(\'revert\', \''+user1+'\', \''+user2+'\');">편집 요약 남기기</a>) (<a href="http://ko.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&vandalism=1&user1='+user1+'&user2='+user2+'">문서 훼손</a> / <a href="javascript:var message = getMessage(\'vandalism\', \''+user1+'\', \''+user2+'\');">편집 요약 남기기</a>) (경고: <a href="javascript:var message = getWarnReason(\'1\', \''+user2+'\', \''+otitle+'\');">되돌려짐 알림</a> / <a href="javascript:var message = getWarnReason(\'2\', \''+user2+'\', \''+otitle+'\');">주의 알림</a> / <a href="javascript:var message = getWarnReason(\'3\', \''+user2+'\', \''+otitle+'\');">차단 경고</a> / <a href="http://ko.wikipedia.org/w/index.php?title=사용자토론:'+user2+'&action=edit&section=new&warn=4&otitle='+otitle+'">되돌려짐 알림(이유 없음)</a>)';
  } else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = '[[특수기능:기여/'+_GET['user2']+'|'+_GET['user2']+']]([[사용자토론:'+_GET['user2']+'|토론]])의 편집을 [[특수기능:기여/'+_GET['user1']+'|'+_GET['user1']+']]([[사용자토론:'+_GET['user1']+'|토론]])의 ' + _GET['oldid']+'판으로 되돌림';
    document.getElementById('editform').submit();
  } else if (location.href.match(/revert=2/)) {
    document.getElementById('wpSummary').value = '[[특수기능:기여/'+_GET['user2']+'|'+_GET['user2']+']]([[사용자토론:'+_GET['user2']+'|토론]])의 편집을 [[특수기능:기여/'+_GET['user1']+'|'+_GET['user1']+']]([[사용자토론:'+_GET['user1']+'|토론]])의 ' + _GET['oldid']+'판으로 되돌림('+_GET['message']+')';
    document.getElementById('editform').submit();
  } else if (location.href.match(/vandalism=1/)) {
    document.getElementById('wpSummary').value = '[[특수기능:기여/'+_GET['user2']+'|'+_GET['user2']+']]([[사용자토론:'+_GET['user2']+'|토론]])의 문서 훼손을 [[특수기능:기여/'+_GET['user1']+'|'+_GET['user1']+']]([[사용자토론:'+_GET['user1']+'|토론]])의 ' + _GET['oldid']+'판으로 되돌림';
    document.getElementById('editform').submit();
  } else if (location.href.match(/vandalism=2/)) {
    document.getElementById('wpSummary').value = '[[특수기능:기여/'+_GET['user2']+'|'+_GET['user2']+']]([[사용자토론:'+_GET['user2']+'|토론]])의 문서 훼손을 [[특수기능:기여/'+_GET['user1']+'|'+_GET['user1']+']]([[사용자토론:'+_GET['user1']+'|토론]])의 ' + _GET['oldid']+'판으로 되돌림('+_GET['message']+')';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=1/)) {
    document.getElementById('wpSummary').value = '[[:'+_GET['otitle']+']]';
    document.getElementById('wpTextbox1').value = '{{되돌려짐'+' 알림|'+_GET['otitle']+'|'+_GET['reason']+'}} --~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=2/)) {
    document.getElementById('wpSummary').value = '[[:'+_GET['otitle']+']]';
    document.getElementById('wpTextbox1').value = '{{주의'+' 알림|'+_GET['otitle']+'|'+_GET['reason']+'}} --~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=3/)) {
    document.getElementById('wpSummary').value = '[[:'+_GET['otitle']+']]';
    document.getElementById('wpTextbox1').value = '{{차단'+' 경고|'+_GET['otitle']+'|'+_GET['reason']+'}} --~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=4/)) {
    document.getElementById('wpSummary').value = '되돌려짐 알림';
    document.getElementById('wpTextbox1').value = '{{되돌려짐'+' 알림}} --~~'+'~~';
    document.getElementById('editform').submit();
  }
});
//