40 lines
1.1 KiB
HTML
40 lines
1.1 KiB
HTML
|
{{- if eq .Site.Params.enablecopycode true -}}
|
||
|
{{- $copyJs := "js/copycode.js" -}}
|
||
|
{{ if (findRE "<code" .Content 1) }}
|
||
|
|
||
|
{{ $jsCopy :=resources.Get "js/copycode.js" | minify }}
|
||
|
<script src="{{ $jsCopy.RelPermalink }}"></script>
|
||
|
{{ end }}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{ if eq .Site.Params.enablesearch true }}
|
||
|
{{ $searchJs := resources.Get "js/search.js"
|
||
|
| minify
|
||
|
| resources.ExecuteAsTemplate "search.js" .
|
||
|
| fingerprint
|
||
|
}}
|
||
|
<script src="{{ $searchJs.RelPermalink }}"></script>
|
||
|
|
||
|
<script>
|
||
|
$(document).ready(function () {
|
||
|
|
||
|
// Show the Modal on load
|
||
|
$("#searchBtn").click(function () {
|
||
|
$("#searchModal").modal("show");
|
||
|
});
|
||
|
|
||
|
// Hide the Modal
|
||
|
$("#hideBtn").click(function () {
|
||
|
$("#searchModal").modal("hide");
|
||
|
});
|
||
|
// Show the Modal on pressing enter
|
||
|
$("#search").keypress(function (event) {
|
||
|
var keycode = (event.keyCode ? event.keyCode : event.which);
|
||
|
if (keycode == '13') {
|
||
|
$("#searchBtn").click();
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
{{ end }}
|