Foydalanuvchi:AlefZet/monobook.js: Versiyalar orasidagi farq
Kontent oʻchirildi Kontent qoʻshildi
Tahrir izohi yoʻq |
Tahrir izohi yoʻq |
||
Qator 1: | Qator 1: | ||
/* <pre><nowiki> */ |
|||
function choiceSymbol() { |
|||
addSpecialButton(' ʻ ', 'insertSymbol("ʻ")', 'sButtonsStyle', |
|||
'Turned Comma'); |
|||
addSpecialButton(' ʼ ', 'insertSymbol("ʼ")', 'sButtonsStyle', |
|||
'Apostrophe'); |
|||
} |
|||
var searchForm, newSpan, newCaption, newOnClick, newClass; |
|||
function addSpecialButton(pCaption, pAction, pClass, pTitle) { |
|||
searchForm = document.getElementById('searchform'); |
|||
if (searchForm) { |
|||
newSpan = document.createElement('span'); |
|||
newCaption = document.createTextNode(pCaption); |
|||
newSpan.appendChild(newCaption); |
|||
newOnClick = document.createAttribute('onclick'); |
|||
newOnClick.nodeValue = pAction; |
|||
newSpan.setAttributeNode(newOnClick); |
|||
newSpan.title = pTitle; |
|||
newClass = document.createAttribute('class'); |
|||
newClass.nodeValue = pClass; |
|||
newSpan.setAttributeNode(newClass); |
|||
searchForm.appendChild(document.createTextNode(' ')); |
|||
searchForm.appendChild(newSpan); |
|||
} |
|||
} |
|||
function insertSymbol(s) { |
|||
if (document.searchform) |
|||
var sInput = document.searchform.searchInput; |
|||
else { |
|||
// some alternate form? take the first (or second) one we can find |
|||
var Inputs = document.getElementsByName('search'); |
|||
var sInput = Inputs[0]; //[0] - upper field, [1] - lower field |
|||
} |
|||
// IE |
|||
if (navigator.appName == 'Microsoft Internet Explorer' ) { |
|||
sInput.onkeypress.value = sInput.value + s; |
|||
// Mozilla |
|||
} else { |
|||
sInput.value = sInput.value + s; |
|||
} |
|||
sInput.focus(); |
|||
} |
|||
hookEvent("load", choiceSymbol); |
|||
/* </nowiki></pre> */ |