میدیاویکی:Gadget-ShortNSSearch.js
//لە ویکیپیدیای عەرەبییەوە وەرگیراوە
// [[he:MediaWiki:Gadget-ShortNSSearch.js]]
function checkSearchInput() {
var shortcuts = new Array(23)
for (var i = 0; i < shortcuts.length; i++)
shortcuts[i] = new Array(2);
shortcuts[0][0] = 'و:';
shortcuts[0][1] = 'وتووێژ:';
shortcuts[1][0] = 'وپ:';
shortcuts[1][1] = 'ویکیپیدیا:';
shortcuts[2][0] = 'لو:';
shortcuts[2][1] = 'لێدوانی ویکیپیدیا:';
shortcuts[3][0] = 'پۆ:';
shortcuts[3][1] = 'پۆل:';
shortcuts[4][0] = 'وپۆ:';
shortcuts[4][1] = 'وتووێژی پۆل:';
shortcuts[5][0] = 'ی:';
shortcuts[5][1] = 'یارمەتی:';
shortcuts[6][0] = 'وی:';
shortcuts[6][1] = 'وتووێژی یارمەتی:';
shortcuts[7][0] = 'ب:';
shortcuts[7][1] = 'بەکارھێنەر:';
shortcuts[8][0] = 'لب:';
shortcuts[8][1] = 'لێدوانی بەکارھێنەر:';
shortcuts[9][0] = 'دو:';
shortcuts[9][1] = 'دەروازە:';
shortcuts[10][0] = 'لد:';
shortcuts[10][1] = 'لێدوانی دەروازە:';
shortcuts[11][0] = 'مو:';
shortcuts[11][1] = 'میدیاویکی:';
shortcuts[12][0] = 'وم:';
shortcuts[12][1] = 'وتووێژی میدیاویکی:';
shortcuts[13][0] = 'پ:';
shortcuts[13][1] = 'پەڕگە:';
shortcuts[14][0] = 'وپە:';
shortcuts[14][1] = 'وتووێژی پەڕگە:';
shortcuts[15][0] = 'د:';
shortcuts[15][1] = 'داڕێژە:';
shortcuts[16][0] = 'ود:';
shortcuts[16][1] = 'وتووێژی داڕێژە:';
shortcuts[17][0] = 'بب:';
shortcuts[17][1] = 'تایبەت:بەشدارییەکان/';
shortcuts[18][0] = 'ت:';
shortcuts[18][1] = 'تایبەت:';
shortcuts[19][0] = 'م:';
shortcuts[19][1] = 'مۆدیوول:';
shortcuts[20][0] = 'لم:';
shortcuts[20][1] = 'لێدوانی مۆدیوول:';
shortcuts[21][0] = ':';
shortcuts[21][1] = '';
shortcuts[22][0] = 'ئینگ:';
shortcuts[22][1] = 'en:';
text = document.getElementById('searchInput');
for (i = 0; i < shortcuts.length; i++) {
var rxEdit = new RegExp('^س' + shortcuts[i][0]);
if (rxEdit.test(text.value)) {
text.value = text.value.replace(rxEdit, shortcuts[i][1]);
document.location = '//ckb.wikipedia.org/w/index.php?title=' + text.value + '&action=edit';
return false;
}
var rxHistory = new RegExp('^ژ' + shortcuts[i][0]);
if (rxHistory.test(text.value)) {
text.value = text.value.replace(rxHistory, shortcuts[i][1]);
document.location = '//ckb.wikipedia.org/w/index.php?title=' + text.value + '&action=history';
return false;
}
var rxRedir = new RegExp('^گ' + shortcuts[i][0]);
if (rxRedir.test(text.value)) {
text.value = text.value.replace(rxRedir, shortcuts[i][1]);
document.location = '//ckb.wikipedia.org/w/index.php?title=' + text.value + '&action=edit&preload=Mediawiki:Gadget-ShortNSSearch.js/preloadredir&preloadparams[]=' + mw.config.get('wgTitle');
return false;
}
var rxNew = new RegExp('^:' + shortcuts[i][0]);
if (rxNew.test(text.value)) {
text.value = text.value.replace(rxNew, shortcuts[i][1]);
document.location = '//ckb.wikipedia.org/w/index.php?title=' + text.value + '&action=edit&preload=Mediawiki:Gadget-ShortNSSearch.js/preload&preloadparams[]=' + mw.config.get('wgContentLanguage') + '&preloadparams[]=' + mw.config.get('wgTitle');
return false;
}
}
for (i = 0; i < shortcuts.length; i++) {
var rx = new RegExp('^' + shortcuts[i][0]);
text.value = text.value.replace(rx, shortcuts[i][1]);
}
return true;
}
function addCheckSearchInput() {
var form = document.getElementById('searchform');
if (!form) return;
form.onsubmit = function(){return checkSearchInput();}
}
$(addCheckSearchInput);
Text is available under the CC BY-SA 4.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.