MediaWiki:Common.js: Różnice pomiędzy wersjami

Usunięta treść Dodana treść
Stv (dyskusja | edycje)
m dr.
+mała klawiaturka w wyszukiwaniu
Linia 640:
}
addOnloadHook(stripDPLYear);
 
== Small search keyboard ==
; Author: Maciej Jaros [[:pl:User:Nux]]
; Licence: CC-BY or [http://opensource.org/licenses/gpl-license.php GNU General Public License v2]
*/
if (wgCanonicalSpecialPageName == "Search")
{
addOnloadHook(addSearchKeyboards);
}
 
function addSearchKeyboards() {
 
if (document.forms['search'])
addSearchKeyboard(document.forms['search']);
if (document.forms['powersearch'])
addSearchKeyboard(document.forms['powersearch']);
 
}
 
function addSearchKeyboard(searchForm) {
var searchBoxId = 'lsearchbox';
if (!searchForm.lsearchbox) {
if (searchForm.search.id == '') {
searchBoxId = searchForm.name + 'box';
searchForm.search.id = searchBoxId;
} else
searchBoxId = searchForm.search.id;
}
 
var letters = new Array('ą', 'ć', 'ę', 'ł', 'ń', 'ó', 'ś', 'ź', 'ż');
var html = "Klawiaturka: ";
for (var i = 0; i < letters.length; i++) {
html += "<a onclick=\"insertTagsTo_('" + letters[i] + "','','','" + searchBoxId + "');return false\" href=\"#\">" + letters[i] + "</a>";
}
var newEl = document.createElement('div');
newEl.className = 'search_keyboard';
newEl.innerHTML = html;
newEl.style.cssText = 'width:50%; font-size:small; font-weight: bold';
document.getElementById(searchBoxId).parentNode.appendChild(newEl);
}