Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Digital Experience Group
UNL_Search
Commits
3a715311
Commit
3a715311
authored
Aug 09, 2018
by
Eric Rasmussen
Browse files
Split end-scripts.tpl.php into 4.1/5.0 versions because it contains CSS
parent
c79982a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
www/index.php
View file @
3a715311
...
...
@@ -143,7 +143,7 @@ $maincontent .= renderTemplate($templatePath . 'search-results.tpl.php', array(
$initialQuery
=
json_encode
(
isset
(
$_GET
[
'q'
])
?
$_GET
[
'q'
]
:
''
);
$context
=
json_encode
(
$context
);
$maincontent
.
=
renderTemplate
(
'
template
s/
end-scripts.tpl.php'
,
array
(
$maincontent
.
=
renderTemplate
(
$
template
Path
.
'
end-scripts.tpl.php'
,
array
(
'localScriptUrl'
=>
$localScriptUrl
,
'googleLoaderUrl'
=>
'https://cse.google.com/cse.js?cx='
.
$search_engine_id
,
'initialQuery'
=>
$initialQuery
,
...
...
www/templates/end-scripts.tpl.php
→
www/templates/
4.1/
end-scripts.tpl.php
View file @
3a715311
File moved
www/templates/5.0/end-scripts.tpl.php
0 → 100644
View file @
3a715311
<script>
require
([
'
jquery
'
,
'
<?php
echo
$localScriptUrl
?>
'
],
function
(
$
,
UNLSearch
)
{
var
gSearchDefer
=
$
.
Deferred
();
window
.
searchInit
=
function
()
{
window
.
searchInit
=
$
.
noop
;
gSearchDefer
.
resolve
(
google
);
};
window
.
__gcse
=
{
parsetags
:
'
explicit
'
,
callback
:
window
.
searchInit
};
$
(
'
<script>
'
,
{
src
:
'
<?php
echo
$googleLoaderUrl
?>
'
,
async
:
'
async
'
,
defer
:
'
defer
'
,
type
:
'
text/javascript
'
}).
appendTo
(
$
(
'
body
'
));
var
$localCss
=
$
(
'
<link>
'
,
{
'
href
'
:
'
./css/search-google.css?v=20170404
'
});
gSearchDefer
.
done
(
function
(
google
)
{
// ensure this CSS is loaded AFTER google
require
([
'
css!
'
+
$localCss
[
0
].
href
],
function
()
{
UNLSearch
.
initialize
(
<?php
echo
$initialQuery
?>
,
<?php
echo
$localContext
?>
)
});
});
});
</script>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment