modified head

This commit is contained in:
somrat 2019-12-03 13:42:06 +06:00
parent 6834f26b12
commit 94d0294ef6
2 changed files with 45 additions and 45 deletions

View file

@ -1,49 +1,49 @@
{{ "<!-- banner -->" | safeHTML }} {{ "<!-- banner -->" | safeHTML }}
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 text-center mx-auto"> <div class="col-lg-8 text-center mx-auto">
<h1 class="text-white mb-3">{{ .Site.Params.banner.title }}</h1> <h1 class="text-white mb-3">{{ .Site.Params.banner.title }}</h1>
<p class="text-white mb-4">{{ .Site.Params.banner.description }}</p> <p class="text-white mb-4">{{ .Site.Params.banner.description }}</p>
<div class="position-relative"> <div class="position-relative">
<input id="search" class="form-control" placeholder="{{ .Site.Params.banner.placeholder }}"> <input id="search" class="form-control" placeholder="{{ .Site.Params.banner.placeholder }}">
<!-- Javascript --> <!-- Javascript -->
{{ $currentNode := . }} {{ $currentNode := . }}
{{ $currentNode.Scratch.Set "pages" .Site.Pages }} {{ $currentNode.Scratch.Set "pages" .Site.Pages }}
{{ $pages := ($currentNode.Scratch.Get "pages") }} {{ $pages := ($currentNode.Scratch.Get "pages") }}
<script> <script>
$(function() { $(function() {
var projects = [ var projects = [
{{ range $pages }} {{ range $pages }}
{ {
value: "{{ .Title }}", value: "{{ .Title }}",
label: "{{ .Title }}", label: "{{ .Title }}",
url:"{{ .Permalink }}" url:"{{ .Permalink }}"
}, },
{{ end }} {{ end }}
]; ];
$( "#search" ).autocomplete({ $( "#search" ).autocomplete({
minLength: 0, minLength: 0,
source: projects, source: projects,
focus: function( event, ui ) { focus: function( event, ui ) {
$( "#search" ).val( ui.item.label ); $( "#search" ).val( ui.item.label );
return false; return false;
}, },
select: function( event, ui ) { select: function( event, ui ) {
$( "#search" ).val( ui.item.label ); $( "#search" ).val( ui.item.label );
$( "#project-id" ).val( ui.item.value ); $( "#project-id" ).val( ui.item.value );
return false; return false;
} }
}) })
.data( "ui-autocomplete" )._renderItem = function( ul, item ) { .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
return $( "<li>" ) return $( "<li>" )
.append( "<a href=" + item.url + " + \" &quot;\" + >" + item.label + "</a>" ) .append( "<a href=" + item.url + " + \" &quot;\" + >" + item.label + "</a>" )
.appendTo( ul ); .appendTo( ul );
}; };
}); });
</script> </script>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{ "<!-- /banner -->" | safeHTML }} {{ "<!-- /banner -->" | safeHTML }}

View file

@ -30,7 +30,7 @@
{{ "<!-- Main Stylesheet -->" | safeHTML }} {{ "<!-- Main Stylesheet -->" | safeHTML }}
{{ $styles := resources.Get "css/style.css" | minify}} {{ $styles := resources.Get "css/style.css" | minify}}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen"> <link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
{{ "<!-- jquiry -->" | safeHTML }} {{ "<!-- jquiry -->" | safeHTML }}
<script src="{{ .Site.BaseURL }}plugins/jquery/jquery-1.12.4.js"></script> <script src="{{ .Site.BaseURL }}plugins/jquery/jquery-1.12.4.js"></script>