משתמש:נוי/monobook.js
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
//
// סקריפט 4: לקוח מ[[ויקיפדיה:סקריפטים/4]]
// הסרגל נוסף לתיבת הניווט ומאפשר להגיע לדף המקביל באחד ממיזמי האחות
//
function OthPro()
{
psearch = document.getElementById('p-search');
if (psearch != null) {
url="http://he.wikipedia.org/wiki/"+wgPageName // על מנת לאפשר את הקישור גם מתוך מסך עריכה
wiktlink=""+url;
wiktlink=wiktlink.replace("wikipedia","wiktionary");
wiktlink=wiktlink.replace("ויקיפדיה:","ויקימילון:");
wikqlink=""+url;
wikqlink=wikqlink.replace("wikipedia","wikiquote");
wikqlink=wikqlink.replace("ויקיפדיה:","ויקיציטוט:");
wikblink=""+url;
wikblink=wikblink.replace("wikipedia","wikibooks");
wikblink=wikblink.replace("ויקיפדיה:","ויקיספר:");
wikslink=""+url;
wikslink=wikslink.replace("wikipedia","wikisource");
wikslink=wikslink.replace("ויקיפדיה:","ויקיטקסט:");
visualPageName = wgPageName.replace(/_/g, " ");
list = '<div class="portlet" id="p-otherwikis">\n<h5><label>מיזמי אחות</label></h5>\n<div class="pBody"><ul style="text-align: right;"><li><a href="'+wiktlink+'" title="'+visualPageName+' בוויקימילון">ויקימילון</a></li>\n<li><a href="'+wikqlink+'" title="'+visualPageName+' בוויקיציטוט">ויקיציטוט</a></li>\n<li><a href="'+wikblink+'" title="'+visualPageName+' בוויקיספר">ויקיספר</a></li>\n<li><a href="'+wikslink+'" title="'+visualPageName+' בוויקיטקסט">ויקיטקסט</a></li></ul>\n</div>\n</div>';
psearch.innerHTML = psearch.innerHTML + "<br clear=all />" + list;
}
}
addLoadEvent(OthPro);
// עד כאן סקריפט 4
//
// סקריפט 22: מתוך [[ויקיפדיה:סקריפטים/22]]
// מוסיף קישור "ארכוב" מתחת לתיבת הכלים (בדף השמתמש שלך בלבד)
// נכתב על ידי [[User:Yonidebest]]
//
var defualtPrefixArchive = 'ארכיון ';
// load the talk page in edit mode
function archiveUserPageStage1() {
var archivename = document.getElementById('archivename').value;
var numberoftalks = document.getElementById('numberoftalks').value;
if (!archivename || archivename == '') {
alert("יש למלא את שם הארכיון.");
return;
}
if (!numberoftalks || numberoftalks == '') numberoftalks = 'all';
document.location = 'http://he.wikipedia.org/w/index.php?title=User Talk:' + encodeURIComponent(wgUserName) + '&action=edit&archivestage=2&archivename=' + encodeURIComponent(archivename) + '&numberoftalks=' + numberoftalks;
}
// remove the text that needs to be archived and send it to new window.
function archiveUserPageStage2() {
if (getParamValue('archivestage') != '2') return;
var numberoftalks = getParamValue('numberoftalks');
var tempText = document.editform.wpTextbox1.value;
var rx = new RegExp('[^=]==[^=]*==[^=]', 'g');
var m;
// find the first section
m = rx.exec(tempText);
var firstSectionIndex = m.index;
// find the last section to archive
var lastSectionIndex;
if (numberoftalks == 'all')
lastSectionIndex = tempText.length - 1;
else {
var numberOfSections = 0;
while (numberOfSections < numberoftalks) {
m = rx.exec(tempText);
if (m) {
numberOfSections++;
lastSectionIndex = m.index;
} else {
lastSectionIndex = tempText.length - 1;
break;
}
}
}
// get archiveText, load archive and save this page
var archiveText = tempText.substring(firstSectionIndex, lastSectionIndex);
var prefixArchive = (defualtPrefixArchive && defualtPrefixArchive != '') ? encodeURIComponent(defualtPrefixArchive) : '';
var url = 'http://he.wikipedia.org/w/index.php?title=User Talk:' + encodeURIComponent(wgUserName) + '/' + prefixArchive + getParamValue('archivename') + '&action=edit&archivestage=3';
archiveWindow = window.open(url, '_blank');
while (archiveWindow.title != 'מארכב את דף השיחה...') { }
archiveWindow.editform.wpTextbox1.value += '\n' + archiveText;
archiveWindow.editform.wpSummary.value = 'ארכוב אוטומטי';
archiveWindow.editform.wpSave.click();
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(archiveText, "");
document.editform.wpSummary.value = 'ארכוב אוטומטי';
document.editform.wpSave.click();
}
// save the archive page
function archiveUserPageStage3() {
if (getParamValue('archivestage') != '3') return;
window.title = 'מארכב את דף השיחה...';
}
function navArchiveToggle() {
var divBody = document.getElementById('p-archiveBody1');
if (divBody.style.display == 'none') // show content
divBody.style.display = 'block';
else { // hide content
divBody.style.display = 'none';
}
}
function initArchiveUserPage() {
if (wgNamespaceNumber != 3 || wgUserName != wgTitle) return;
var navArchiveMain = document.createElement('DIV');
navArchiveMain.className = 'portlet';
var h5ArchiveTitle = document.createElement('H5');
var aLink = document.createElement('A');
aLink.appendChild(document.createTextNode('ארכוב'));
aLink.href = 'javascript:navArchiveToggle();';
h5ArchiveTitle.appendChild(aLink);
navArchiveMain.appendChild(h5ArchiveTitle);
try { // for IE
var divArchiveBody = document.createElement('<DIV ID="p-archiveBody1"></DIV>');
} catch (e) { // for FF
var divArchiveBody = document.createElement('DIV');
divArchiveBody.id = 'p-archiveBody1';
};
divArchiveBody.className = 'pBody';
divArchiveBody.style.padding = '5px';
divArchiveBody.innerHTML = 'שם הארכיון:<br /><input id="archivename" type="text" size="15" /><br />מספר השיחות לארכוב:<br /><input id="numberoftalks" type="text" size="15" /><br /><a href="javascript:archiveUserPageStage1()" title="ארכב עכשיו">ארכב עכשיו</a>';
navArchiveMain.appendChild(divArchiveBody);
var pToolBox = document.getElementById('p-tb');
pToolBox.parentNode.appendChild(navArchiveMain);
navArchiveToggle();
}
$(initArchiveUserPage);
$(archiveUserPageStage2);
$(archiveUserPageStage3);
// עד כאן סקריפט 22
//
// סקריפט 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
$(templateSC_onload);
// script written by [[User:Yonidebest]]
function wikiCalc() {
var psearch = document.getElementById('p-search');
var txt = '</div><div id="p-search1" class="portlet"><h5><label for="calcInput">מחשבון ויקי</label></h5><div id="wikiCalc" class="pBody"><form name="createbox" action="/w/index.php" method="get" class="createbox" id="createbox"><p><input type="hidden" name="action" value="edit" /><input type="hidden" name="preload" value="משתמש:דניאל ב./מחשבון ויקי/2" /><input type="hidden" name="editintro" value="משתמש:דניאל ב./מחשבון ויקי/1" /></p><p><input id="calcInput" class="createboxInput" name="title" type="text" value="" size="16" /><br /><input type="submit" name="create" class="createboxButton" value="חשב" /></p></form></div>';
psearch.innerHTML += txt;
}
$(wikiCalc);