확장기능:InputBox
This code base is maintained by the Readers Experience team. Code review only for UBNs or security fixes. |
![]() 출시 상태: 안정 |
|
---|---|
![]() |
|
구현 | 태그 , Page action , 검색 |
설명 | 사용자가 미리 정의한 HTML 폼을 문서에 추가할 수 있게 합니다. |
만든 이 |
|
최신 버전 | Continuous updates |
MediaWiki | >= 1.45 |
데이터베이스 변경 | 아니오 |
라이선스 | MIT 허가서 |
다운로드 | |
|
|
InputBox 확장 기능 번역 (translatewiki.net에서 가능한 경우) | |
이슈 | 미해결 작업 · 버그 보고 |
InputBox 확장 기능은 미리 만들어둔 HTML 폼을 위키 문서에 추가합니다. 사용자들은 이 폼을 “채워서” (글자를 적거나 메뉴를 고르거나 하는 등) 글자를 상자 안으로 넣을 수 있습니다.
InputBox는 처음에는 Wikinews에 새 문서 만들기 상자를 추가하기 위해 Erik Möller에 의해 제작되었습니다.
설치
- 파일을 다운로드하고
InputBox
폴더를extensions/
디렉토리에 넣어 주세요.
개발자와 코딩 기여자는 Git을 이용해 확장기능을 다운받는 것이 좋습니다.cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/InputBox
- 아래의 코드를 LocalSettings.php 코드의 마지막에 추가합니다.
wfLoadExtension( 'InputBox' );
- 완료 – 위키의 ‘Special:Version’에 이동해서, 확장기능이 올바르게 설치된 것을 확인합니다.
예시
새 문서를 시작하기 위한 상자.
위키 코드
<inputbox>
type = create
width = 30px <!-- with unit of measurement -->
break = no
placeholder = Page title
</inputbox>
결과
일반적인 구문
Input box는 다음과 같은 구조를 같습니다.
<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 = <!-- optionally "MediaSearch" (Extension:MediaSearch) "Search" #Default: local wiki default. -->
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[]
는 여러 번 나타날 수 있습니다.
박스 종류
제출 버튼은 기본적으로 상자 아래에 나타납니다.
“제출” 버튼은 line break 매개 변수를 다음과 같이 사용하면 상자와 버튼 사이의 줄바꿈이 제거되어 상자의 오른쪽으로 갑니다: break=no
.
제출 버튼을 오른쪽에 두는 것은 검색어 제안들이 검색 버튼을 덮어 버리는 것을 막을 때 유용합니다.
종류 | 예시 | 설명 |
---|---|---|
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> . (rev:47203버전부터 도입됨)
| |
fulltext
|
“보기” 버튼 없이 전체 글 검색 버튼만을 사용하여 검색합니다. (rev:45269버전부터 도입됨) | |
move
|
다른 이름으로 이동하기. This also doesn't work when creating it by invoking a tag. (gerrit:97559버전부터 도입됨) |
type=search2
의 경우 검색 버튼의 기본 위치는 오른쪽입니다.
현재 이 InputBox에 다른 매개 변수를 추가할 수 없는 것으로 보입니다.
이 검색 상자는 위치한 위키 전체를 검색합니다.
종류 | 예시 |
---|---|
search2
|
변수
변수 | 설명 | 목적 | 결과 | 예시 | 호환성 | |
---|---|---|---|---|---|---|
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의 너비를 글자수로 설정합니다. | 모든 종류 | <inputbox>
type=create
width=24
</inputbox>
|
? | ||
default=
|
기본 텍스트를 InputBox에 넣기. | 모든 종류 | <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=
|
새 문서를 생성할 때 이 제목의 문서가 빈 편집 창에 preload됩니다(Manual:Creating pages with preloaded text 참조). | create, comment, commenttitle | <inputbox>
type=create
preload=Log
</inputbox>
|
? | ||
효과를 각각 알아보기 위해 위 혹은 아래의 InputBox에 존재하지 않는 문서 이름을 적어 넣고 Enter를 누르거나 문서 만들기 혹은 새 문단를 클릭하십시오. | ||||||
editintro=
|
The page which is given under this parameter will be shown, as instructions, above the editing window. | create, comment | <inputbox>
type=comment
editintro=MediaWiki:Missingcommenttext
</inputbox>
|
? | ||
buttonlabel=
|
This label will be used for the main button of the form. | 모든 종류 | <inputbox>
type=comment
buttonlabel=Add new rumor
</inputbox>
|
? | ||
hidden=
|
This specifies that there is no InputBox.
It is used with parameter |
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=
|
This label will be used for the "Search full text" button of the search form. | search, fulltext | <inputbox>
type=search
searchbuttonlabel=Dig deeperee
</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>
|
| ||
fulltextbutton=
|
Show the full text search button on search2 form | search2 | <inputbox>
type=search2
searchbuttonlabel=Dig deeper
fulltextbutton=true
</inputbox>
|
? | ||
labeltext=
|
Text to display beside the button | search2 | <inputbox>
type=search2
searchbuttonlabel=Dig deeper
labeltext=찾기:
</inputbox>
|
? | ||
break=
|
Whether or not to insert a line break between the input box and the button(s). Defaults to yes (use a line break). | 모든 종류 | <inputbox>
type=create
width=24
break=no
</inputbox>
|
? | ||
namespaces=
|
Support for namespace checkboxes in fulltext search.
일반, " |
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=
|
Page to posts comment to, or page to move. | comment, move | <inputbox>
type=comment
page=Project:Sandbox
</inputbox>
|
|||
minor=
|
사소한 편집. | comment, create | <inputbox>
type=comment
page=Project:Sandbox
minor=true
</inputbox>
|
|||
nosummary=
|
Edit summary (headline) not required for new comment. | comment | <inputbox>
type=commenttitle
page=Special:Mypage/inputbox test
nosummary=true
</inputbox>
|
|||
summary=
|
Edit summary or move reason. | create, move | <inputbox>
type=create
default=Special:Mypage/inputbox test
summary=Foo
</inputbox>
|
|||
id=
|
ID attribute for <form> .
|
모든 종류 | <inputbox>
type=comment
page=Project:Sandbox
summary=Foo
id=bar
</inputbox>
|
for some types | ||
inline=
|
Make the InputBox be an inline element (no line break at beginning). 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[]=
|
Specify parameters to the preload text. See Creating pages with preloaded text. | 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>
|
Applying create to an existing page simply gives the edit page.
In that case preload
is ignored.
Applying comment for a new page works.
The texts taken from the MediaWiki:
namespace are of course only examples, any existing page can be used for editintro
or preload
.
Unfortunately preload
does not yet work for the Upload summary.
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;
}
정렬
If you want to create an inputbox on the right side of the page, do something like:
<div style="float:right; width:42em">
<inputbox>
type=create
</inputbox>
</div>
Gives:
Using InputBox in a template
In order to create many similar input boxes, InputBox can be used in a template.
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.
The following example is a template to create a new wiki page from a named 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}}
같이 보기
이 확장 기능은 하나 이상의 위키미디어 프로젝트에서 사용 중입니다. 이것은 아마도 이 확장 기능이 안정적이고 트래픽이 많은 웹 사이트에서 사용할 수 있을 만큼 충분히 잘 작동한다는 것을 의미합니다. 설치된 위치를 확인하려면 위키미디어의 CommonSettings.php 및 InitialiseSettings.php 구성 파일에서 이 확장 기능의 이름을 찾습니다. 특정 위키에 설치된 확장 기능의 전체 목록은 위키의 Special:Version 문서에서 볼 수 있습니다. |
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |