משתמש:Yonidebest/monobook.js/dashfixer.js
מתוך ויקיפדיה, האנציקלופדיה החופשית
הערה: לאחר השמירה, עליכם לנקות את זכרון המטמון (Cache) של הדפדפן על־מנת להבחין בשינויים.
- במוזילה, פיירפוקס או ספארי, לחצו על מקש ה־Shift בעת לחיצתכם על העלה מחדש (Reload), או הקישו Ctrl+Shift+R (או Cmd+Shift+R במקינטוש של אפל).
- באינטרנט אקספלורר, לחצו על מקש ה־Ctrl בעת לחיצתכם על רענן (Refresh), או הקישו על Ctrl+F5.
- ב־Konqueror, פשוט לחצו על העלה מחדש (Reload), או הקישו על F5.
- באופרה, ייתכן שתצטרכו להשתמש בכלים (Tools) > העדפות (Preferences) כדי לנקות לחלוטין את זכרון המטמון.
/* <div style="direction: ltr;"><pre><nowiki> */
/* This code is based on [[:en:User:Omegatron/monobook.js/dashfixer.js]] */
function replacedash(pageType) {
switch(pageType)
{
case "editPage":
var txt = document.editform.wpTextbox1;
break;
case "movePage":
moveEl = document.getElementById('movepage');
var txt = moveEl.wpNewTitle;
break;
case "goPage":
goEl = document.getElementById('searchform');
var txt = goEl.search;
break;
}
// Convert --– dashes with or without spaces --> en dash with or without spaces
txt.value = txt.value.replace(/( | )?(---)( | )?/g, '$1–$3');
// Convert -- without spaces --> Hebrew dash without spaces
txt.value = txt.value.replace(/(^[\!\<\>])(--)(^[\!\<\>])/g, '$1־$3');
return(true);
}
/* This code is based on [[:משתמש:ערן/monobook.js]] */
function MikufLoad()
{
/* saveButton = document.getElementById('wpSave');
if (saveButton != null) {
saveButton.onclick = function(){replacedash("editPage");return true;}
} */
previewButton = document.getElementById('wpPreview');
if (previewButton != null) {
previewButton.onclick = function(){replacedash("editPage");return true;}
}
moveButton = document.getElementById('wpMove');
if (moveButton != null) {
moveButton.onclick = function(){replacedash("movePage");return true;}
}
goButton = document.getElementById('searchGoButton');
if (goButton != null) {
goButton.onclick = function(){replacedash("goPage");return true;}
}
}
addLoadEvent(MikufLoad);
/* </nowiki></pre></div> */

