משתמש:דוד נ. דוד/monobook.js
מראה
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
//
// סקריפט 5: לקוח מ[[ויקיפדיה:סקריפטים/5]]
// פונקציה להוספת רשימת אזהרות כשעורכים דף שיחה של אנונימי
// created by [[user:ערן]]
//
function talkIPTool() {
var title = (document.title.substr(0, document.title.lastIndexOf(" - ")));
templatesList=document.getElementById('edit-templates');
if(templatesList==null) templatesList=document.getElementById('editing-warn');
if(templatesList!=null && title.indexOf('.')!=title.lastIndexOf('.')){
warList='אזהרות: <select onchange="document.editform.wpSummary.value+=this[selectedIndex].title; document.editform.wpTextbox1.value += \'{{ס:\' + this[selectedIndex].title + \'}} ~~\' + \'~~\';this.selectedIndex=0;">';
warList += '<option title="">בחרו מהרשימה כדי להוסיף</option>'
warList += '<option title="אזהרה">אזהרה</option>'
warList += '<option title="הבל">הבל</option>'
warList += '<option title="הזמנה">הזמנה</option>'
warList += '<option title="ניסויים">ניסויים</option>'
warList += '<option title="תודה">תודה</option>'
warList += '<option title="ויקיזציה">ויקיזציה</option>'
warList += '<option title="לך">לך</option>'
warList += '<option title="תלונה">תלונה</option>'
warList += '<option title="טעות">טעות</option>'
warList += '<option title="נייטרליות">נייטרליות</option>'
warList += '<option title="נחסמת">נחסמת</option>'
warList += '<option title="מילון">מילון</option>'
warList += '<option title="כבר קיים">כבר קיים</option>'
warList += '<option title="שגיאה" >שגיאה</option>'
warList += '<option title="העתקה">העתקה</option>'
warList += '<option title="פרסומת">פרסומת</option>'
warList += '<option title="נמחק">נמחק</option>'
warList += '<option title="הסבר">הסבר</option>'
warList += '<option title="בוטל">בוטל</option>'
warList += '<option title="סגנון">סגנון</option>'
warList += '</select>'
templatesList.innerHTML=warList+templatesList.innerHTML;
}
}
addLoadEvent(talkIPTool);
// עד כאן סקריפט 5
//
// סקריפט 13: לקוח מ[[ויקיפדיה:סקריפטים/13]]
// קוד הבודק האם למשתמש יש זכות הצבעה. הקוד כולל שתי קישורים: אחד לבדיקת הצבעה (100 עריכות בתוך 90 ימים), אחד לבדיקת הוותק (30 יום).
// שימו לב: הסקריפט אינו סופר מרחבים משיקים למרחב הראשי ועל כן הוא אינו מדויק. עדיף להסתמך על בוט זכות הצבעות או על ספירה ידנית.
// נכתב על ידי [[משתמש: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")) {
var li = document.getElementById('bodyContent').getElementsByTagName('ul')[0].getElementsByTagName('li');
// get date of last edit in list
var rawDate = li[li.length - 1].innerHTML.substring(7, li[li.length - 1].innerHTML.indexOf('(') - 1);
var date = rawDate.split(' ');
var now = new Date();
var d = new Date();
var month = {
'בינואר': '0',
'בפברואר': '1',
'במרץ': '2',
'באפריל': '3',
'במאי': '4',
'ביוני': '5',
'ביולי': '6',
'באוגוסט': '7',
'בספטמבר': '8',
'באוקטובר': '9',
'בנובמבר': '10',
'בדצמבר': '11'
}
d.setDate(date[0]);
d.setMonth(month[ date[1] ]);
d.setFullYear(date[2]);
if (getParamValue("checkvote") == "contrib") { // check contributions
// check if user has 100 edits
if (document.getElementById('bodyContent').innerHTML.indexOf('>100 הקודמות<') == -1 && li.length != 100) { // not enough edits
voteNotice('למשתמש זה יש ' + li.length + ' עריכות בלבד ולכן אין לו זכות הצבעה :-(', false);
return;
}
// check 90 days
if (now.getTime() - d.getTime() > 7776000000) { // more than 90 days
voteNotice('משתמש זה אמנם צבר 100 עריכות אך לא בתוך 90 יום ולכן אין לו זכות הצבעה :-(', false);
return;
}
// user passed all the tests!
voteNotice('למשתמש זה יש זכות הצבעה :-)', true);
} else { // check seniority
if (now.getTime() - d.getTime() < 2592000000) { // under 30 days
voteNotice('למשתמש אין ותק של 30 יום :-(', false);
return;
}
// user has seniority
voteNotice('למשתמש זה יש ותק של 30 יום :-)', true);
}
} else if ((wgNamespaceNumber == 2 || wgNamespaceNumber == 3) && wgTitle.indexOf('/') == -1) {
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=contrib&target=" + wgTitle, 'זכות הצבעה: תרומות', 't-uservote1', 'בדוק האם למשתמש זה יש 100 עריכות בתוך 90 יום', '', document.getElementById('t-blockip') ? 't-blockip' : 't-emailuser');
addLink('p-tb', "/w/index.php?title=%D7%9E%D7%99%D7%95%D7%97%D7%93:Contributions&dir=prev&contribs=user&limit=1&target=&checkvote=senio&target=" + wgTitle, 'זכות הצבעה: ותק', 't-uservote2', 'בדוק ותק של משתמש זה', '', document.getElementById('t-blockip') ? 't-blockip' : 't-emailuser');
}
}
$(voteStatus);
// עד כאן סקריפט 13
//
// סקריפט 12: לקוח מ[[ויקיפדיה:סקריפטים/12]]
// הקוד מוסיף אפשרות לערוך את ההקדמה של הערך
//
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);
// עד כאן סקריפט 12