Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1427384
search.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
search.js
View Options
/*!
* JavaScript for Special:Search
*/
(
function
()
{
$
(
()
=>
{
// Emulate HTML5 autofocus behavior in non HTML5 compliant browsers
if
(
!
(
'autofocus'
in
document
.
createElement
(
'input'
)
)
)
{
$
(
'input[autofocus]'
).
eq
(
0
).
trigger
(
'focus'
);
}
// Attach handler for check all/none buttons
const
$checkboxes
=
$
(
'#powersearch input[id^=mw-search-ns]'
);
$
(
'#mw-search-toggleall'
).
on
(
'click'
,
()
=>
{
$checkboxes
.
prop
(
'checked'
,
true
);
}
);
$
(
'#mw-search-togglenone'
).
on
(
'click'
,
()
=>
{
$checkboxes
.
prop
(
'checked'
,
false
);
}
);
// Change the header search links to what user entered
const
$headerLinks
=
$
(
'.search-types a'
);
const
searchWidget
=
OO
.
ui
.
infuse
(
$
(
'#searchText'
)
);
const
updateHeaderLinks
=
function
(
value
)
{
$headerLinks
.
each
(
function
()
{
const
parts
=
$
(
this
).
attr
(
'href'
).
split
(
'search='
);
let
lastpart
=
''
,
prefix
=
'search='
;
if
(
parts
.
length
>
1
&&
parts
[
1
].
indexOf
(
'&'
)
!==
-
1
)
{
lastpart
=
parts
[
1
].
slice
(
parts
[
1
].
indexOf
(
'&'
)
);
}
else
{
prefix
=
'&search='
;
}
this
.
href
=
parts
[
0
]
+
prefix
+
encodeURIComponent
(
value
)
+
lastpart
;
}
);
};
searchWidget
.
on
(
'change'
,
updateHeaderLinks
);
updateHeaderLinks
(
searchWidget
.
getValue
()
);
// When saving settings, use the proper request method (POST instead of GET).
$
(
'#mw-search-powersearch-remember'
).
on
(
'change'
,
function
()
{
this
.
form
.
method
=
this
.
checked
?
'post'
:
'get'
;
}
).
trigger
(
'change'
);
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 16, 14:33 (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e7/61/26eb51fac8d7fc049e99d26d4d11
Default Alt Text
search.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment