Extension:InputBox
| This code base is maintained by the Reader Experience team. Code review only for UBNs or security fixes. |
リリースの状態: 安定 |
|
|---|---|
| 実装 | タグ, ページの操作, 検索 |
| 説明 | あらかじめ定義された HTML フォームを利用者がウィキページに追加できるようにする |
| 作者 |
|
| 最新バージョン | Continuous updates |
| MediaWiki | >= 1.45 |
| データベースの変更 | いいえ |
| ライセンス | MIT ライセンス |
| ダウンロード | |
|
|
| translatewiki.net で翻訳を利用できる場合は、InputBox 拡張機能の翻訳にご協力ください | |
| 問題点 | 未解決のタスク · バグを報告 |
InputBox 拡張機能はあらかじめ作られた HTML フォームをウィキページに追加します。 利用者はボックスにテキストを入力することによってフォームを「埋める」(テキストを入力する、メニュー項目を選択する、等)ことができます。
InputBoxは、当初は Erik Möller によって Wikinews の「記事を作成する」欄を追加するために作成されました。
インストール
- ダウンロードして、ファイルを
extensions/フォルダー内のInputBoxという名前のディレクトリ内に配置します。
開発者とコード寄稿者は、上記の代わりに以下を使用して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>
結果
一般的な構文
入力ボックスは以下のように構築されます:
<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 というパラメータを指定することで入力ボックスの右に配置させることも可能です。このパラメーターは、ボックスとボタンの間にある改行を取り除くものです。
「送信」ボタンを下に配置すると入力の自動補完機能によってボタンが隠れてしまうといった場合には右に配置するのが有用です。
| 種類 | 例 | 説明 |
|---|---|---|
search
|
既定の幅が50文字の検索ボックスを作成します。 テキストボックスに入力された情報を正確なページ名(1番目のボタン)または記事内のテキスト(2番目のボタン)で検索します。 | |
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 の場合、検索ボタンの既定の位置は右側でインラインです。
現在のところ、このタイプの入力ボックスに他のパラメータを追加することはできないようです。
この検索ボックスは、それが置かれたWiki全体を検索します。
| 種類 | 例 |
|---|---|
search2
|
パラメータ
| パラメーター | 説明 | 通用範囲 | 結果 | 例 | 互換性 | |
|---|---|---|---|---|---|---|
arialabel=
|
Supply the aria-label attribute to the InputBox to ensure generated markup is accessible to screen readers. See ARIA: aria-label attribute. | すべての種類 | <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=
|
新しいページを作成すると、このページ名のページが空白の編集ボックスにあらかじめ読み込まれます(Manual:テキストをプリロードしてページを作る参照)。 | create, comment, commenttitle | <inputbox>
type=create
preload=Log
</inputbox>
|
? | ||
| 上または下の例のInputBoxに存在しないページのページ名を入力し、それぞれ「項目を作成」または「新しい節」をクリックして、この効果を試してみてください。 | ||||||
editintro=
|
このパラメータで指定されたページは、編集ウィンドウの上に指示として表示されます。 | create, comment | <inputbox>
type=comment
editintro=MediaWiki:Missingcommenttext
</inputbox>
|
? | ||
buttonlabel=
|
このラベルは、フォームのメインボタンに使用されます。 | すべての種類 | <inputbox>
type=comment
buttonlabel=新しいリソースを追加
</inputbox>
|
? | ||
hidden=
|
InputBoxが存在しないことを指定します。
パラメーター |
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=
|
Show the full text search button on search2 form | search2 | <inputbox>
type=search2
searchbuttonlabel=深堀りする
fulltextbutton=true
</inputbox>
|
? | ||
labeltext=
|
ボタンの横に表示するテキスト | search2 | <inputbox>
type=search2
searchbuttonlabel=深堀りする
labeltext=検索
</inputbox>
|
? | ||
break=
|
入力ボックスとボタン(複数可)の間に改行を挿入するかどうか。 既定はyes(改行を使用)。 | すべての種類 | <inputbox>
type=create
width=24
break=no
</inputbox>
|
? | ||
namespaces=
|
全文検索で名前空間チェックボックスに対応
" |
search, fulltext | <inputbox>
type=search
namespaces=Main**,Help
</inputbox>
|
? | ||
prefix=
|
注:アンダースコアはスペースとして認識されません。 |
search, fulltext, create |
下のボタンは、名前の前に |
<inputbox>
type=search
prefix={{FULLPAGENAME}}/Archive
</inputbox>
|
? | |
placeholder=
|
入力ボックスが空のときに表示されるプレースホルダーテキストを定義します。 | すべての種類 | <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=
|
<form> の ID 属性。
|
すべての種類 | <inputbox>
type=comment
page=Project:Sandbox
summary=Foo
id=bar
</inputbox>
|
for some types | ||
inline=
|
InputBoxをインライン要素にする(冒頭で改行しない)。 Any value means yes/true. | search2 | 文字を入力: | 文字を入力: <inputbox>
type=search2
inline=true
width=10
</inputbox>
|
||
dir=
|
右から左(rtl)または左から右(ltr)。 既定は、ページの言語の方向性。 | すべての種類 | <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=
|
検索に付加するパラメータを指定する | 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=Create new {{{1|article}}}
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}}
注記
This extension splits the parser cache based on the user interface language (git:e18b7e6), in order to show localized label texts.
関連項目
| この拡張機能は 1 つ以上のウィキメディアのプロジェクトで使用されています。 これはおそらく、この拡張機能が安定していて高いトラフィックのウェブサイトでも十分に動作することを意味します。 この拡張機能がインストールされている場所を確認するには、ウィキメディアの設定ファイル CommonSettings.php および InitialiseSettings.php 内で、この拡張機能の名前を探してください。 特定のウィキにインストールされている拡張機能の完全な一覧は、そのウィキの Special:Version ページにあります。 |
| この拡張機能は以下のウィキ ファーム/ウィキ ホスト/パッケージに含まれています: これは正式な一覧ではありません。 一部のウィキ ファーム/ウィキ ホスト/パッケージは、ここに記載されていなくてもこの拡張機能を含んでいる場合があります。 必ずご利用のウィキ ファーム、ウィキ ホスト、バンドルで確認してください。 |
- Stable extensions/ja
- Tag extensions/ja
- Page action extensions/ja
- Search extensions/ja
- MIT licensed extensions/ja
- Extensions in Wikimedia version control/ja
- MediaWikiPerformAction extensions/ja
- ParserFirstCallInit extensions/ja
- SpecialPageBeforeExecute extensions/ja
- All extensions/ja
- Extensions bundled with MediaWiki 1.21/ja
- Extensions used on Wikimedia/ja
- Extensions included in BlueSpice/ja
- Extensions included in Canasta/ja
- Extensions available as Debian packages/ja
- Extensions included in Fandom/ja
- Extensions included in Miraheze/ja
- Extensions included in MyWikis/ja
- Extensions included in ProWiki/ja
- Extensions included in semantic::core/ja
- Extensions included in ShoutWiki/ja
- Extensions included in Telepedia/ja
- Extensions included in wiki.gg/ja
- Extensions included in WikiForge/ja
- Form extensions/ja
- Page creation extensions/ja
- Search widget extensions/ja
- Edit box extensions/ja
