Revision 59947 of "利用者:ゆいしあす/monobook.js" on jawikisource

/*<pre>*/
function getElementsByClass(searchClass,node,tag) {
  // Function from http://www.dustindiaz.com/getelementsbyclass/
  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;
}
 
// _GET code from NoGray JS Library http://www.nogray.com/new_site/
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;
 
addOnloadHook(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;
    document.getElementById('contentSub').innerHTML = '<a href="https://ja.wikisource.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=1&user1='+user1+'&user2='+user2+'">(rv)</a> <a href="https://ja.wikisource.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=2&user1='+user1+'&user2='+user2+'">(rvv)</a> <a href="https://ja.wikisource.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=3&user1='+user1+'&user2='+user2+'">(spam)</a> <a href="https://ja.wikisource.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=4&user1='+user1+'&user2='+user2+'">(ooooops!!)</a> <a href="https://ja.wikisource.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=5&user1='+user1+'&user2='+user2+'">(サンドボックス初期化)</a>';
  } else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = 'rv';
    document.getElementById('wpMinoredit').checked = true;
    document.getElementById('editform').submit();
  } else if (location.href.match(/revert=2/)) {
    document.getElementById('wpSummary').value = 'rvv';
    document.getElementById('wpMinoredit').checked = true;
    document.getElementById('editform').submit();
  } else if (location.href.match(/revert=3/)) {
    document.getElementById('wpSummary').value = 'spam';
    document.getElementById('wpMinoredit').checked = true;
    document.getElementById('editform').submit();
  } else if (location.href.match(/revert=4/)) {
    document.getElementById('wpSummary').value = 'ooooops!!';
    document.getElementById('wpMinoredit').checked = true;
    document.getElementById('editform').submit();
  } else if (location.href.match(/revert=5/)) {
    document.getElementById('wpSummary').value = '砂場ならし';
    document.getElementById('wpMinoredit').checked = true;
    document.getElementById('editform').submit();
  }
});
/*</pre>*/

/*</pre>*/
function QuickBlock (blockOther,blockReason) {
	blockForm = document.getElementById('blockip');
	inputs = blockForm.getElementsByTagName('input');
	for (i=0; i<inputs.length; i++) {
		if (inputs[i].name == 'wpBlockOther') {
			inputs[i].value = blockOther;
			continue;
		}
		if (inputs[i].name == 'wpBlockReason') {
			inputs[i].value = blockReason;
			continue;
		}
	}
	blockForm.submit();
}

function addblockoptions() {
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("1 week","荒らし")',
		'vand',
		'p-block-vand');
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("infinite","荒らしアカウント")',
		'voa',
		'p-block-voa');
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("1 week","spam")',
		'spam',
		'p-block-spam');
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("infinite","spamアカウント")',
		'soa',
		'p-block-soa');
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("infinite","不適切な利用者名")',
		'usoft',
		'p-block-usoft');
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("infinite","アカウント作成荒らし")',
		'uhard',
		'p-block-uhard');
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("infinite","パスワード公開")',
		'selfc',
		'p-block-selfc');
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("1 week","{{anonblock|1=}}<!--{{anonblock|1=|sig=--~~"+"~~}}-->")',
		'anon',
		'p-block-anon');
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("1 week","{{schoolblock|1=}}<!--{{schoolblock|1=|sig=--~~"+"~~}}-->")',
		'school',
		'p-block-school');
	addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("infinite","open proxy")',
		'op',
		'p-block-op');
}
if ( wgCanonicalSpecialPageName == 'Blockip' )addOnloadHook(addblockoptions);
/*</pre>*/