מדיה ויקי:Gadget-ShortNSSearch.js
מתוך ויקיציטוט, מאגר הציטוטים החופשי.
הערה: לאחר השמירה, עליכם לנקות את זכרון המטמון (Cache) של הדפדפן על־מנת להבחין בשינויים.
- במוזילה, בפיירפוקס או בספארי, לחצו על מקש ה־Shift בעת לחיצתכם על העלה מחדש (Reload), או הקישו Ctrl+Shift+R (או Cmd+Shift+R במקינטוש של אפל).
- באינטרנט אקספלורר, לחצו על מקש ה־Ctrl בעת לחיצתכם על רענן (Refresh), או הקישו על Ctrl+F5.
- ב־Konqueror, לחצו על העלה מחדש (Reload), או הקישו על F5.
- באופרה, ייתכן שתצטרכו להשתמש בכלים (Tools) > העדפות (Preferences) כדי לנקות לחלוטין את זכרון המטמון.
// מועתק מ[[w:ויקיפדיה:סקריפטים/14]] // מאפשר לבצע חיפוש תוך שימוש בשמות מרחב מקוצרים מוגדרים מראש. את הרשימה ניתן למצוא [[שיחת מדיה ויקי:Gadget-ShortNSSearch]] // נכתב על ידי [[user:Yonidebest]] // function checkSearchInput() { var shortcuts = new Array(19) 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] = 'מיוחד:Contributions/'; shortcuts[18][0] = 'ד:'; shortcuts[18][1] = 'מיוחד:'; 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 = 'http://he.wikiquote.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 = 'http://he.wikiquote.org/w/index.php?title=' + text.value + '&action=history'; 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();} } addOnloadHook(addCheckSearchInput);