fix path and add code copy

This commit is contained in:
liuboaibc 2020-08-20 17:45:33 +08:00
parent c2e5ca7db0
commit adc3b8759d
19 changed files with 354 additions and 46 deletions

View File

@ -334,3 +334,36 @@ section {
.code-tabs .active {
display: block;
}
// copy button
.copy-code-button {
display: none;
position: relative;
z-index: 2;
width: 0;
height: 0;
margin-left: auto;
margin-right: 25px;
transform: translateY(5px);
cursor: pointer;
div {
position: absolute;
top: 0;
left: 0;
width: 20px;
height: 20px;
background-image: url('/images/docs/copy-code.svg');
background-repeat: no-repeat;
background-size: cover;
}
}
.copy-code-button:hover {
top: -2px;
}
.highlight pre {
/* Avoid pushing up the copy buttons. */
margin: 0;
}

View File

@ -118,4 +118,118 @@
}
}
}
}
.section-3 {
.common-layout {
box-sizing: border-box;
position: relative;
padding-right: 373px;
border-radius: 8px;
overflow: hidden;
@media only screen and (max-width: $mobile-max-width) {
padding: 0 20px;
}
.left-part-div {
padding: 37px 67px 18px 40px;
background-image: linear-gradient(102deg, #4a499a 28%, #8552c3 119%);
@media only screen and (max-width: $mobile-max-width) {
padding: 20px;
border-radius: 8px;
}
h2 {
font-size: 28px;
color: #ffffff;
}
p {
margin-top: 18px;
font-size: 14px;
line-height: 1.43;
color: #ffffff;
}
.common-flex-layout {
margin-top: 33px;
justify-content: space-around;
div {
position: relative;
img {
width: 186px;
height: 114px;
border-radius: 11px;
object-fit: contain;
}
p {
position: relative;
margin: 0 auto;
top: -10px;
width: 148px;
height: 34px;
font-size: 11px;
line-height: 34px;
text-align: center;
color: #ffffff;
border-radius: 17px;
box-shadow: 0 10px 50px 0 rgba(34, 43, 62, 0.1), 0 8px 16px 0 rgba(33, 43, 61, 0.2);
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1) 97%), linear-gradient(to bottom, #242e42, #242e42);
&:hover {
box-shadow: none;
}
}
}
}
}
.right-part-div {
position: absolute;
top: 0;
bottom: 0;
right: 0;
width: 373px;
box-sizing: border-box;
padding: 124px 66px;
text-align: center;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
background-color: #ffffff;
background-image: url('/images/docs/bg-line.png');
@media only screen and (max-width: $mobile-max-width) {
position: relative;
width: 100%;
margin-top: 20px;
border-radius: 8px;
}
h3 {
font-size: 20px;
color: #3d3e49;
}
button {
width: 148px;
height: 34px;
margin-top: 22px;
border-radius: 17px;
border: none;
font-size: 11px;
font-weight: 600;
color: #ffffff;
cursor: pointer;
box-shadow: 0 10px 50px 0 rgba(34, 43, 62, 0.1), 0 8px 16px 0 rgba(33, 43, 61, 0.2);
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1) 97%), linear-gradient(to bottom, #55bc8a, #55bc8a);
&:hover {
box-shadow: none;
}
}
}
}
}

View File

@ -12,6 +12,8 @@ logo = "images/logo.svg"
githubUrl = "https://github.com/kubesphere/website"
githubBlobUrl = "https://github.com/kubesphere/website/blob/master/content"
githubEditUrl = "https://github.com/kubesphere/website/edit/master/content"
mailchimpSubscribeUrl = "https://kubesphere.us10.list-manage.com/subscribe/post?u=c85ea2b944b08b951f607bdd4&id=83f673a2d9"

View File

