משתמש:YHYH/vector.js

מתוך ויקיפדיה, האנציקלופדיה החופשית

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
  • אופרה: ללחוץ על Ctrl-F5.
importUserScript(2);

importUserScript(5);

importUserScript(13);

importUserScript(3);

importUserScript(30);

importUserScript(10);

importUserScript(16);

importUserScript(15);

importUserScript(29);

// Revert tools by Lorian
//From Nir909's monobook
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;
 
function getMessage (where, user1, user2) {
  var message = prompt ('איזו הודעה ברצונך להשאיר?', '');
  window.location = 'http://he.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
}
 
$(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="http://he.wikipedia.org/w/index.php?title=' + wgPageName + '&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://he.wikipedia.org/w/index.php?title=' + wgPageName + '&action=edit&oldid=' + _GET['oldid'] + '&vandalism=1&user1='+user1+'&user2='+user2+'">ונדליזם</a> / <a href="javascript:var message = getMessage(\'vandalism\', \''+user1+'\', \''+user2+'\');">הודעה</a>) (אזהרה: <a href="http://he.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=1">אזהרה</a> / <a href="http://he.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=2">ניסויים</a> / <a href="http://he.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=3">תודה</a>)';
  } else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = 'שוחזר מעריכה של [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] לגרסה ' + _GET['oldid']+' של [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]';
    document.getElementById('editform').submit();
  } else if (location.href.match(/revert=2/)) {
    document.getElementById('wpSummary').value = 'שוחזר מעריכה של [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] לגרסה ' + _GET['oldid']+' של [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')';
    document.getElementById('editform').submit();
  } else if (location.href.match(/vandalism=1/)) {
    document.getElementById('wpSummary').value = 'שחזור השחתה של [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] לגרסה ' + _GET['oldid']+' של [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]';
    document.getElementById('editform').submit();
  } else if (location.href.match(/vandalism=2/)) {
    document.getElementById('wpSummary').value = 'שחזור השחתה של [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] לגרסה ' + _GET['oldid']+' של [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=1/)) {
    document.getElementById('wpSummary').value = 'אזהרת השחתה';
    document.getElementById('wpTextbox1').value = '{{אזהרה}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=2/)) {
    document.getElementById('wpSummary').value = 'ניסויי עריכה';
    document.getElementById('wpTextbox1').value = '{{ניסויים}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=3/)) {
    document.getElementById('wpSummary').value = 'תודה על תרומתך לוויקיפדיתנו!';
    document.getElementById('wpTextbox1').value = '{{תודה}} ~~'+'~~';
    document.getElementById('editform').submit();
  }
});
//Made by Eran
function addDeleteOption() {
  ta['del'] = ['', 'מחק דף זה'];
  if (!document.getElementById) return;
  var reqDel=wgPageName;
  x = document.getElementById('ca-move');
  if(!x) return;
  y = document.createElement('li');
  y.id = 'ca-move';
  z = document.createElement('a');
    z.href = 'http://he.wikipedia.org/w/index.php?title=ויקיפדיה:בקשות_ממפעילים&action=edit&section=1&pleasedelete=yes&pagefordel='+reqDel;
  if (x.children) {
    z.appendChild(document.createTextNode('מחיקה'));
    y.appendChild(z);
    document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
  } else {
    z.appendChild(document.createTextNode('מחיקה'));
    y.appendChild(z);
    document.getElementById('p-cactions').childNodes[3].insertBefore(y,null);
  }
}
 
$(function (){
if(location.href.match(/pleasedelete=yes/)) {
    txtLoc=location.href;
    reqDel=decodeURI(txtLoc.substring(txtLoc.indexOf('pagefordel=')+11,txtLoc.length));
    document.getElementById('wpSummary').value = '[[' + reqDel + ']]';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '\n*[['+reqDel+']] ~~'+'~~';
    document.getElementById('editform').submit();
}
});


if (!String.prototype.endsWith)
	String.prototype.endsWith = function(what) { 
		return what && what.length && this.length >= what.length && (this.lastIndexOf(what) == this.length - what.length) 
	}
 
function monitorPatrolRemoveAuto() {
	var uls = document.getElementById('bodyContent').getElementsByTagName('ul');
	for (uli = 0; uli < uls.length; uli++) {
		var ul = uls[uli];
		var lis =  getElementsByClassName(ul, 'li', 'mw-logline-patrol');
		for (var lii = 0; lii < lis.length; lii++) {
			var li = lis[lii];
			if (li.innerHTML.endsWith(' כבדוקה (אוטומטית) ‏  '))
				ul.removeChild(li);
		}
	}
}
 
function monitorPatrolIsItCheckedPage() {
	var optionElems = document.getElementById('bodyContent').getElementsByTagName('option');
	for (var elemi = 0; elemi < optionElems.length; elemi++) {
		var elem = optionElems[elemi];
		if (elem.value == 'patrol' && elem.innerHTML == 'יומן שינויים בדוקים')
			return elem.selected;
	}
	return false;
}
 
function monitorPatrolAddButton() {
	var inputs = document.getElementById('bodyContent').getElementsByTagName('input');
	for (var inputi = 0; inputi < inputs.length; inputi++)
		var input = inputs[inputi];
		if (input.type == 'submit' && input.value == 'הצגה') {
			var papa = input.parentNode;
			var nextNode = input.nextSibling;
			if (papa) {
				var filterButton = document.createElement('input');
				filterButton.type = 'button';
				filterButton.value = 'הסתר בדיקות אוטומטיות';
				filterButton.onclick = monitorPatrolRemoveAuto;
				if (nextNode) {
					if (nextNode.value != input.value) //avoid inserting this button more than once.
						papa.insertBefore(filterButton, nextNode);
				} else
					papa.appendChild(filterButton);
			}
			return;
		}
}
 
if (wgCanonicalSpecialPageName == 'Log' && monitorPatrolIsItCheckedPage())
 	monitorPatrolAddButton();


importScript('user:Yonidebest/scripts/checkblockedUsers.js');