משתמש:Odedee/monobook.js
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
- אופרה: ללחוץ על Ctrl-F5.
// [[User:Lupin/popups.js]] - please include this line
// תורגם ע"י אביחי
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Odedee/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// This function is used to include scripts from other Wikipedia pages in mine. I got it from [[:en:User:Omegatron/monobook.js]] who got it from [[:en:User:Quarl/monobook.js]].
function winc(s) {
s = s.replace(/^\[\[/, '').replace(/\]\]$/, '');
document.write('<scr' + 'ipt type="text/javascript" src="'
+ 'http://he.wikipedia.org/w/index.php?title=' + s
+ '&action=raw&ctype=text/javascript&dontcountme=s"></scr'
+ 'ipt>');
}
/* Included functions */
winc('[[משתמש:Odedee/monobook.js/addlink.js]]'); /* Adds links to lists on the page, such as the personal tools section. */
winc('[[משתמש:Odedee/monobook.js/usercontrib.js]]'); /* Adds user contribution tab to user pages and talk user pages . */
winc('[[משתמש:Odedee/monobook.js/talkIPTool.js]]'); /* Adds extra warning template to anonymous talk pages - for sysop only. */
// If you are not editing a page, a tab will appear allowing you to edit the 0th section of a page (the top area usually used as an introduction.
function addEditSection0() {
x = document.getElementById('ca-edit');
if (!x) return;
ta['ca-edit-0'] = ['', 'ערוך את ההקדמה'];
y = document.createElement('LI');
y.id = 'ca-edit-0';
// if is edit page and is section 0, then mark "0" as seleted and mark "עריכה" as unseleted
var isSelected = (x.className.indexOf('selected') != -1);
var isTalk = (x.className.indexOf('istalk') != -1);
var isSection0 = (/&action=edit§ion=0$/.test(window.location.href));
//alert(isSelected + " " + isTalk + " " + isSection0);
if (isSelected) {
if (isSection0) {
y.className = x.className;
x.className = (isTalk) ? 'istalk' : '';
} else {
if (isTalk) y.className = 'istalk';
}
}
// add the "0" li element
var z = document.createElement('A');
z.href = x.childNodes[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
x.parentNode.insertBefore(y,x.nextSibling);
// add summary if editing section 0
if ( isSection0 )
document.getElementById("wpSummary").value = "/* עריכת ההקדמה */ ";
}
$(addEditSection0);
// Gets parameters from the address bar link
// From [[en:User:Lupin/autoedit.js]]
function getParamValue(paramName) {
var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
var h=document.location;
var m=cmdRe.exec(h);
if (m) {
try {
return decodeURIComponent(m[1]);
} catch (someError) {}
}
return null;
}
//
// סקריפט 13: לקוח מ[[ויקיפדיה:סקריפטים/13]]
// קוד הבודק האם למשתמש יש זכות הצבעה. הקוד אינו בודק ותק אלא רק בהקשר לתרומות: 100 תרומות בתוך 90 יום.
// נכתב על ידי [[משתמש:yonidebest]]
//
function voteNotice(notice, hasVote) {
var el = document.createElement('DIV');
if (hasVote)
el.style.border = "2px solid green";
else
el.style.border = "2px solid red";
el.style.margin = '1em 3em 1em 3em';
el.style.padding = '7px';
el.style.textAlign = 'center';
el.appendChild(document.createTextNode(notice));
var fieldset = document.getElementById('bodyContent').getElementsByTagName('fieldset');
fieldset[0].parentNode.insertBefore(el, fieldset[0].nextSibling);
}
function voteStatus() {
if (getParamValue("checkvote") == "yes") {
// check if user has 100 edits
if (document.getElementById('bodyContent').innerHTML.indexOf('>100 הקודמות<') == -1) { // not enough edits
voteNotice('למשתמש זה אין 100 עריכות ולכן אין לו זכות הצבעה :-(', false);
return;
}
// get date of last edit and check 90 days rule
var li = document.getElementById('bodyContent').getElementsByTagName('ul')[0].getElementsByTagName('li');
var rawDate = li[li.length - 1].innerHTML.substring(7, li[li.length - 1].innerHTML.indexOf('(') - 1);
var date = rawDate.split(' ');
var month = {
'בינואר': '0',
'בפברואר': '1',
'במרץ': '2',
'באפריל': '3',
'במאי': '4',
'ביוני': '5',
'ביולי': '6',
'באוגוסט': '7',
'בספטמבר': '8',
'באוקטובר': '9',
'בנובמבר': '10',
'בדצמבר': '11'
}
var now = new Date();
var d = new Date();
d.setDate(date[0]);
d.setMonth(month[ date[1] ]);
d.setFullYear(date[2]);
if (now.getTime() - d.getTime() > 7776000000) { // not 90 days
voteNotice('משתמש זה אמנם צבר 100 עריכות אך לא בתוך 90 יום ולכן אין לו זכות הצבעה :-(', false);
return;
}
// user passed all the tests!
voteNotice('למשתמש זה יש זכות הצבעה :-)', true);
} else if (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) {
addLink('p-tb', "/w/index.php?title=%D7%9E%D7%99%D7%95%D7%97%D7%93:Contributions&limit=100&contribs=user&namespace=0&checkvote=yes&target=" + wgTitle, 'זכות הצבעה', 't-uservote', 'הצג רשימת התרומות של משתמש זה', '', document.getElementById('t-blockip') ? 't-blockip' : 't-emailuser');
}
}
$(voteStatus);
// עד כאן סקריפט 13
//
// סקריפט 14: נלקח מ[[ויקיפדיה:סקריפטים/14|כאן]]
// מאפשר לבצע חיפוש תוך שימוש בשמות מרחב מקוצרים מוגדרים מראש. את הרשימה ניתן למצוא [[שיחת ויקיפדיה:סקריפטים/14|כאן]]
// נכתב על ידי [[user:Yonidebest]]
//
function checkSearchInput() {
var shortcuts = new Array(17)
for (var i = 0; i < shortcuts.length; i++)
shortcuts[i] = new Array(2);
shortcuts[0][0] = 'ש:';
shortcuts[0][1] = 'שיחה:';
shortcuts[1][0] = 'ו:';
shortcuts[1][1] = 'ויקיפדיה:';
shortcuts[2][0] = 'שו:';
shortcuts[2][1] = 'שיחת ויקיפדיה:';
shortcuts[3][0] = 'ק:';
shortcuts[3][1] = 'קטגוריה:';
shortcuts[4][0] = 'שק:';
shortcuts[4][1] = 'שיחת קטגוריה:';
shortcuts[5][0] = 'ע:';
shortcuts[5][1] = 'עזרה:';
shortcuts[6][0] = 'שע:';
shortcuts[6][1] = 'שיחת עזרה:';
shortcuts[7][0] = 'מ:';
shortcuts[7][1] = 'משתמש:';
shortcuts[8][0] = 'שמ:';
shortcuts[8][1] = 'שיחת משתמש:';
shortcuts[9][0] = 'פ:';
shortcuts[9][1] = 'פורטל:';
shortcuts[10][0] = 'שפ:';
shortcuts[10][1] = 'שיחת פורטל:';
shortcuts[11][0] = 'מו:';
shortcuts[11][1] = 'מדיה ויקי:';
shortcuts[12][0] = 'שמו:';
shortcuts[12][1] = 'שיחת מדיה ויקי:';
shortcuts[13][0] = 'ת:';
shortcuts[13][1] = 'תמונה:';
shortcuts[14][0] = 'שת:';
shortcuts[14][1] = 'שיחת תמונה:';
shortcuts[15][0] = 'תב:';
shortcuts[15][1] = 'תבנית:';
shortcuts[16][0] = 'שתב:';
shortcuts[16][1] = 'שיחת תבנית:';
text = document.getElementById('searchInput');
var replaceString;
for (i = 0; i < shortcuts.length; i++) {
var rx = new RegExp('^' + shortcuts[i][0]);
text.value = text.value.replace(rx, shortcuts[i][1]);
}
}
function addCheckSearchInput() {
var form = document.getElementById('searchform');
if (!form) return;
form.onsubmit = function(){checkSearchInput();return true;}
}
$(addCheckSearchInput);
// עד כאן סקריפט 14