Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5974744
searchPresults.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
searchPresults.js
View Options
const
config
=
require
(
'./config.json'
);
const
searchHistory
=
require
(
'./searchHistory.js'
)(
config
);
function
searchPresults
()
{
return
{
renderHistory
:
function
(
results
,
templates
)
{
const
items
=
[];
results
.
forEach
(
(
result
,
index
)
=>
{
items
.
push
(
{
id
:
index
,
href
:
`
${
config
.
wgScriptPath
}
/index.php?title=Special:Search&search=
${
result
}
`
,
text
:
result
,
icon
:
'history'
}
);
}
);
const
data
=
{
type
:
'history'
,
'array-list-items'
:
items
};
const
partials
=
{
TypeaheadListItem
:
templates
.
TypeaheadListItem
};
document
.
getElementById
(
'citizen-typeahead-list-history'
).
outerHTML
=
templates
.
TypeaheadList
.
render
(
data
,
partials
).
html
();
document
.
getElementById
(
'citizen-typeahead-group-history'
).
hidden
=
false
;
},
render
:
function
(
templates
)
{
const
placeholderEl
=
document
.
getElementById
(
'citizen-typeahead-placeholder'
);
placeholderEl
.
innerHTML
=
''
;
placeholderEl
.
hidden
=
true
;
const
historyResults
=
searchHistory
.
get
();
if
(
historyResults
&&
historyResults
.
length
>
0
)
{
this
.
renderHistory
(
historyResults
,
templates
);
}
else
{
const
data
=
{
icon
:
'articlesSearch'
,
title
:
mw
.
message
(
'searchsuggest-search'
).
text
(),
description
:
mw
.
message
(
'citizen-search-empty-desc'
).
text
()
};
placeholderEl
.
innerHTML
=
templates
.
TypeaheadPlaceholder
.
render
(
data
).
html
();
placeholderEl
.
hidden
=
false
;
}
},
clear
:
function
()
{
document
.
getElementById
(
'citizen-typeahead-list-history'
).
innerHTML
=
''
;
document
.
getElementById
(
'citizen-typeahead-group-history'
).
hidden
=
true
;
}
};
}
/** @module searchPresults */
module
.
exports
=
searchPresults
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 3, 17:41 (1 d, 3 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fb/67/c2ad268d56b71fac92a73f19e97c
Default Alt Text
searchPresults.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment