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

מתוך ויקיפדיה, האנציקלופדיה החופשית

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

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
  • אופרה: ללחוץ על Ctrl-F5.
/* <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(/( |&nbsp;)?(---)( |&nbsp;)?/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> */