This commit is contained in:
vosaul 2020-06-18 17:05:52 +03:00
Родитель 4ab6581d7e
Коммит d821c8e1ed
16 изменённых файлов: 119 добавлений и 84 удалений

Просмотреть файл

@ -71,7 +71,7 @@ color_scheme: "dark"
```
<button class="btn js-toggle-dark-mode">Preview dark color scheme</button>
<script type="text/javascript" src="{{ "/assets/js/dark-mode-preview.js" | absolute_url }}"></script>
<script type="text/javascript" src="{{ "/js/dark-mode-preview.js" | absolute_url }}"></script>

Просмотреть файл

@ -30,7 +30,7 @@ color_scheme: "dark"
```
<button class="btn js-toggle-dark-mode">Preview dark color scheme</button>
<script type="text/javascript" src="{{ "/assets/js/dark-mode-preview.js" | absolute_url }}"></script>
<script type="text/javascript" src="{{ "/js/dark-mode-preview.js" | absolute_url }}"></script>
## Specific visual customization

Просмотреть файл

@ -30,7 +30,7 @@ Before you can use search, you must initialize the feature by running this `rake
$ bundle exec just-the-docs rake search:init
```
This command creates the `search-data.json` file that Jekyll uses to create your search index. Alternatively, you can create the file manually in the `assets/js/` directory of your Jekyll site with this content:
This command creates the `search-data.json` file that Jekyll uses to create your search index. Alternatively, you can create the file manually in the `js/` directory of your Jekyll site with this content:
```liquid
{% raw %}---

Просмотреть файл

@ -17,4 +17,5 @@
background: #1b1f23;
}
</style>
<link rel="sitemap" type="application/xml" title="Sitemap" href="/sitemap.xml" />
</head>

Просмотреть файл

@ -17,6 +17,12 @@
{%- endfor -%}
</nav>
{%- if page.layout == 'docs' -%}
<div class="search">
{%- include search-lunr.html -%}
</div>
{%- endif -%}
<button class="toggle_mnu" id="toggle_menu" onclick="toggle_menu()">
<img src="{{'/assets/images/sandwich_white.png' | relative_url}}" class="open toggle_icon" alt="menu open">
<img src="{{'/assets/images/times.png' | relative_url}}" class="close toggle_icon hidden" alt="menu close">

Просмотреть файл

@ -0,0 +1,14 @@
<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>

Просмотреть файл

@ -1,94 +1,71 @@
<script src="/js/lunr.js"></script>
<script>
{% assign counter = 0 %}
var documents = [{% for page in site.pages %}{% if page.url contains '.xml' or page.url contains 'assets' %} {% else %} {
"id": { { counter } },
{% assign counter = 0 %}
var documents = [{% for page in site.pages %}{% if page.url contains '.xml' or page.url contains 'assets' %}{% else %}{
"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 %}
}, {% endif %} {% endfor %} {% for page in site.without - plugin %} {
"id": { { counter } },
"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 %}{
"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 } },
"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 }}",
"body": "{{ page.date | date: " % Y /% m /% d" }} - {{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
} {% if forloop.last %} {% else %}, {% endif %} {% endfor %}];
"title": "{{ page.title }}",
"body": "{{ page.date | date: "%Y/%m/%d" }} - {{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
}{% if forloop.last %}{% else %}, {% endif %}{% endfor %}];
var idx = lunr(function () {
var idx = lunr(function () {
this.ref('id')
this.field('title')
this.field('body')
documents.forEach(function (doc) {
this.add(doc)
this.add(doc)
}, this)
});
function lunr_search(term) {
});
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;
//put results on the screen.
var results = idx.search(term);
if (results.length > 0) {
//console.log(idx.search(term));
//if results
for (var i = 0; i < results.length; i++) {
// more statements
var ref = results[i]['ref'];
var url = documents[ref]['url'];
var title = documents[ref]['title'];
var body = documents[ref]['body'].substring(0, 160) + '...';
document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML = document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML + "<li class='lunrsearchresult'><a href='" + url + "'><span class='title'>" + title + "</span><br /><span class='body'>" + body + "</span><br /><span class='url'>" + url + "</span></a></li>";
if(term) {
document.getElementById('lunrsearchresults').innerHTML = "<p>Search results for '" + term + "'</p>" + document.getElementById('lunrsearchresults').innerHTML;
//put results on the screen.
var results = idx.search(term);
if(results.length>0){
//console.log(idx.search(term));
//if results
for (var i = 0; i < results.length; i++) {
// more statements
var ref = results[i]['ref'];
var url = documents[ref]['url'];
var title = documents[ref]['title'];
var body = documents[ref]['body'].substring(0,160)+'...';
document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML = document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML + "<li class='lunrsearchresult'><a href='" + url + "'><span class='title'>" + title + "</span><br /><span class='body'>"+ body +"</span><br /><span class='url'>"+ url +"</span></a></li>";
}
} else {
document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML = "<li class='lunrsearchresult'>No results found...</li>";
}
} else {
document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML = "<li class='lunrsearchresult'>No results found...</li>";
}
}
return false;
}
}
</script>
<style>
#lunrsearchresults {
padding-top: 0.2rem;
}
.lunrsearchresult {
padding-bottom: 1rem;
}
.lunrsearchresult .title {
color: #d9230f;
}
.lunrsearchresult .url {
color: silver;
}
.lunrsearchresult a {
display: block;
color: #777;
}
.lunrsearchresult a:hover,
.lunrsearchresult a:focus {
text-decoration: none;
}
.lunrsearchresult a:hover .title {
text-decoration: underline;
}
#lunrsearchresults {padding-top: 0.2rem;}
.lunrsearchresult {padding-bottom: 1rem;}
.lunrsearchresult .title {color: #d9230f;}
.lunrsearchresult .url {color: silver;}
.lunrsearchresult a {display: block; color: #777;}
.lunrsearchresult a:hover, .lunrsearchresult a:focus {text-decoration: none;}
.lunrsearchresult a:hover .title {text-decoration: underline;}
</style>
<form onSubmit="return lunr_search(document.getElementById('lunrsearch').value);">
<p><input type="text" class="form-control" id="lunrsearch" name="q" maxlength="255" value=""
placeholder="Search via Lunr.js" /></p>
<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>

Просмотреть файл

@ -15,7 +15,7 @@
{%- include footer.html -%}
<script src="{{'/assets/js/common.js' | relative_url}}"></script>
<script src="{{'/js/common.js' | relative_url}}"></script>
</body>
</html>

Просмотреть файл

@ -14,7 +14,7 @@
{%- include footer.html -%}
<script src="{{'/assets/js/common.js' | relative_url}}"></script>
<script src="{{'/js/common.js' | relative_url}}"></script>
</body>
</html>

Просмотреть файл

@ -5,7 +5,7 @@ permalink : /docs/
<div class="intro_wrapper">
<section class="intro">
<div class="image_box">
<img src="https://ghicons.github.com/assets/images/blue/svg/Documentation.svg" width="75px" alt="docs">
<img src="https://ghicons.github.com/assets/images/blue/svg/Documentation.svg" alt="docs">
</div>
<div class="text_box">
<h1>{{page.title}}</h1>
@ -15,12 +15,4 @@ permalink : /docs/
</div>
<section class="docs_content">
{{ content }}
<!-- <ul>
{%- for item in site.docs -%}
<li>
<a href="{{item.url}}">{{item.title}}"</a>
<p>{{item.description}}</p>
</li>
{%- endfor -%}
</ul> -->
</section>

Просмотреть файл

@ -7,6 +7,9 @@ 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 }}
</div>

Просмотреть файл

@ -34,6 +34,7 @@ p {
}
li {
margin: 0;
font-size: 15px;
}
.site-header {
@ -476,6 +477,16 @@ li {
}
@media screen and (min-width: 1024px) {
.search {
left: 340px;
position: fixed;
z-index: 1001;
}
#lunrsearchresults {
background: $background-color;
color: $text-color;
padding: 0 20px;
}
.highlighter-rouge {
max-width: 60vw;
}
@ -558,7 +569,7 @@ li {
}
}
@media screen and (min-width: 1440px) {
.content .content_grid .content_item {
.content .content_grid .content_item {
width: 27%;
margin: 10px;
}

1
assets/images/lens.svg Normal file
Просмотреть файл

@ -0,0 +1 @@
<svg aria-hidden="true" class="indexesm__StyledOcticon-sc-1ao7p5-27 xrdzL" height="16" role="img" viewBox="0 0 16 16" width="16" style="display:inline-block;fill:currentColor;user-select:none;vertical-align:text-bottom"><path fill-rule="evenodd" d="M15.7 13.3l-3.81-3.83A5.93 5.93 0 0 0 13 6c0-3.31-2.69-6-6-6S1 2.69 1 6s2.69 6 6 6c1.3 0 2.48-.41 3.47-1.11l3.83 3.81c.19.2.45.3.7.3.25 0 .52-.09.7-.3a.996.996 0 0 0 0-1.41v.01zM7 10.7c-2.59 0-4.7-2.11-4.7-4.7 0-2.59 2.11-4.7 4.7-4.7 2.59 0 4.7 2.11 4.7 4.7 0 2.59-2.11 4.7-4.7 4.7z"></path></svg>

После

Ширина:  |  Высота:  |  Размер: 546 B

Просмотреть файл

Просмотреть файл

30
sitemap.xml Normal file
Просмотреть файл

@ -0,0 +1,30 @@
---
layout: null
---
<?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 %}
<url>
<loc>{{ site.url }}{{ page.url }}</loc>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
{% endif %}
{% endfor %}
{% for page in site.posts %}
<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>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
{% endfor %}
</urlset>