משתמש:Yonidebest/monobook.js/dashfixer.js

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
  • אופרה: ללחוץ על Ctrl-F5.
/* This code is based on [[:en:User:Omegatron/monobook.js/dashfixer.js]]. Edited by [[:he:user:ערן]] and [[user:Yonidebest]]  */
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 ־ without spaces to Hebrew dash without spaces
 txt.value = txt.value.replace(/([^!<>\- ])(--)([^!<>\- ])/g, '$1־$3');

 return(true);
}

function initReplaceDash()
{
 saveButton = document.getElementById('wpSave');
 if (saveButton)
  saveButton.onclick = function() {replaceDash("editPage");return true;}
 previewButton = document.getElementById('wpPreview');
 if (previewButton)
  previewButton.onclick = function() {replaceDash("editPage");return true;}
 moveButton = document.getElementById('wpMove');
 if (moveButton)
  moveButton.onclick = function() {replaceDash("movePage");return true;}
 goButton = document.getElementById('searchGoButton');
 if (goButton)
  goButton.onclick = function() {replaceDash("goPage");return true;}
}

addLoadEvent(initReplaceDash);
//