משתמש:ירון/monobook.js
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
- אופרה: ללחוץ על Ctrl-F5.
//
// סקריפט 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
//
// סקריפט 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
//
// סקריפט 15: מתוך [[ויקיפדיה:סקריפטים/15]]
// מוסיף קישור "הסר" תחת הכותרת "קישורי תמונות" בדפי תמונה. לחיצה על הקישור תסיר את התמונה מהערך. עובד ב-IE בלבד.
// created by [[user:Yonidebest]]
//
function addRemoveImageLinks() {
// add the link to image pages
if (wgNamespaceNumber == 6 && wgAction == 'view') {
var ul = document.getElementById('filelinks').nextSibling.nextSibling;
if (!ul) return;
var lis = ul.getElementsByTagName('LI');
for (var i = 0; i < lis.length; i++) {
link = document.createElement('A');
link.href = '/w/index.php?title=' + lis[i].childNodes[0].title + '&action=edit&removeimage=yes&name=' + encodeURIComponent(wgTitle);
link.appendChild(document.createTextNode('הסר'));
lis[i].appendChild(document.createTextNode(' ('));
lis[i].appendChild(link);
lis[i].appendChild(document.createTextNode(')'));
}
}
// remove image and save
if (getParamValue('removeimage') == 'yes') {
var imageName = decodeURIComponent(getParamValue('name'));
if (imageName) {
var rx = new RegExp('\\[\\[\\s?:?(תמונה|image)\\s?:\\s?(' + imageName + '|' + imageName.replace(' ', '_') + ')([^\\[]|\\[\\[[^\\]]*\\]\\])*\\]\\]', 'ig');
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(rx, '');
document.editform.wpSummary.value = 'הסרת [[תמונה:' + imageName + ']]';
document.editform.wpSave.click();
}
}
}
$(addRemoveImageLinks);
// עד כאן סקריפט 15
function FACarch(){
divFAC=document.getElementById('FACarchive');
if(divFAC!=null){
divFAC.innerHTML+='<a href=\"http://he.wikipedia.org/w/index.php?title=' + wgPageName + '/הצעת_הוספה_למומלצים&action=edit&FAarhcive=yes\">לארכב!</a>';
}
if(location.href.indexOf("action=edit&FAarhcive=yes") > -1) document.editform.wpTextbox1.value+='הועבר מ[[ויקיפדיה:ערכים מומלצים/הוספה למומלצים]] ~~' + '~~'+'~';
}
addLoadEvent(FACarch);
importUserScript(29);