зеркало из https://github.com/github/mlops.git
Merge pull request #18 from machine-learning-apps/dev
Dev added closer to search results
This commit is contained in:
Коммит
66312c09b0
|
@ -9,4 +9,4 @@ if(!(window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNo
|
|||
ga('send', 'pageview');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<div color="white" display="flex" class="indexesm__Box-sc-1ao7p5-1 indexesm__Flex-sc-1ao7p5-3 kYnOYO">
|
||||
<div style="width: 100%; transform: none; transform-origin: 100% 50% 0px;"><span
|
||||
class="dark-text-input__DarkTextInput-sc-1s5fgl0-0 cgwfPm TextInput-wrapper indexesm__Wrapper2-sc-1ao7p5-56 iFZaQX"
|
||||
width="100%"><input type="text" aria-autocomplete="list" aria-labelledby="downshift-1-label" autocomplete="off"
|
||||
id="downshift-1-input" placeholder="Search" class="indexesm__Input-sc-1ao7p5-55 ibgZfJ" value=""></span></div>
|
||||
<button aria-label="Cancel"
|
||||
class="indexesm__ButtonBase-sc-1ao7p5-16 indexesm__ButtonOutline-sc-1ao7p5-19 dark-button__DarkButton-b3yyu2-0 gEdPKt"><svg
|
||||
aria-hidden="true" class="indexesm__StyledOcticon-sc-1ao7p5-27 xrdzL" height="16" role="img" viewBox="0 0 12 16"
|
||||
width="12" style="display: inline-block; fill: currentcolor; user-select: none; vertical-align: text-bottom;">
|
||||
<path fill-rule="evenodd"
|
||||
d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z">
|
||||
</path>
|
||||
</svg></button>
|
||||
</div>
|
|
@ -7,12 +7,32 @@ var documents = [{% for page in site.pages %}{% if page.url contains '.xml' or p
|
|||
"url": "{{ site.url }}{{ page.url }}",
|
||||
"title": "{{ page.title }}",
|
||||
"body": "{{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
|
||||
}, {% endif %}{% endfor %}{% for page in site.without-plugin %}{
|
||||
}, {% endif %}{% endfor %}
|
||||
{% for page in site.without-plugin %}{
|
||||
"id": {{ counter }},
|
||||
"url": "{{ site.url }}{{ page.url }}",
|
||||
"title": "{{ page.title }}",
|
||||
"body": "{{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
|
||||
}, {% endfor %}{% for page in site.posts %}{
|
||||
}, {% endfor %}
|
||||
{% for page in site.html_pages %}{
|
||||
"id": {{ counter }},
|
||||
"url": "{{ site.url }}{{ page.url }}",
|
||||
"title": "{{ page.title }}",
|
||||
"body": "{{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
|
||||
}, {% endfor %}
|
||||
{% for page in site.team %}{
|
||||
"id": {{ counter }},
|
||||
"url": "{{ site.url }}{{ page.url }}",
|
||||
"title": "{{ page.title }}",
|
||||
"body": "{{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
|
||||
}, {% endfor %}
|
||||
{% for page in site.docs %}{
|
||||
"id": {{ counter }},
|
||||
"url": "{{ site.url }}{{ page.url }}",
|
||||
"title": "{{ page.title }}",
|
||||
"body": "{{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
|
||||
}, {% endfor %}
|
||||
{% for page in site.posts %}{
|
||||
"id": {{ counter }},
|
||||
"url": "{{ site.url }}{{ page.url }}",
|
||||
"title": "{{ page.title }}",
|
||||
|
@ -31,7 +51,7 @@ var idx = lunr(function () {
|
|||
function lunr_search(term) {
|
||||
document.getElementById('lunrsearchresults').innerHTML = '<ul></ul>';
|
||||
if(term) {
|
||||
document.getElementById('lunrsearchresults').innerHTML = "<p>Search results for '" + term + "'</p>" + document.getElementById('lunrsearchresults').innerHTML;
|
||||
document.getElementById('lunrsearchresults').innerHTML = "<p>Search results for '" + term + "'</p>" + "<div id='search_closer' onclick='search_close()'><img src='/assets/images/times.png' alt='closer'></div>" + document.getElementById('lunrsearchresults').innerHTML;
|
||||
//put results on the screen.
|
||||
var results = idx.search(term);
|
||||
if(results.length>0){
|
||||
|
@ -51,11 +71,14 @@ function lunr_search(term) {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
function search_close() {
|
||||
$("#lunrsearchresults").empty();
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
#lunrsearchresults {padding-top: 0.2rem;}
|
||||
.lunrsearchresult {padding-bottom: 1rem;}
|
||||
.lunrsearchresult .title {color: #d9230f;}
|
||||
.lunrsearchresult .title {color: #fff;}
|
||||
.lunrsearchresult .url {color: silver;}
|
||||
.lunrsearchresult a {display: block; color: #777;}
|
||||
.lunrsearchresult a:hover, .lunrsearchresult a:focus {text-decoration: none;}
|
||||
|
@ -67,5 +90,5 @@ function lunr_search(term) {
|
|||
<p><input type="text" class="form-control" id="lunrsearch" name="q" maxlength="255" value="" placeholder="Search" /></p>
|
||||
</form>
|
||||
<div id="lunrsearchresults">
|
||||
<ul></ul>
|
||||
<ul></ul>
|
||||
</div>
|
||||
|
|
|
@ -7,8 +7,6 @@ layout: default_docs
|
|||
<h1 class="doc_title p-name" itemprop="name headline">{{ page.title | escape }}</h1>
|
||||
</header>
|
||||
|
||||
{% include search-lunr.html %}
|
||||
|
||||
|
||||
<div class="doc_content e-content" itemprop="articleBody">
|
||||
{{ content }}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{{content}}
|
|
@ -478,14 +478,21 @@ li {
|
|||
|
||||
@media screen and (min-width: 1024px) {
|
||||
.search {
|
||||
left: 340px;
|
||||
left: 360px;
|
||||
top: 15px;
|
||||
position: fixed;
|
||||
z-index: 1001;
|
||||
}
|
||||
#lunrsearchresults {
|
||||
background: $background-color;
|
||||
background: $background-color;
|
||||
color: $text-color;
|
||||
padding: 0 20px;
|
||||
max-height: 70vh;
|
||||
overflow-y: auto;
|
||||
#search_closer {
|
||||
cursor: pointer;
|
||||
z-index: 9999;
|
||||
}
|
||||
}
|
||||
.highlighter-rouge {
|
||||
max-width: 60vw;
|
||||
|
|
53
js/common.js
53
js/common.js
|
@ -2,57 +2,48 @@ function toggle_menu() {
|
|||
var t = document.getElementsByClassName("toggle_icon");
|
||||
var nav = document.getElementById("navigation");
|
||||
|
||||
if (t[0].classList.contains('hidden')) {
|
||||
t[0].classList.remove('hidden');
|
||||
t[1].classList.add('hidden');
|
||||
t[1].classList.add('hidden');
|
||||
nav.classList.add('hidden');
|
||||
}
|
||||
else {
|
||||
t[0].classList.add('hidden');
|
||||
t[1].classList.remove('hidden');
|
||||
t[1].classList.remove('hidden');
|
||||
nav.classList.remove('hidden');
|
||||
if (t[0].classList.contains("hidden")) {
|
||||
t[0].classList.remove("hidden");
|
||||
t[1].classList.add("hidden");
|
||||
t[1].classList.add("hidden");
|
||||
nav.classList.add("hidden");
|
||||
} else {
|
||||
t[0].classList.add("hidden");
|
||||
t[1].classList.remove("hidden");
|
||||
t[1].classList.remove("hidden");
|
||||
nav.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
$(".tag_filter").click(function () {
|
||||
const filter = '.' + $(this).attr('data-tag');
|
||||
if (filter == '.all') {
|
||||
const filter = "." + $(this).attr("data-tag");
|
||||
if (filter == ".all") {
|
||||
$(".content_item").show();
|
||||
} else {
|
||||
$(".content_item").hide();
|
||||
$(filter).show();
|
||||
}
|
||||
else {
|
||||
$(".content_item").hide();
|
||||
$(filter).show();
|
||||
};
|
||||
$(".tag_filter").removeClass("active");
|
||||
$(this).addClass('active');
|
||||
$(this).addClass("active");
|
||||
});
|
||||
|
||||
/* $(".toggle_sub").click(function () {
|
||||
$(this).toggleClass('rot45');
|
||||
$(this).next('ul').toggleClass('hidden');
|
||||
}); */
|
||||
|
||||
$(document).ready(function () {
|
||||
var sidebar = $(".aside_nav_link");
|
||||
var title = $('.doc_title').text();
|
||||
console.log(sidebar);
|
||||
l=sidebar.length;
|
||||
console.log("leng=" + l);
|
||||
for (i=0; i<l; i++) {
|
||||
var title = $(".doc_title").text();
|
||||
l = sidebar.length;
|
||||
for (i = 0; i < l; i++) {
|
||||
if (sidebar[i].text == title) {
|
||||
var parent = sidebar[i].parentElement.parentElement;
|
||||
if (parent.classList.contains('sub_menu')) {
|
||||
if (parent.classList.contains("sub_menu")) {
|
||||
parent.classList.remove("hidden");
|
||||
var grandparent = parent.parentElement.parentElement;
|
||||
if (grandparent.classList.contains('sub_menu')) {
|
||||
if (grandparent.classList.contains("sub_menu")) {
|
||||
grandparent.classList.remove("hidden");
|
||||
grandparent.classList.add("active");
|
||||
}
|
||||
console.log(sidebar[i].text);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
23
sitemap.xml
23
sitemap.xml
|
@ -1,17 +1,14 @@
|
|||
---
|
||||
layout: null
|
||||
layout: sitemap
|
||||
---
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
{% for page in site.pages %}
|
||||
{% if page.url contains '.xml' or page.url contains 'assets' %}{% else %}
|
||||
{% for page in site.html_pages %}
|
||||
<url>
|
||||
<loc>{{ site.url }}{{ page.url }}</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for page in site.posts %}
|
||||
<url>
|
||||
|
@ -20,6 +17,20 @@ layout: null
|
|||
<priority>1.0</priority>
|
||||
</url>
|
||||
{% endfor %}
|
||||
{% for page in site.docs %}
|
||||
<url>
|
||||
<loc>{{ site.url }}{{ page.url | replace: 'index.html', '' }}</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
{% endfor %}
|
||||
{% for page in site.team %}
|
||||
<url>
|
||||
<loc>{{ site.url }}{{ page.url | replace: 'index.html', '' }}</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
{% endfor %}
|
||||
{% for page in site.without-plugin %}
|
||||
<url>
|
||||
<loc>{{ site.url }}{{ page.url | replace: 'index.html', '' }}</loc>
|
||||
|
@ -27,4 +38,4 @@ layout: null
|
|||
<priority>1.0</priority>
|
||||
</url>
|
||||
{% endfor %}
|
||||
</urlset>
|
||||
</urlset>
|
Загрузка…
Ссылка в новой задаче