@ -9,4 +9,22 @@ section1:
title: KubeSphere Documentation
content: Learn how to build and manage cloud native applications using KubeSphere Container Platform. Get documentation, example code, tutorials, and more.
image: /images/docs/banner.png
section3:
title: Run KubeSphere and Kubernetes Stack from the Cloud Service
description: Cloud Providers are providing KubeSphere as a SaaS and offer cloud-hosted services for users, help you to create an highly available cluster within minutes via several clicks.
list:
- image: /images/docs/aws.jpg
content: AWS Quickstart
link:
- image: /images/docs/qingcloud.svg
content: QingCloud QKE
link:
- image: /images/docs/radore.jpg
content: Radore RCD
link:
titleRight: Want to host KubeSphere on your cloud?
btnContent: Partner with us
btnLink: /partner/
---

View File

@ -15,6 +15,24 @@ icon: "/images/docs/docs.svg"
In this chapter, we will demonstrate how to use KubeKey to provision a new Kubernetes and KubeSphere cluster based on different infrastructures. Kubekey can help you to quickly build a production-ready cluster architecture on a set of machines from zero to one. It also helps you to easily scale the cluster and install pluggable components on existing architecture.
```
console.log('aaa')
```
```html
<div class="menu section-control">
<div></div>
<div></div>
<div></div>
</div>
<div class="menu section-control">
<div></div>
<div></div>
<div></div>
</div>
```
## Most Popular Pages
Below you will find some of the most common and helpful pages from this chapter. We highly recommend you to review them at first.

View File

@ -1,6 +1,6 @@
{{ define "main" }}
{{ with .Params.section1}}
{{ with .Params.section1 }}
<section class='section-1 bg-cover' style='background-image: url("{{ .image }}");'>
<div class="title-div common-layout">
<h1 class="title-h1">{{ .title }}</h1>
@ -14,5 +14,27 @@
{{ partial "section" . }}
</div>
</section>
<script src='{{ "js/markdown-tab.js" | relURL }}'></script>
{{ with .Params.section3 }}
<section class="section-3">
<div class="common-layout">
<div class="left-part-div">
<h2>{{ .title }}</h2>
<p>{{ .description }}</p>
<div class="common-flex-layout">
{{ range .list }}
<div>
<img src="{{ .image }}" alt="">
<p>{{ .content }}</p>
</div>
{{ end }}
</div>
</div>
<div class="right-part-div">
<h3>{{ .titleRight }}</h3>
<a href="{{ .btnLink }}"><button>{{ .btnContent }}</button></a>
</div>
</div>
</section>
{{ end }}
{{ end }}

View File

