2020-02-17 19:49:43 +00:00
|
|
|
import searchBoxTemplate from '!!raw-loader!../includes/templates/SearchBox.mustache';
|
2021-09-03 19:00:45 +00:00
|
|
|
import Button from '!!raw-loader!../includes/templates/Button.mustache';
|
2020-07-14 21:40:28 +00:00
|
|
|
import { htmlUserLanguageAttributes } from './utils';
|
2020-02-17 19:49:43 +00:00
|
|
|
|
2021-09-16 18:00:05 +00:00
|
|
|
const INPUT_ATTRIBUTES = 'type="search" name="search" placeholder="Search Wikipedia" title="Search Wikipedia [⌃⌥f]" accesskey="f" id="searchInput" autocomplete="off"';
|
|
|
|
const FULL_TEXT_ATTRIBUTES = 'name="fulltext" title="Search pages for this text" id="mw-searchButton" class="searchButton mw-fallbackSearchButton"';
|
|
|
|
const GO_ATTRIBUTES = 'name="go" title="Go to a page with this exact name if it exists" id="searchButton" class="searchButton"';
|
|
|
|
|
2020-05-29 19:07:55 +00:00
|
|
|
/**
|
2020-06-08 22:14:37 +00:00
|
|
|
* @type {SearchData}
|
2020-05-29 19:07:55 +00:00
|
|
|
*/
|
2021-09-13 21:19:58 +00:00
|
|
|
const searchBoxData = {
|
2020-05-29 19:07:55 +00:00
|
|
|
'form-action': '/w/index.php',
|
2021-09-16 18:00:05 +00:00
|
|
|
'form-id': 'searchform',
|
|
|
|
'is-primary': false,
|
|
|
|
class: 'vector-search-show-thumbnail',
|
2020-07-14 21:40:28 +00:00
|
|
|
'html-user-language-attributes': htmlUserLanguageAttributes,
|
2020-05-29 19:07:55 +00:00
|
|
|
'msg-search': 'Search',
|
2021-09-16 18:00:05 +00:00
|
|
|
'html-input': `<input ${INPUT_ATTRIBUTES}>`,
|
2020-05-29 19:07:55 +00:00
|
|
|
'page-title': 'Special:Search',
|
2021-09-16 18:00:05 +00:00
|
|
|
'html-input-attributes': INPUT_ATTRIBUTES,
|
|
|
|
'html-button-fulltext-attributes': FULL_TEXT_ATTRIBUTES,
|
|
|
|
'msg-searchbutton': 'Search',
|
|
|
|
'msg-searcharticle': 'Go',
|
|
|
|
'html-button-go-attributes': GO_ATTRIBUTES,
|
|
|
|
'html-button-search-fallback': `<input type="submit" ${FULL_TEXT_ATTRIBUTES} value="Search" />`,
|
|
|
|
'html-button-search': `<input type="submit" ${GO_ATTRIBUTES} value="Go">`
|
2020-02-17 19:49:43 +00:00
|
|
|
};
|
2021-07-22 17:27:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {SearchData}
|
|
|
|
*/
|
2021-09-13 21:19:58 +00:00
|
|
|
const searchBoxDataWithCollapsing = Object.assign( {}, searchBoxData, {
|
|
|
|
class: `${searchBoxData.class} vector-search-box-collapses`,
|
2021-07-22 17:27:33 +00:00
|
|
|
'is-collapsible': true,
|
2021-09-03 19:00:45 +00:00
|
|
|
'data-collapse-icon': {
|
|
|
|
icon: 'wikimedia-search',
|
|
|
|
'is-quiet': true,
|
|
|
|
class: 'search-toggle',
|
|
|
|
href: '/wiki/Special:Search',
|
|
|
|
label: 'Search'
|
|
|
|
}
|
2021-07-22 17:27:33 +00:00
|
|
|
} );
|
|
|
|
|
2021-09-03 19:00:45 +00:00
|
|
|
const SEARCH_TEMPLATE_PARTIALS = {
|
|
|
|
Button
|
|
|
|
};
|
|
|
|
|
2021-07-22 17:27:33 +00:00
|
|
|
export {
|
2021-09-03 19:00:45 +00:00
|
|
|
SEARCH_TEMPLATE_PARTIALS,
|
2021-07-22 17:27:33 +00:00
|
|
|
searchBoxTemplate,
|
2021-09-13 21:19:58 +00:00
|
|
|
searchBoxDataWithCollapsing,
|
2021-07-22 17:27:33 +00:00
|
|
|
searchBoxData
|
|
|
|
};
|