לדלג לתוכן

מדיה ויקי:Gadget-toggleRCOptions.js

מתוך צפונות ויקי
גרסה מ־22:07, 30 בספטמבר 2007 מאת wikipedia:he>Yonidebest (דף חדש: // // // Created by user:Yonidebest function findText() { var findThisRx = new RegExp(document.getElementById('fromReplace').value, 'g'); var foundIndex = document.editform.wpTex...)
(הבדל) → הגרסה הקודמת | הגרסה האחרונה (הבדל) | הגרסה הבאה ← (הבדל)

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

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
//
//
// Created by [[user:Yonidebest]]

function findText() {
 var findThisRx = new RegExp(document.getElementById('fromReplace').value, 'g');
 var foundIndex = document.editform.wpTextbox1.value.search(findThisRx);
 var statusFind = document.getElementById('statusFind');
 if (foundIndex != -1) {
   document.editform.wpTextbox1.value = tempText;
   statusFind.innerHTML = 'בוצע!';
 } else statusFind.innerHTML = 'לא נמצאו מופעים.';
}

function toggleFindText() {
 var divBoxFind = document.getElementById('divFind');
 var aFind = document.getElementById('aFind');
 if (divBoxFind.style.display == 'none') {
   divBoxFind.style.display = 'block';
   aFind.innerHTML = '[הסתר]';
 } else {
   divBoxFind.style.display = 'none';
   aFind.innerHTML = 'בצע החלפה';
 }
}

function addFindText() {
 var toolbar = document.getElementById('toolbar');
 if (!toolbar) return;

 var iFind = document.createElement('<INPUT ID="findInput"></INPUT>');
 iFind.type = 'text';
 iFind.onchange = function() {javascript:document.getElementById("statusReplace").innerHTML = "מחכה.";};
 var submitFind = document.createElement('A');
 submitFind.href = 'javascript:findText();';
 submitFind.appendChild(document.createTextNode('חפש'));
 var statusFind = document.createElement('<SPAN ID="statusFind"></SPAN>');
 statusFind.appendChild(document.createTextNode('מחכה.'));

 var divBoxFind = document.createElement('<DIV ID="divFind"></DIV>');
 divBoxFind.appendChild(document.createTextNode('חפש את '));
 divBoxFind.appendChild(iFind);
 divBoxFind.appendChild(document.createTextNode(' '));
 divBoxFind.appendChild(submitFind);
 divBoxFind.appendChild(document.createTextNode(' | סטטוס: '));
 divBoxFind.appendChild(statusFind);
 divBoxFind.appendChild(document.createElement('BR'));
 
 var aFind = document.createElement('<A ID="aFind"></A>');
 aFind.href = 'javascript:toggleFindText();';
 aFind.appendChild(document.createTextNode('חפש'));

 toolbar.appendChild(aFind);
 toolbar.appendChild(document.createTextNode(' '));
 toolbar.appendChild(divBoxFind);
 toggleFindText();
}

addOnloadHook(addReplaceText);