| This code base is maintained by theReader Experience team.Code review only for UBNs or security fixes. |
Estado de la versión: estable | |
|---|---|
| Implementación | Etiqueta,Acción de página, Buscar |
| Descripción | Permite a los usuarios añadir formularios HTML predefinidos a las páginas wiki. |
| Autor(es) |
|
| Última versión | Continuous updates |
| MediaWiki | >= 1.45 |
| Cambios en la base de datos | No |
| Licencia | Licencia MIT |
| Descargar | |
| |
| Traduce la extensión InputBox si está disponible en translatewiki.net | |
| Incidentes | Tareas abiertas ·Reportar un error |
La extensiónInputBox añadeformularios web ya creados a páginas web.Los usuarios pueden "llenar" un formulario (introducir texto, seleccionar elementos del menú, etc.) introduciendo texto en el cuadro.
InputBox fue originalmente creada porErik Möller para añadir un cuadroCrear un artículo aWikinews.
InputBox extraída a tu directorioextensions/.cdextensions/gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/InputBoxwfLoadExtension('InputBox');
Cuadro para empezar un nuevo artículo.
<inputbox>type = createwidth = 30px<!-- with unit of measurement -->break = noplaceholder = Page title</inputbox>
Los cuadros de entrada se construyen así:
<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.
El parámetrotype es obligatorio.Todos los demás parámetros son opcionales.preloadparams[] pueden apaeecer más de una vez.
La ubicación predeterminada del botón/botones "Enviar" es debajo del cuadro de entrada.
El botón "Enviar" se puede mover a la derecha usando el parámetro de salto de línea para eliminar el salto de la línea entre la caja y el botón:break=no.
Tener el botón "$sender" a la derecha es útil para los cuadro de búsqueda cuando las sugerencias de búsqueda ocultarían un botón de búsquedo debajo del cuadro.
| tipo | Ejemplo | Descripción |
|---|---|---|
search | Crea un cuadro de búsqueda que tiene un ancho predeterminado de 50 caracteres. La información añadida en el cuadro de texto busca el título exacto de la página (primer botón) o en el texto de los artículos (segundo botón). | |
create | Crea una nueva página. La información añadida en el cuadro de texto es el nombre de la página a crear (o página a editar si ya existe). | |
comment | Añade una nueva sección en la parte inferior de la página especificada en el cuadro de texto (creará la página si es nueva). | |
commenttitle | Añade una nueva sección con el encabezado de la sección escrito en el cuadro de texto. El título se puede especificar con el parámetrodefault=. La página debe especificarse con el parámetropage=.For some reason this does NOT work when using the extension by invoking it with {{#tag}}, only when using<inputbox>.(introducido enrev:47203) | |
fulltext | Busca solo con el botón de búsqueda de texto completo, sin el botón de coincidencia exacta (botón "Ir").(introducido enrev:45269) | |
move | Translada la página a un nombre diferente. This also doesn't work when creating it by invoking a tag.(introducido engerrit:97559) |
Fortype=search2, the default location for the search button is inline to the right.Currently, it does not seem to be possible to add other parameters to this type of input box.This search box searches the entire wiki that it is placed on.
| Tipo | Ejemplo |
|---|---|
search2 |
| Parámetro | Descripción | Scope | Result | Ejemplo | Compatibility | |
|---|---|---|---|---|---|---|
arialabel= | Supply the aria-label attribute to the InputBox to ensure generated markup is accessible to screen readers.SeeARIA: aria-label attribute. | All types | <inputbox>type=searcharialabel=Search the wiki</inputbox> |
| ||
bgcolor= | Sets the table background color (HTML color values).Do not use quotes. | All types | <inputbox>type=searchbgcolor=gray</inputbox> | ? | ||
width= | Sets the width of the InputBox in characters. | All types | <inputbox>type=createwidth=24</inputbox> | ? | ||
default= | Default text to put in the InputBox. | All types | <inputbox>type=commentdefault=User talk:Eloquence</inputbox> | ? | ||
preloadtitle= | Default text to add as the title for a new comment. | comment | <inputbox>type=commentpreloadtitle=My comment titledefault=Extension talk:InputBox</inputbox> |
| ||
preload= | The page under this title will be preloaded (seeManual:Creando páginas con texto precargado) into the blank editbox when a new page is created. | create, comment, commenttitle | <inputbox>type=createpreload=Log</inputbox> | ? | ||
| Enter the title of a non-existent page in the example InputBox above or below, and click "Crear página" or "Sección nueva" respectively to test this effect. | ||||||
editintro= | The page which is given under this parameter will be shown, as instructions,above the editing window. | create, comment | <inputbox>type=commenteditintro=MediaWiki:Missingcommenttext</inputbox> | ? | ||
buttonlabel= | This label will be used for the main button of the form. | All types | <inputbox>type=commentbuttonlabel=Add new rumor</inputbox> | ? | ||
hidden= | This specifies that there is no InputBox. It is used with parameter | create, comment | <inputbox>type=commenteditintro=Extension:InputBox/editintro commentpreloadtitle=Comment titlepreload=Extension:InputBox/preloadhidden=yesdefault=Extension talk:InputBoxbuttonlabel=Post a comment on the talk page</inputbox> | ? | ||
searchbuttonlabel= | This label will be used for the "Search full text" button of the search form. | search, fulltext | <inputbox>type=searchsearchbuttonlabel=Dig deeper</inputbox> | ? | ||
searchengine= | IfExtension:MediaSearch is installed, this parameter sets the search special page to eitherSearch orMediaSearch.If this parameter is not used, the user's (or wiki's default) preference will be used. | search, search2 | <inputbox>type=searchsearchengine=MediaSearch</inputbox> |
| ||
searchtype= | Ifsearchengine=MediaSearch, this parameter configures which results' tab to display.One of the following:image,video,audio,page,other | search, search2 | <inputbox>type=searchsearchengine=MediaSearchsearchtype=audio</inputbox> |
| ||
fulltextbutton= | Show the full text search button on search2 form | search2 | <inputbox>type=search2searchbuttonlabel=Dig deeperfulltextbutton=true</inputbox> | ? | ||
labeltext= | Text to display beside the button | search2 | <inputbox>type=search2searchbuttonlabel=Dig deeperlabeltext=Look for:</inputbox> | ? | ||
break= | Whether or not to insert a line break between the input box and the button(s).Defaults toyes (use a line break). | All types | <inputbox>type=createwidth=24break=no</inputbox> | ? | ||
namespaces= | Support for namespace checkboxes in fulltext search. With " | search, fulltext | <inputbox>type=searchnamespaces=Main**,Help</inputbox> | ? | ||
prefix= |
Remark: underscores aren't recognized as spaces. | search, fulltext, create | The button below prefixes the name with | <inputbox>type=searchprefix={{FULLPAGENAME}}/Archive</inputbox> | ? | |
placeholder= | Define placeholder text that will display in the input box when it is empty. | Formatos de archivo | <inputbox>type=searchplaceholder=Search this wiki</inputbox> |
| ||
page= | Page to posts comment to, or page to move. | comment, move | <inputbox>type=commentpage=Project:Sandbox</inputbox> | |||
minor= | Minor edit. | comment, create | <inputbox>type=commentpage=Project:Sandboxminor=true</inputbox> | |||
nosummary= | Edit summary (headline) not required for new comment. | comment | <inputbox>type=commenttitlepage=Special:Mypage/inputbox testnosummary=true</inputbox> | |||
summary= | Edit summary or move reason. | create, move | <inputbox>type=createdefault=Special:Mypage/inputbox testsummary=Foo</inputbox> | |||
id= | ID attribute for<form>. | All types | <inputbox>type=commentpage=Project:Sandboxsummary=Fooid=bar</inputbox> |
for some types | ||
inline= | Make the InputBox be an inline element (no line break at beginning).Any value meansyes/true. | search2 | Text here: | Text here:<inputbox>type=search2inline=truewidth=10</inputbox> | ||
dir= | Right to left (rtl) or left to right (ltr).Defaults to directionality of the page's language. | All types | <inputbox>dir=rtltype=commentpage=Project:Sandboxsummary=Foo</inputbox> | |||
preloadparams[]= | Specify parameters to the preload text.SeeCreating pages with preloaded text. | create, comment, commenttitle | <inputbox>type=createpreload=Logpreloadparams[]=param1preloadparams[]=param2</inputbox> |
| ||
searchfilter= | Specify parameters to append to the search | search, fulltext | <inputbox>type=searchsearchfilter=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=createbreak=nouseve=true</inputbox> | |||
usedt= | When adding a new section, the input box will open theDiscussionTools new topic tool, if the extension is installed, and this parameter is set to any value. | comment, commenttitle | <inputbox>type=commenttitlepage=Project:Sandboxusedt=true</inputbox> | |||
Applyingcreate to an existing page simply gives the edit page.In that casepreload is ignored.Applyingcomment for a new page works.
The texts taken from theMediaWiki: namespace are of course only examples, any existing page can be used foreditintro orpreload.Unfortunatelypreload does not yet work for theUpload summary.
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.
<templatestylessrc="Template:Example/styles.css"/><divid="inputbox-search-wrapper">{{#tag: inputbox|type= searchid = inputbox-searchplaceholder = Search all pagesnamespaces = Main**,Help**}}<divclass="inputbox-search-icon"></div></div>
#inputbox-search-wrapper{box-sizing:border-box;height:32px;display:flex;border:1pxsolidvar(--border-color-base,#a2a9b1);border-radius:10px;}#inputbox-search-wrapperinput{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-wrapperinput::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-wrapperinput.mw-ui-button,.searchbox.cdx-checkbox--inline,#inputbox-search-wrapper.cdx-button,#inputbox-search-wrapperdiv.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:
<divstyle="float:right; width:42em"><inputbox>type=create</inputbox></div>
Gives:
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=createbuttonlabel=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 theparser cache based on theuser interface language (git:e18b7e6), in order to show localized label texts.
| Esta extensión está siendo usada en uno o másproyectos de Wikimedia. Esto significa probablemente que la extensión es estable y funciona lo suficientemente bien como para ser usada en sitios con gran cantidad de visitas. Puedes buscar el nombre de esta extensión en los archivosCommonSettings.php eInitialiseSettings.php de Wikimedia para ver dónde se instala. Encontrarás la lista completa de extensiones instaladas en un wiki en particular en la páginaSpecial:Version del wiki. |
| Esta extensión está incluida en los siguientes anfitriones/granjas wiki y/o paquetes:No se trata de una lista oficial. Algunas granjas/hosts wiki y/o paquetes pueden tener disponible esta extensión aunque no estén listados aquí. Siempre compruébelo con su anfitrión o granja wiki para confirmarlo. |