Sha256: 794c37d816f215f8cf2eaf2e97972776003887213a938f3e4fbd619275e987a2
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> <script> function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } }; $(document).ready(function() { var ul = $(".post-list"), q = getUrlParameter("q"), re = new RegExp(q, "gi"); $.getJSON('{{ site.baseurl }}/search.json', function(data) { for (var i = 0; i < data.length; i++) { var matching = false; if (data[i].title.search(re) >= 0) { matching = true; } else if (data[i].date.search(re) >= 0) { matching = true; } else if (data[i].category.search(re) >= 0) { matching = true; } else if (data[i].tags.search(re) >= 0) { matching = true; } else if (data[i].content.search(re) >= 0) { matching = true; } if (matching == true) { ul.append( $('<li>').append( $('<span>', {'class': 'post-meta', 'text': data[i].date}), $('<h3>').append( $('<a>', {'class': 'post-link', 'href': data[i].url, 'text': data[i].title}) ) ) ); } } }); }); </script>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-readthedocs-0.2.1 | _includes/search.html |