@ -50,18 +50,20 @@
<div class="contributor-div">
<span>{{ i18n "Last updated" }}:</span>
<span class="update-time"></span>
<ul class="contributor-avatar"></ul>
<a href="{{ .Site.Params.githubBlobUrl }}/{{ .Site.Language.Lang }}/{{ .File.Path }}">
<ul class="contributor-avatar"></ul>
</a>
<span class="more-contributor"></span>
</div>
<div class="mutual-div common-flex-layout">
<div class="edit-div">
<a href="{{ .Site.Params.githubEditUrl}}/{{.Site.Language.Lang}}/{{ .File.Path }}" target="_blank">
<a href="{{ .Site.Params.githubEditUrl }}/{{ .Site.Language.Lang }}/{{ .File.Path }}" target="_blank">
<span class="icon-span"></span>
<span>{{ i18n "edit" }}</span>
</a>
</div>
<div class="feedback-div">
<a href="{{ .Site.Params.githubUrl}}/issues/new" target="_blank">
<a href="{{ .Site.Params.githubUrl }}/issues/new" target="_blank">
<span class="icon-span"></span>
<span>{{ i18n "feedback" }}</span>
</a>
@ -74,15 +76,15 @@
<ul>
<li>
<img src="/images/docs/twitter.svg" alt="twitter">
<a href="http://twitter.com/share?url={{ .Permalink }}&text={{ .Title }}" target="_blank" rel="noopener noreferrer">twitter</a>
<a data-type="twitter" href="http://twitter.com/share?url={{ .Permalink }}&text={{ .Title }}" target="_blank" rel="noopener noreferrer">twitter</a>
</li>
<li>
<img src="/images/docs/linkedIn.svg" alt="linkedIn">
<a href="http://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink }}" target="_blank" rel="noopener noreferrer">linkedIn</a>
<a data-type="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink }}" target="_blank" rel="noopener noreferrer">linkedIn</a>
</li>
<li>
<img src="/images/docs/facebook.svg" alt="facebook">
<a href="http://www.facebook.com/sharer.php?u={{ .Permalink }}" target="_blank" rel="noopener noreferrer">facebook</a>
<a data-type="facebook" href="http://www.facebook.com/sharer.php?u={{ .Permalink }}" target="_blank" rel="noopener noreferrer">facebook</a>
</li>
<li>
<img src="/images/docs/email.svg" alt="email" >
@ -138,12 +140,13 @@
</section>
{{ if .IsPage }}
<script src='{{ "js/aside.js" | relURL }}'></script>
<script src='{{ "js/markdown-tab.js" | relURL }}'></script>
{{ end }}
<script src='{{ "js/share.js" | relURL }}'></script>
<script src='{{ "js/markdown-tab.js" | relURL }}'></script>
<script>
var languageCode = '{{.Site.Language.Lang}}'
var filePath = '{{ .File.Path }}'
var githubUrl = '{{ .Site.Params.githubUrl }}'
// var filePath = 'README.md'
var getLatestTime = function(data) {
@ -245,6 +248,12 @@
})
}
var bindClickContributor = function() {
$('.contributor-avatar').click(function() {
})
}
var __main = function() {
getFileContributors()
bindClickMenu()

View File

@ -10,11 +10,11 @@
{{ end }}
{{ if eq .p1 .p2 }}
<li class="active">
<a href="{{ .p1.Permalink }}">{{ .p1.LinkTitle }}</a>
<a href="{{ .p1.RelPermalink }}">{{ .p1.LinkTitle }}</a>
</li>
{{ else}}
<li>
<a href="{{ .p1.Permalink }}">{{ .p1.LinkTitle }}&nbsp;/&nbsp;</a>
<a href="{{ .p1.RelPermalink }}">{{ .p1.LinkTitle }}&nbsp;/&nbsp;</a>
</li>
{{ end }}

View File

@ -47,6 +47,8 @@
</section>
{{ partial "footer.html" $context }}
<script src='{{ "js/aside.js" | relURL }}'></script>
<script src='{{ "js/markdown-tab.js" | relURL }}'></script>
<script>
var viewer = new Viewer(document.querySelector('.md-body'), {
url: 'src'

View File

@ -44,9 +44,9 @@
{{ else }}
<li {{ if eq $section .URL }} class="active"{{ end}}>
{{ if hasPrefix .URL "http" }}
<a href="{{ .URL }}" target="_blank" rel="noopener noreferrer">{{ .Name }}</a>
<a data-docs="{{ .Name }}" href="{{ .URL }}" target="_blank" rel="noopener noreferrer">{{ .Name }}</a>
{{ else }}
<a href="{{ .URL | relLangURL }}">{{ .Name }}</a>
<a data-docs="{{ .Name }}" href="{{ .URL | relLangURL }}">{{ .Name }}</a>
{{ end }}
</li>
{{ end }}
@ -116,7 +116,7 @@
</ul>
</li>
{{ else }}
<li {{ if eq $section .URL }} class="active"{{ end}}><a href="{{ .URL | relLangURL }}">{{ .Name }}</a></li>
<li {{ if eq $section .URL }} class="active"{{ end}}><a data-docs="{{ .Name }}" href="{{ .URL | relLangURL }}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
@ -197,6 +197,28 @@ var bindClickClose = function() {
})
}
var language = '{{.Site.Language.Lang}}'
var bindClickDocs = function() {
var host = window.location.origin
$('a').click(function(e) {
var name = $(this).data('docs')
if (name === 'Documentation') {
e.preventDefault()
if (host === 'https://kubesphere.com.cn/' || host === 'https://kubesphere.io/') {
if (language === 'zh') {
window.open('https://kubesphere.com.cn/docs/zh-CN/')
} else {
window.open('https://kubesphere.io/docs/')
}
} else {
window.open('/docs/')
}
}
})
}
bindClickDocs()
bindClickClose()
bindScrollChangeHeader()

View File

@ -25,6 +25,6 @@
</li>
{{ end }}
{{ range $sections }}
<li style="height: 0;"></li>
<li style="height: 0; margin: 0; padding: 0;"></li>
{{ end }}
</ul>

View File

@ -1,17 +1,18 @@
<div class="share">
<a href="http://twitter.com/share?url={{ .Permalink }}&text={{ .Title }}" target="_blank" rel="noopener noreferrer">
<a data-type="twitter" href="http://twitter.com/share?url={{ .Permalink }}&text={{ .Title }}" target="_blank" rel="noopener noreferrer">
<img src="/images/share/Twitter.svg" alt="twitter icon">
</a>
<a href="http://reddit.com/submit?url={{ .Permalink }}&title={{ .Title }}" target="_blank" rel="noopener noreferrer">
<a data-type="reddit" href="http://reddit.com/submit?url={{ .Permalink }}&title={{ .Title }}" target="_blank" rel="noopener noreferrer">
<img src="/images/share/Reddit.svg" alt="reddit icon">
</a>
<a href="http://www.facebook.com/sharer.php?u={{ .Permalink }}" target="_blank" rel="noopener noreferrer">
<a data-type="facebook" href="http://www.facebook.com/sharer.php?u={{ .Permalink }}" target="_blank" rel="noopener noreferrer">
<img src="/images/share/Facebook.svg" alt="facebook icon">
</a>
<a href="http://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink }}" target="_blank" rel="noopener noreferrer">
<a data-type="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink }}" target="_blank" rel="noopener noreferrer">
<img src="/images/share/Linkedin.svg" alt="linkedin icon">
</a>
<a href="https://news.ycombinator.com/submitlink?u={{ .Permalink }}&t={{ .Title }}" target="_blank" rel="noopener noreferrer">
<a data-type="hackernews" href="https://news.ycombinator.com/submitlink?u={{ .Permalink }}&t={{ .Title }}" target="_blank" rel="noopener noreferrer">
<img src="/images/share/HackerNews.svg" alt="hackernews icon">
</a>
</div>
</div>
<script src='{{ "js/share.js" | relURL }}'></script>

BIN
static/images/docs/aws.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24pt" height="24pt" viewBox="0 0 24 24">\a<path style="stroke:none;fill-rule:nonzero;fill:#646464;fill-opacity:1" d="M4 2C2.894531 2 2 2.894531 2 4V17C2 17.550781 2.449219 18 3 18S4 17.550781 4 17V4H17C17.550781 4 18 3.550781 18 3S17.550781 2 17 2zM8 6C6.894531 6 6 6.894531 6 8V20C6 21.105469 6.894531 22 8 22H20C21.105469 22 22 21.105469 22 20V8C22 6.894531 21.105469 6 20 6zM8 8H20V20H8zM8 8"/></svg>

After

Width:  |  Height:  |  Size: 493 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" width="186" height="114" viewBox="0 0 186 114">
<g fill="none" fill-rule="evenodd">
<rect width="186" height="114" fill="#FFF" rx="11"/>
<g>
<g fill="#00A971">
<path d="M29.054 27.686L36.867 32.163 29.054 36.642zM29.674 26.627L37.481 22.148 37.481 31.1zM29.054 16.609L36.867 21.09 29.054 25.569zM.7 10.016L8.511 5.537 8.511 14.491zM.083 11.074L7.896 15.552.083 20.028zM.083 22.148L7.896 26.627.083 31.104zM29.054 5.536L36.869 10.016 29.054 14.494zM29.674 15.552L37.481 11.077 37.481 20.027zM20.018 10.014L27.826 5.537 27.826 14.49zM20.018 32.156L27.826 27.685 27.826 36.632zM10.359 4.48L18.167 8.956 18.167 0zM19.398 0L19.398 8.957 27.211 4.48zM19.398 33.22L27.211 37.697 19.398 42.177zM20.018 43.235L27.826 38.758 27.826 47.712zM9.741 27.686L17.552 32.163 9.741 36.642zM9.741 5.532L17.552 10.011 9.741 14.49zM.7 21.09L8.511 16.614 8.511 25.567zM.7 32.163L8.511 27.689 8.511 36.639zM10.359 37.701L18.168 33.223 18.168 42.177z" transform="translate(57 18) translate(16.8)"/>
</g>
<g fill="#3D3E49">
<path d="M1.802 9.03c0 .623 1.18 1.474 1.746 1.474.6 0 1.783-.851 1.783-1.473V3.242c0-.622-1.167-1.473-1.783-1.473-.566 0-1.746.851-1.746 1.473v5.789zm5.328.233c0 .814-1.056 1.81-1.983 2.289.802.392 1.237.622 1.62.872.289.176.381.337.274.638-.073.23-.438.746-.71.746-.22 0-.347-.072-.673-.303-.546-.336-1.71-1.046-3.038-1.58C1.455 11.462 0 10.237 0 9.262V3.01C0 1.786 2.33.135 3.548.135c1.256 0 3.582 1.65 3.582 2.876v6.252zM11.02 11.588c0 .214-.164.393-.4.393h-1c-.218 0-.4-.18-.4-.393V.686c0-.214.182-.392.4-.392h1c.236 0 .4.178.4.392v10.902zM15.059 4.129v7.46c0 .23-.184.392-.436.392h-.912c-.219 0-.415-.162-.415-.393V.686c0-.214.196-.392.415-.392h.764c.292 0 .418.142.565.392l3.675 7.528V.686c0-.232.162-.392.4-.392h.926c.237 0 .418.16.418.392v10.902c0 .23-.18.393-.418.393h-.745c-.273 0-.457-.198-.565-.393L15.06 4.13zM26.444 5.675c0-.214.2-.391.416-.391h2.22c.238 0 .58.338.58.55v3.429c0 1.19-2.29 2.876-3.545 2.876-1.218 0-3.565-1.687-3.565-2.876V3.01c0-1.225 2.365-2.876 3.565-2.876.782 0 1.947.585 2.8 1.1.221.125.291.374.183.587l-.31.585c-.108.196-.4.267-.634.143-.657-.337-1.547-.78-2.039-.78-.546 0-1.763.85-1.763 1.473V9.03c0 .605 1.198 1.474 1.763 1.474.545 0 1.747-.889 1.747-1.474V6.829H26.86c-.217 0-.416-.178-.416-.39v-.764zM33.117 9.03c0 .642 1.253 1.493 1.745 1.493.51 0 1.255-.39 1.911-.747.254-.123.564-.052.672.179l.293.586c.108.23.035.48-.164.585-.84.497-1.856 1.013-2.712 1.013-1.183 0-3.546-1.58-3.546-2.876V3.01c0-1.26 2.347-2.876 3.565-2.876.764 0 1.82.515 2.673.995.219.105.292.39.165.603l-.274.569c-.108.213-.399.282-.636.158-.654-.32-1.418-.71-1.928-.71-.511 0-1.764.852-1.764 1.492v5.789zM39.263 11.25V.686c0-.214.2-.392.419-.392h.946c.234 0 .434.178.434.392v9.748h3.422c.235 0 .416.177.416.39v.764c0 .214-.18.393-.416.393H39.97c-.254 0-.708-.5-.708-.73M47.465 9.03c0 .623 1.183 1.474 1.745 1.474.602 0 1.785-.851 1.785-1.473V3.242c0-.622-1.164-1.473-1.785-1.473-.562 0-1.745.851-1.745 1.473v5.789zm5.328.233c0 1.223-2.328 2.876-3.583 2.876-1.218 0-3.547-1.635-3.547-2.876V3.01c0-1.225 2.329-2.876 3.547-2.876 1.255 0 3.583 1.65 3.583 2.876v6.252zM58.34 12.139c-1.202 0-3.545-1.58-3.545-2.86V.685c0-.213.196-.39.414-.39h.968c.235 0 .415.177.415.39V9.05c0 .622 1.184 1.474 1.748 1.474.564 0 1.747-.852 1.747-1.474V.685c0-.213.163-.39.381-.39h1c.218 0 .418.177.418.39V9.28c0 1.244-2.347 2.86-3.546 2.86M69.25 3.295c0-.587-1.09-1.473-1.745-1.473H65.87v8.63h1.673c.635 0 1.707-.904 1.707-1.473V3.295zm1.801 5.93c0 1.067-2.036 2.756-3.272 2.756H64.94c-.51 0-.872-.303-.872-.66V.987c0-.373.4-.692.872-.692h2.8c1.275 0 3.311 1.562 3.311 2.753v6.179z" transform="translate(57 18) translate(0 56)"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -1,25 +1,59 @@
// tab
$('.tab-content').find('.tab-pane').each(function (idx, item) {
var navTabs = $(this).closest('.code-tabs').find('.nav-tabs'),
title = $(this).attr('title');
navTabs.append('<li class="nav-item"><a class="nav-link" href="#">' + title + '</a></li>');
// tab
$('.tab-content').find('.tab-pane').each(function (idx, item) {
var navTabs = $(this).closest('.code-tabs').find('.nav-tabs'),
title = $(this).attr('title');
navTabs.append('<li class="nav-item"><a class="nav-link" href="#">' + title + '</a></li>');
});
$('.code-tabs ul.nav-tabs').each(function () {
$(this).find("li:first").addClass('active');
})
$('.code-tabs .tab-content').each(function () {
$(this).find("div:first").addClass('active');
});
$('.nav-tabs a').click(function (e) {
e.preventDefault();
var tab = $(this).parent(),
tabIndex = tab.index(),
tabPanel = $(this).closest('.code-tabs'),
tabPane = tabPanel.find('.tab-pane').eq(tabIndex);
tabPanel.find('.active').removeClass('active');
tab.addClass('active');
tabPane.addClass('active');
});
// copy button
function addCopyButtons(clipboard) {
document.querySelectorAll('pre > code').forEach(function (codeBlock) {
var button = document.createElement('div');
button.className = 'copy-code-button';
button.type = 'button';
var inner = document.createElement('div');
button.appendChild(inner)
button.addEventListener('click', function () {
clipboard.writeText(codeBlock.innerText).then(function () {
/* Chrome doesn't seem to blur automatically,
leaving the button in a focused state. */
button.blur();
}, function (error) {
});
});
var pre = codeBlock.parentNode
pre.addEventListener('mouseenter', function() {
button.style.display = 'block'
})
pre.addEventListener('mouseleave', function() {
button.style.display = 'none'
})
pre.insertBefore(button, codeBlock);
});
$('.code-tabs ul.nav-tabs').each(function () {
$(this).find("li:first").addClass('active');
})
$('.code-tabs .tab-content').each(function () {
$(this).find("div:first").addClass('active');
});
$('.nav-tabs a').click(function (e) {
e.preventDefault();
var tab = $(this).parent(),
tabIndex = tab.index(),
tabPanel = $(this).closest('.code-tabs'),
tabPane = tabPanel.find('.tab-pane').eq(tabIndex);
tabPanel.find('.active').removeClass('active');
tab.addClass('active');
tabPane.addClass('active');
});
}
if (navigator && navigator.clipboard) {
addCopyButtons(navigator.clipboard);
}

19
static/js/share.js Normal file
View File

@ -0,0 +1,19 @@
var title = document.title
var bindClickShare = function() {
var url = window.location.href
var urlObj = {
twitter: 'http://twitter.com/share?url=' + url + '&text=' + title,
reddit: 'http://reddit.com/submit?url=' + url + '&title=' + title,
facebook: 'http://www.facebook.com/sharer.php?u=' + url,
linkedin: 'http://www.linkedin.com/shareArticle?mini=true&url=' + url,
hackernews: 'https://news.ycombinator.com/submitlink?u=' + url + '&t=' + title,
}
$('a').click(function(e) {
var type = $(this).data('type')
if (type) {
e.preventDefault()
window.open(urlObj[type])
}
})
}
bindClickShare()