|
|
| שורה 3: |
שורה 3: |
| // Created by [[user:Yonidebest]] | | // Created by [[user:Yonidebest]] |
|
| |
|
| function showFound(text, index) { | | function toggleRCOptions() { |
| /*
| | var rcFieldset = document.getElementsByTagName('fieldset')[0]; |
| //save window scroll position
| | var rcLink = document.getElementById('arcoptions'); |
| if (document.documentElement && document.documentElement.scrollTop) | | |
| var winScroll = document.documentElement.scrollTop
| | if (rcFieldset.style.display == 'none') { // show content |
| else if (document.body)
| | rcFieldset.style.display = 'block'; |
| var winScroll = document.body.scrollTop;
| | rcLink.innerHTML = 'הסתר אפשרויות'; |
| */
| |
| | |
| // select range
| |
| var range = document.editform.wpTextbox1.createTextRange(); | |
| range.moveStart('textedit');
| |
| range.moveStart('character', - (document.editform.wpTextbox1.value.length - index));
| |
| range.moveEnd('textedit');
| |
| range.moveEnd('character', - (document.editform.wpTextbox1.value.length - index - text.length));
| |
| range.select();
| |
| range.scrollIntoView(false); | |
| document.editform.wpTextbox1.focus();
| |
| | |
| /*
| |
| //restore window scroll position
| |
| if (document.documentElement && document.documentElement.scrollTop) | |
| document.documentElement.scrollTop = winScroll
| |
| else if (document.body)
| |
| document.body.scrollTop = winScroll;
| |
| */
| |
| }
| |
| | |
| function findText() {
| |
| // clear Select object
| |
| var results = document.getElementById('foundResults');
| |
| while (results.length > 0)
| |
| results.remove(0);
| |
| | |
| // find text and add to select object
| |
| var fromIndex = 0;
| |
| var counter = 0;
| |
| var findThis = document.getElementById('findInput').value;
| |
| while (fromIndex != -1) {
| |
| var foundIndex = document.editform.wpTextbox1.value.indexOf(findThis, fromIndex); | |
| if (foundIndex != -1 && counter <= 100) {
| |
| counter++;
| |
| var option = document.createElement('OPTION');
| |
| option.text = 'תוצאה ' + counter;
| |
| option.title = findThis;
| |
| option.value = foundIndex;
| |
| results.add(option);
| |
| fromIndex = foundIndex + findThis.length;
| |
| } else { | |
| var option = document.createElement('OPTION');
| |
| option.title = foundIndex;
| |
| option.disabled = true;
| |
| if (results.length != 0) {
| |
| option.text = 'נמצאו ' + counter + ' תוצאות.';
| |
| results.add(option, 0);
| |
| } else {
| |
| option.text = 'לא נמצאות תוצאות.';
| |
| results.add(option);
| |
| }
| |
| break;
| |
| }
| |
| } | | } |
| results.selectedIndex = 0; | | else { // hide content |
| }
| | rcFieldset.style.display = 'none'; |
| | | rcLink.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() { | | function hideShowRCOptions() { |
| var toolbar = document.getElementById('toolbar');
| | if (wgCanonicalSpecialPageName != 'Recentchanges') return; |
| 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 foundResults = document.createElement('<SELECT ID="foundResults"></SELECT>');
| |
| var option = document.createElement('OPTION');
| |
| option.text = 'מחכה...';
| |
| option.disabled = true;
| |
| foundResults.onchange = function() { showFound(this[this.selectedIndex].title,this[this.selectedIndex].value);return false; };
| |
| foundResults.add(option);
| |
| | |
| 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(foundResults);
| |
| divBoxFind.appendChild(document.createElement('BR'));
| |
|
| |
| var aFind = document.createElement('<A ID="aFind"></A>');
| |
| aFind.href = 'javascript:toggleFindText();';
| |
| aFind.appendChild(document.createTextNode('חפש'));
| |
|
| |
|
| toolbar.appendChild(aFind); | | var rcFieldset = document.getElementsByTagName('fieldset')[0]; |
| toolbar.appendChild(document.createTextNode(' ')); | | try { // for IE |
| toolbar.appendChild(divBoxFind); | | var rcLink = document.createElement('<A ID="arcoptions"></DIV>'); |
| toggleFindText(); | | } catch (e) { // for FF |
| | var rcLink = document.createElement('DIV'); |
| | rcLink.id = 'arcoptions'; |
| | }; |
| | rcLink.appendChild(document.createTextNode('הסתר אפשרויות')); |
| | rcLink.href = 'javascript:toggleRCOptions();'; |
| | rcFieldset.parentNode.insertBefore(aLink1, rcFieldset); |
| | toggleRCOptions(); |
| } | | } |
|
| |
|
| //addOnloadHook(addFindText);
| | addOnloadHook(hideShowRCOptions); |
//
//
// Created by [[user:Yonidebest]]
function toggleRCOptions() {
var rcFieldset = document.getElementsByTagName('fieldset')[0];
var rcLink = document.getElementById('arcoptions');
if (rcFieldset.style.display == 'none') { // show content
rcFieldset.style.display = 'block';
rcLink.innerHTML = 'הסתר אפשרויות';
}
else { // hide content
rcFieldset.style.display = 'none';
rcLink.innerHTML = 'הצג אפשרויות';
}
}
function hideShowRCOptions() {
if (wgCanonicalSpecialPageName != 'Recentchanges') return;
var rcFieldset = document.getElementsByTagName('fieldset')[0];
try { // for IE
var rcLink = document.createElement('<A ID="arcoptions"></DIV>');
} catch (e) { // for FF
var rcLink = document.createElement('DIV');
rcLink.id = 'arcoptions';
};
rcLink.appendChild(document.createTextNode('הסתר אפשרויות'));
rcLink.href = 'javascript:toggleRCOptions();';
rcFieldset.parentNode.insertBefore(aLink1, rcFieldset);
toggleRCOptions();
}
addOnloadHook(hideShowRCOptions);