הרחבה:InputBox
| This code base is maintained by the Reader Experience team. Code review only for UBNs or security fixes. |
סטטוס שחרור: גרסה יציבה |
|
|---|---|
| יישום | Tag, Page action, Search |
| Description | מאפשרת למשתמשים להוסיף טפסי HTML מוגדרים מראש לדפי ויקי |
| Author(s) |
|
| Latest version | Continuous updates |
| MediaWiki | >= 1.45 |
| Database changes | No |
| License | MIT License |
| Download | |
|
|
| Translate the InputBox extension if it is available at translatewiki.net | |
| Issues | Open tasks · Report a bug |
הרחבת InputBox (בעברית: "תיבת־קלט") מוסיפה טפסי HTML שנוצרו מראש לדפי ויקי. משתמשים יכולים "להשלים" טופס (להזין טקסט, לבחור פריטי תפריט וכו') על ידי הקלדת טקסט לתוך תיבה.
InputBox נוצרה במקור על ידי Erik Möller במטרה להוסיף תיבת יצירת ערך לוויקיחדשות.
התקנה
- Download and move the extracted
InputBoxfolder to yourextensions/directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/InputBox
- Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'InputBox' );
בוצע – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
דוגמה
תיבה להתחלת ערך חדש.
קוד ויקי
<inputbox>
type = create
width = 30px <!-- with unit of measurement -->
break = no
placeholder = Page title
</inputbox>
תוצאה
תחביר כללי
תיבות קלט נבנות בערך כך:
<inputbox>
type = <!-- <input> type == search search2 create comment commenttitle fulltext move -->
bgcolor = <!-- Background color of parent <form>. -->
width = <!-- Width of text field (searchbox) in 'characters'. Unit: Characters #Default: 50 -->
page = <!-- Wiki pagename (i.e. page title) to post comment to, or move page to. No [[X]]. -->
default = <!-- Initial value of the text field. -->
preloadtitle = <!-- Content to prepopulate the title field with for a new comment -->
preload = <!-- Content to prepopulate the source editor with for a new topic/comment, or new page. -->
editintro = <!-- Wiki pagename of page to be transcluded as 'help text' shown above source editor window. -->
hidden = <!-- Any value will hide the text field, but not buttons whose links will still work. -->
searchbuttonlabel = <!-- Visual label for "Search full text" in type == search == fulltext. -->
searchengine = <!-- Either 'MediaSearch' or 'Search'. Defaults to the wiki's value for the search-special-page preference. -->
searchtype = <!-- If 'MediaSearch' is selected for searchengine, the result type. One of 'image' (default), 'video', 'audio', 'page', or 'other'. -->
fulltextbutton = <!-- Visual label for "Search full text" -->
labeltext = <!-- labeltext -->
break = <!-- break -->
namespaces = <!-- namespaces -->
prefix = <!-- prefix -->
placeholder = <!-- placeholder -->
minor = <!-- minor -->
nosummary = <!-- nosummary -->
summary = <!-- summary -->
id = <!-- id -->
inline = <!-- inline -->
dir = <!-- dir -->
preloadparams[] = <!-- preloadparams[] -->
searchfilter = <!-- searchfilter -->
useve = <!-- useve -->
usedt = <!-- usedt -->
arialabel = <!-- arialabel -->
buttonlabel = <!-- Visual label for primary search button. -->
</inputbox>
Buttons are not exposed to assistive technology: currently the button elements generated by this template have no accessible label. Screen readers therefore announce only the element role (for example, "Button.") rather than a meaningful label. There is no reliable way to add an accessible label without access to the HTML code.
הפרמטר type הוא חובה.
כל שאר הפרמטרים הם אופציונליים.
preloadparams[] יכולים להופיע יותר מפעם אחת.
סוגי תיבות
מיקום ברירת המחדל של כפתור(י) ה־"שליחה" הוא מתחת לתיבת הקלט.
כפתור ה־"שליחה" ניתן להזזה לימין לתיבה באמצעות שימוש בפרמטר שבירת השורה כדי לבטל את השבירה בין התיבה לכפתור: break=no.
Having the “שליחה” button to the right is useful for search boxes when search suggestions would otherwise cover up a search button below the search box.
| סוג | דוגמה | תיאור |
|---|---|---|
search
|
יוצר תיבת חיפוש בעלת רוחב ברירת מחדל של 50 תווים. מידע שמתווסף לתיבת הטקסט מועבר לדף החיפוש. | |
create
|
יוצר דף חדש. המידע שמתווסף לתיבת הטקסט מהווה את השם של הדף שאותו רוצים לערוך. | |
comment
|
מוסיף פסקה חדשה בסוף הדף שצויין בתיבת הטקסט. | |
commenttitle
|
מוסיף פסקה חדשה עם הכותרת שהוזנה בתיבת הטקסט. ניתן לציין את הכותרת עם הפרמטר default=. הדף חייב להיות מצויין בפרמטר page=. For some reason this does NOT work when using the extension by invoking it with {{#tag}}, only when using <inputbox>. (introduced in rev:47203)
| |
fulltext
|
חיפוש רק עם הכפתור לחיפוש טקסט־מלא, ללא כפתור ה־"הצגה". (introduced in rev:45269) | |
move
|
העברת דף לשם אחר. This also doesn't work when creating it by invoking a tag. (introduced in gerrit:97559) |
עבור type=search2, מיקום ברירת המחדל של כפתור החיפוש הוא מימין לתיבה.
נכון לעכשיו לא נראה אפשרי להוסיף פרמטרים אחרים לסוג זה של תיבת טקסט.
תיבת הטקסט הזאת מחפשת בכל אתר הוויקי שבו היא ממוקמת.
| סוג | דוגמה |
|---|---|
search2
|
פרמטרים
| פרמטר | תיאור | Scope | תוצאה | דוגמה | תאימות | |
|---|---|---|---|---|---|---|
arialabel=
|
Supply the aria-label attribute to the InputBox to ensure generated markup is accessible to screen readers. See ARIA: aria-label attribute. | All types | <inputbox>
type=search
arialabel=Search the wiki
</inputbox>
|
| ||
bgcolor=
|
מגדיר את צבע הרקע (ערכי צבע של HTML). לא להשתמש במירכאות. | כל הסוגים | <inputbox>
type=search
bgcolor=gray
</inputbox>
|
? | ||
width=
|
מגדיר את רוחב תיבת הקלט כמספר התווים המותרים להזנה. | כל הסוגים | <inputbox>
type=create
width=24
</inputbox>
|
? | ||
default=
|
טקסט ברירת מחדל שיוכנס לתיבת הקלט. | כל הסוגים | <inputbox>
type=comment
default=User talk:Eloquence
</inputbox>
|
? | ||
preloadtitle=
|
Default text to add as the title for a new comment. | comment | <inputbox>
type=comment
preloadtitle=My comment title
default=Extension talk:InputBox
</inputbox>
|
| ||
preload=
|
The page under this title will be preloaded (see Manual:Creating pages with preloaded text) into the blank editbox when a new page is created. | create, comment, commenttitle | <inputbox>
type=create
preload=Log
</inputbox>
|
? | ||
| יש להכניס את כותרת הדף (דף שעדיין לא קיים) בדוגמה הבאה לתוך תיבת הקלט, וללחוץ על "יצירת הדף" או על "פרק חדש" בהתאמה על מנת לנסות את האפקט. | ||||||
editintro=
|
הדף שהוגדר בפרמטר הזה יוצג, בתור תיבת הנחיות, "מעל" לחלון העריכה. | create, comment | <inputbox>
type=comment
editintro=MediaWiki:Missingcommenttext
</inputbox>
|
? | ||
buttonlabel=
|
תווית זאת תופיע בכפתור הראשי בטופס. | כל הסוגים | <inputbox>
type=comment
buttonlabel=Add new rumor
</inputbox>
|
? | ||
hidden=
|
פרמטר זה קובע שלא תהיה תיבת קלט.
אם עושים בו שימוש יחד עם הפרמטר " |
create, comment | <inputbox>
type=comment
editintro=Extension:InputBox/editintro comment
preloadtitle=Comment title
preload=Extension:InputBox/preload
hidden=yes
default=Extension talk:InputBox
buttonlabel=לפרסם תגובה בדף השיחה
</inputbox>
|
? | ||
searchbuttonlabel=
|
תווית זו תופיע בכפתור ה"חיפוש טקסט־מלא" בטופס החיפוש. | search, fulltext | <inputbox>
type=search
searchbuttonlabel=לחפור לעומק
</inputbox>
|
? | ||
searchengine=
|
If Extension:MediaSearch is installed, this parameter sets the search special page to either Search or MediaSearch. If this parameter is not used, the user's (or wiki's default) preference will be used.
|
search, search2 | <inputbox>
type=search
searchengine=MediaSearch
</inputbox>
|
| ||
searchtype=
|
If searchengine=MediaSearch, this parameter configures which results' tab to display. One of the following: image, video, audio, page, other
|
search, search2 | <inputbox>
type=search
searchengine=MediaSearch
searchtype=audio
</inputbox>
|
| ||
fulltextbutton=
|
הצגת כפתור החיפוש אחר טקסט־מלא בטופס החיפוש השני (search2) | search2 | <inputbox>
type=search2
searchbuttonlabel=לחפור לעומק
fulltextbutton=true
</inputbox>
|
? | ||
labeltext=
|
טקסט להדפסה לפני הכפתור | search2 | <inputbox>
type=search2
searchbuttonlabel=לחפור לעומק
labeltext=לחפש אחר:
</inputbox>
|
? | ||
break=
|
Whether or not to insert a line break between the input box and the button(s). ברירת המחדל היא yes (להשתמש בשבירת שורה). | כל הסוגים | <inputbox>
type=create
width=24
break=no
</inputbox>
|
? | ||
namespaces=
|
Support for namespace checkboxes in fulltext search.
With " |
search, fulltext | <inputbox>
type=search
namespaces=Main**,Help
</inputbox>
|
? | ||
prefix=
|
Remark: underscores aren't recognized as spaces. |
search, fulltext, create |
The button below prefixes the name with |
<inputbox>
type=search
prefix={{FULLPAGENAME}}/Archive
</inputbox>
|
? | |
placeholder=
|
Define placeholder text that will display in the input box when it is empty. | כל הסוגים | <inputbox>
type=search
placeholder=לחפש בוויקי הזה
</inputbox>
|
| ||
page=
|
הדף שאליו רוצים לפרסם תגובות, או הדף שרוצים להעביר. | comment, move | <inputbox>
type=comment
page=Project:Sandbox
</inputbox>
|
|||
minor=
|
עריכה משנית. | comment, create | <inputbox>
type=comment
page=Project:Sandbox
minor=true
</inputbox>
|
|||
nosummary=
|
תקציר עריכה (כותרת) היא לא חובה לתגובה חדשה. | comment | <inputbox>
type=commenttitle
page=Special:Mypage/inputbox test
nosummary=true
</inputbox>
|
|||
summary=
|
תקציר עריכה או סיבת העברה. | create, move | <inputbox>
type=create
default=Special:Mypage/inputbox test
summary=Foo
</inputbox>
|
|||
id=
|
מאפיין id עבור $form. | כל הסוגים | <inputbox>
type=comment
page=Project:Sandbox
summary=Foo
id=bar
</inputbox>
|
for some types | ||
inline=
|
הפיכת תיבת הקלט לאלמנט שמוכנס לאותה השורה (ללא שבירת שורה בהתחלה). Any value means yes/true. | search2 | Text here: | Text here: <inputbox>
type=search2
inline=true
width=10
</inputbox>
|
||
dir=
|
Right to left (rtl) or left to right (ltr). Defaults to directionality of the page's language. | כל הסוגים | <inputbox>
dir=rtl
type=comment
page=Project:Sandbox
summary=Foo
</inputbox>
|
|||
preloadparams[]=
|
ציון פרמטרים לטקסט מוגדר מראש. ר' יצירת דפים עם טקסט מוגדר מראש. | create, comment, commenttitle | <inputbox>
type=create
preload=Log
preloadparams[]=param1
preloadparams[]=param2
</inputbox>
|
| ||
searchfilter=
|
Specify parameters to append to the search | search, fulltext | <inputbox>
type=search
searchfilter=insource:foo
</inputbox>
|
| ||
useve=
|
When creating a page the input box will use the new visual editor, if the extension is installed, and this parameter is set to any value. | create, comment | <inputbox>
type=create
break=no
useve=true
</inputbox>
|
|||
usedt=
|
When adding a new section, the input box will open the DiscussionTools new topic tool, if the extension is installed, and this parameter is set to any value. | comment, commenttitle | <inputbox>
type=commenttitle
page=Project:Sandbox
usedt=true
</inputbox>
|
|||
הגדרת create כשהוכנס שם של דף קיים פשוט תביא את דף העריכה.
במקרה כזה אין התייחסות ל־preload.
הגדרת comment עבור דף חדש תעבוד.
הטקסטים שנלקחו ממרחב MediaWiki: הם רק דוגמאות, כל דף קיים יכול להיות משומש ב־"editintro" או ב־"preload".
לרוע המזל preload עדיין לא עובד בתקציר העלאת קובץ.
Customizing with CSS
You can customize the inputbox in templates using CSS. First, wrap the inputbox in <div> tags with an unique ID then use CSS selectors to change its appearance.
You could also give the inputbox itself an ID and use the ID in the CSS selectors. You could also add a custom search button or icon.
<templatestyles src="Template:Example/styles.css"/><div id = "inputbox-search-wrapper">
{{#tag: inputbox|
type = search
id = inputbox-search
placeholder = Search all pages
namespaces = Main**,Help**
}}<div class = "inputbox-search-icon"></div>
</div>
#inputbox-search-wrapper {
box-sizing: border-box;
height: 32px;
display: flex;
border: 1px solid var(--border-color-base, #a2a9b1);
border-radius: 10px;
}
#inputbox-search-wrapper input {
all: unset;
padding-left: 8px;
padding-top: 6px;
padding-bottom: 6px;
width: 180px !important;
font-family: 'Helvetica Neue', 'Helvetica', 'Liberation Sans', 'Arial', sans-serif;;
font-size: 14px;
line-height: 20px;
color: var(--color-base--subtle, #72777d);
}
#inputbox-search-wrapper input::placeholder {
font-family: 'Helvetica Neue', 'Helvetica', 'Liberation Sans', 'Arial', sans-serif;;
font-size: 14px;
line-height: 20px;
color: var(--color-base--subtle, #72777d);
}
#inputbox-search-wrapper input.mw-ui-button,
.searchbox .cdx-checkbox--inline,
#inputbox-search-wrapper .cdx-button,
#inputbox-search-wrapper div.mw-ui-checkbox {
display: none;
}
.inputbox-search-icon {
padding-left: 8px;
width: 25px;
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Vector_search_icon.svg/18px-Vector_search_icon.svg.png");
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
}
יישור
אם ברצונכם ליצור תיבת קלט עם יישור לימין הדף, עשו משהו כמו:
<div style="float:left; width:42em">
<inputbox>
type=create
</inputbox>
</div>
Gives:
Using InputBox in a template
כדי ליצור מספר תיבות קלט דומות, ניתן להשתמש ב־InputBox בתבנית.
However, passing template parameters to InputBox parameters only works if the <inputbox>...</inputbox> tag is used via the #tag parser function with {{#tag:inputbox | ...}} inside the template.
הדוגמה הבאה היא תבנית ליצירת דף ויקי חדש מתוך תבנית קיימת:
{{#tag:inputbox |
type=create
buttonlabel=יצירת {{{1|ערך}}} חדש
preload={{{2|Template:Article}}}
}}
When instantiating the template, the first parameter gives the item that is created (default: article) as spelled out in the button, the second parameter gives the name of the template used to create the item (default: Template:Article).
E.g., the code for an input box to create a new project from a project template might look like this:
{{Template:CreateNew|project|Template:Project}}
Notes
This extension splits the parser cache based on the user interface language (git:e18b7e6), in order to show localized label texts.
ר' גם
| This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. |
| This extension is included in the following wiki farms/hosts and/or packages: |
- Stable extensions/he
- Tag extensions/he
- Page action extensions/he
- Search extensions/he
- MIT licensed extensions/he
- Extensions in Wikimedia version control/he
- MediaWikiPerformAction extensions/he
- ParserFirstCallInit extensions/he
- SpecialPageBeforeExecute extensions/he
- All extensions/he
- Extensions bundled with MediaWiki 1.21/he
- Extensions used on Wikimedia/he
- Extensions included in BlueSpice/he
- Extensions included in Canasta/he
- Extensions available as Debian packages/he
- Extensions included in Fandom/he
- Extensions included in Miraheze/he
- Extensions included in MyWikis/he
- Extensions included in ProWiki/he
- Extensions included in semantic::core/he
- Extensions included in ShoutWiki/he
- Extensions included in Telepedia/he
- Extensions included in wiki.gg/he
- Form extensions/he
- Page creation extensions/he
- Search widget extensions/he
- Edit box extensions/he
