МедиаВики:Search.js

Викикитап, ачык эчтәлекле китаплар җыентыгыннан

Искәрмә: Мөгаен, үзгәрүләрне күрер өчен сезгә үзгәртүләр ясаганнан соң браузерыгызның кэшын чистартырга туры килер.

  • Firefox / Safari: Shift төймәсенә басып торып, кораллар панеленда Яңартырга дигәненә яки Ctrl+F5 яисә Ctrl+R (Macта ⌘+R) дигәненә басыгыз
  • Google Chrome: Ctrl+Shift+R (Macта ⌘+Shift+R) басыгыз
  • Internet Explorer / Edge: Ctrl басып тотып, Яңартырга дигәненә басыгыз, яки Ctrl+F5 басыгыз
  • Opera: басыгыз Ctrl+F5.
function searchPage() {
 var searchEngines = {
  'Эчке эзләү': false,
  'Wikiwix': 'http://ru.wikiwix.com/?action=%s&disp=article',
  'Google': 'http://www.google.com/custom?q=%s&hl=ru&domains=tt.wikipedia.org&sitesearch=tt.wikipedia.org',
  'Yahoo': 'http://search.yahoo.com/search?p=%s&vs=tt.wikipedia.org',
  'Яндекс': 'http://yandex.ru/yandsearch?text=%s&site=tt.wikipedia.org&site_manually=true&ras=1'
  }
 createOption = function(site, engine) {
   var opt = document.createElement('option')
   opt.appendChild(document.createTextNode(site))
   opt.value = site
   return opt
 }
 var searchForm = document.forms['search'] || document.forms['powersearch']
 if (searchForm.fulltext) searchForm.fulltext.value = 'Найти'
 submit = function() {
   var optSelected = searchEngines[document.getElementById('searchEngine').value]
   if (optSelected) {
     searchInput = document.getElementById('searchText') || document.getElementById('powerSearchText')
     window.location = optSelected.replace(/%s/g, encodeURIComponent(searchInput.value))
     return false
   }
 }
 if (navigator.appName == 'Microsoft Internet Explorer') addHandler(searchForm, 'submit', submit)
 else searchForm.onsubmit = submit
 var selectBox = document.createElement('select')
 selectBox.id = 'searchEngine'
 for (var se in searchEngines)
    selectBox.appendChild(createOption(se, searchEngines[se]))
 searchInput = document.getElementById('searchText') || document.getElementById('powerSearchText')
 searchInput.parentNode.insertBefore(selectBox, searchInput.nextSibling)
}
 
$(searchPage)