User:Bolatbek/vector.js

function wgImg(img){ return /^http:/i.test(img) ? img : 'http://upload.wikimedia.org/wikipedia/'+img } mwCustomEditButtons['wikif'] = [function{Wikify}, 'commons/0/06/Wikify-toolbutton.png', 'Викификатор — автоматический обработчик текста'] var _cnt if ($.wikiEditor){ appendCSS('#local-toolbar {height:26px; border-right:1px solid #ddd;\ margin:3px; padding-right:6px} #local-toolbar img {padding:2px}') _cnt = '#wikiEditor-ui-toolbar' }else if (document.getElementById('toolbar')){ _cnt = '#toolbar' importMW('ToolbarOld') }else{ //no toolbar _cnt = '#editform' appendCSS('#local-toolbar img {border:1px outset gray; background:#ddd; margin:2px; height:22px}') }

addOnloadHook(function{ //attach local toolbar $(' ') .prependTo(_cnt) //attach local buttons for (var id in mwCustomEditButtons){   var b = mwCustomEditButtons[id]   if (!b.length) continue     attachFuncBtn(id, b[0], b[1], b[2]) }  })

function attachFuncBtn(id, func, img, tip){ $('') .appendTo('#local-toolbar') .click(func) }

attachFuncBtn(id, func, img, tip)

function searchPage { var searchEngines = { 'Ішкі ізденіс': false, 'Google': 'http://www.google.com/custom?q=%s&hl=ru&domains=ru.wikipedia.org&sitesearch=ru.wikipedia.org', 'Kazakh Wiki': 'http://kk.wikipedia.org/w/index.php?title=Арнайы:Іздеу&redirs=1&search=%s&fulltext=Search&ns0=1', 'Russian Wiki': 'http://ru.wikipedia.org/w/index.php?title=Special:Search&redirs=1&search=%s&fulltext=Search&ns0=1' } createOption = function(site, engine) { var opt = document.createElement('option') opt.appendChild(document.createTextNode(site)) opt.value = site return opt } var searchForm2 = document.forms['search'] || document.forms['powersearch'] if (searchForm2.fulltext) searchForm2.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(searchForm2, 'submit', submit) else searchForm2.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) } addOnloadHook(searchPage)

//main if (wgPageName == 'Main_Page') { $(function {        mw.util.addPortletLink('p-lang', 'http://kk.wikipedia.org/wiki/Басты_бет', 'Қазақша', 'interwiki-completelist', '');   }); }