Skip to content

Commit c5f3b19

Browse files
committed
initial
0 parents  commit c5f3b19

213 files changed

Lines changed: 50253 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

8 KB
Binary file not shown.

.github/workflows/deploy.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy Github-Pages from markdown files
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
# pull_request:
7+
# branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [14.x]
15+
16+
steps:
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
22+
- uses: actions/checkout@v2
23+
24+
- name: Run Export
25+
run: |
26+
export TZ='Asia/Shanghai'
27+
npm install
28+
npm run build
29+
30+
- name: Deploy Github-Pages
31+
uses: JamesIves/github-pages-deploy-action@4.1.4
32+
with:
33+
branch: gh-pages
34+
folder: .vuepress/dist

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Swap
2+
[._]*.s[a-v][a-z]
3+
!*.svg # comment out if you don't need vector files
4+
[._]*.sw[a-p]
5+
[._]s[a-rt-v][a-z]
6+
[._]ss[a-gi-z]
7+
[._]sw[a-p]
8+
9+
# Session
10+
Session.vim
11+
Sessionx.vim
12+
13+
# Temporary
14+
.netrwhist
15+
i
16+
oo
17+
*~
18+
# Auto-generated tag files
19+
tags
20+
# Persistent undo
21+
[._]*.un~
22+
23+
node_modules
24+
dist
25+
manifest
26+
.temp
27+
.obsidian

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: node_js
2+
node_js:
3+
- lts/*
4+
before_install:
5+
- export TZ='Asia/Shanghai'
6+
install:
7+
- npm install
8+
script:
9+
- npm run build
10+
- echo "tech.codelc.com" >> .vuepress/dist/CNAME
11+
deploy:
12+
- provider: pages
13+
skip_cleanup: true
14+
local_dir: .vuepress/dist
15+
github_token: $gh_token
16+
keep_history: true
17+
target-branch: gh-pages
18+
on:
19+
branch: master
20+
#- provider: script
21+
#keep_history: true
22+
#skip_cleanup: true
23+
#script: npm run deoply:refresh-cdn
24+
#on:
25+
# branch: master

.vuepress/components/GlobalTOC.vue

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<template>
2+
<div>
3+
<div v-if="level===0" class="updateInfo not-print">
4+
标记显示出
5+
<select style="height: 23px;" v-model="updateDays">
6+
<option value="0" selected>当天</option>
7+
<option value="3">3天</option>
8+
<option value="7">7天</option>
9+
<option value="30">1月</option>
10+
<option value="180">半年</option>
11+
<option value="99999">全部</option>
12+
</select>
13+
内更新的内容
14+
</div>
15+
<ol>
16+
<li v-for="page in information">
17+
<span v-if="page.links != null">
18+
<a :href="page.links">
19+
<span :class="'level'+level">{{page.title}}</span>
20+
</a>
21+
<div class="not-print" style="display: inline-block">
22+
<Badge type="error" v-if="checkUpdate(page)">
23+
{{page.update === 0 ? '当天更新': page.update+'天前更新'}}
24+
</Badge>
25+
</div>
26+
<span class="words">{{page.words}}</span>
27+
</span>
28+
<span v-else :class="'level'+level">
29+
{{page.title}}
30+
<span class="words">{{page.words}}</span>
31+
</span>
32+
<GlobalTOC v-if="showDays === undefined" :pages="page.children" :level="level + 1" :showDays="updateDays"/>
33+
<GlobalTOC v-else :pages="page.children" :level="level + 1" :showDays="showDays"/>
34+
</li>
35+
</ol>
36+
</div>
37+
</template>
38+
39+
<script>
40+
import Badge from '@vuepress/theme-default/global-components/Badge'
41+
import moment from 'moment'
42+
43+
import {resolvePage} from '@parent-theme/util'
44+
45+
export default {
46+
name: "GlobalTOC",
47+
data() {
48+
return {
49+
updateDays: 0,
50+
items: [],
51+
information: []
52+
}
53+
},
54+
props: ['pages', 'level', 'showDays'],
55+
created: function () {
56+
if (this.pages) {
57+
let origin = (this.pages === '/' ? this.$themeConfig.sidebar : this.pages);
58+
this.items = origin.map(item => {
59+
let page
60+
if (item.path) {
61+
page = resolvePage(this.$site.pages, item.path, this.$route.path)
62+
} else if (typeof (item) === 'string') {
63+
page = resolvePage(this.$site.pages, item, this.$route.path)
64+
} else {
65+
page = item;
66+
}
67+
page.children = item.children
68+
return page;
69+
})
70+
this.information = this.items.map(item => {
71+
return {
72+
title: this.getTitle(item),
73+
words: this.getWords(item),
74+
links: this.getLinks(item),
75+
update: this.getUpdate(item),
76+
lastUpdated: item.lastUpdated,
77+
children: item.children
78+
}
79+
})
80+
}
81+
},
82+
methods: {
83+
checkUpdate: function (page) {
84+
return page.update <= Math.max(this.updateDays, this.showDays);
85+
},
86+
getTitle: function (page) {
87+
try {
88+
return page.title.replace('✔️ ', '')
89+
} catch (e) {
90+
return "标题错误"
91+
}
92+
},
93+
getWords: function (page) {
94+
if (page && page.readingTime) {
95+
return `${page.readingTime.words.toLocaleString()} 字 `
96+
} else {
97+
return ""
98+
}
99+
},
100+
getLinks: function (page) {
101+
//return (page.readingTime && page.readingTime.words > 100) ? "/TechShare" + page.path : null
102+
return (page.readingTime && page.readingTime.words > 100) ? page.path : null
103+
},
104+
getUpdate: function (page) {
105+
let lastDay = new moment(page.lastUpdated, 'L');
106+
return Math.floor(-1 * moment.duration(lastDay.diff(new Date())).asDays())
107+
}
108+
}
109+
}
110+
</script>
111+
112+
<style scoped>
113+
ol {
114+
padding: 0 0 0 20px;
115+
margin: 0;
116+
list-style: none;
117+
counter-reset: a;
118+
}
119+
120+
li:before {
121+
counter-increment: a;
122+
content: counters(a, ".") ". ";
123+
line-height: 35px;
124+
}
125+
126+
.words {
127+
font-size: 14px;
128+
color: #999;
129+
float: right;
130+
}
131+
132+
.level0 {
133+
font-size: 17px;
134+
line-height: 44px;
135+
font-weight: bold;
136+
}
137+
138+
.updateInfo {
139+
text-align: right;
140+
margin: 0 10px 20px 0;
141+
color: #666;
142+
font-size: 14px;
143+
}
144+
</style>

.vuepress/components/SvgBadge.vue

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<template>
2+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" :width="imageWidth(ll+lv)"
3+
height="20">
4+
<linearGradient id="b" x2="0" y2="100%">
5+
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
6+
<stop offset="1" stop-opacity=".1"/>
7+
</linearGradient>
8+
<clipPath :id="'a'+imageWidth(ll+lv)">
9+
<rect :width="imageWidth(ll+lv)" height="20" rx="3" fill="#fff"/>
10+
</clipPath>
11+
<g :clip-path="'url(#a'+imageWidth(ll+lv)+')'">
12+
<path fill="#555" :d="d1()"/>
13+
<path :fill="color" :d="d2()"/>
14+
<path fill="url(#b)" :d="d3()"/>
15+
</g>
16+
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
17+
<text :x="ll * 40 + 55" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)"
18+
:textLength="ll * 80 - 10">{{label}}
19+
</text>
20+
<text :x="ll * 40 + 55" y="140" transform="scale(.1)" :textLength="ll * 80 - 10">
21+
{{label}}
22+
</text>
23+
<text :x="ll * 80 + lv * 40 + 125" y="150" fill="#010101" fill-opacity=".3"
24+
transform="scale(.1)" :textLength="lv * 80 - 10">{{value}}
25+
</text>
26+
<text :x="ll * 80 + lv * 40 + 125" y="140" transform="scale(.1)"
27+
:textLength="lv * 80 - 10">{{value}}
28+
</text>
29+
</g>
30+
</svg>
31+
</template>
32+
33+
<script>
34+
export default {
35+
name: "SvgBadge",
36+
props: {
37+
label: String,
38+
value: String,
39+
color: String
40+
},
41+
computed: {
42+
ll: function () {
43+
return this.label.length - 1
44+
},
45+
lv: function () {
46+
return this.value.length - 1
47+
}
48+
},
49+
methods: {
50+
imageWidth: function (x) {
51+
return x * 8 + 18
52+
},
53+
// 含义:M偏移 0h宽度v20高度0z
54+
d1: function () {
55+
return 'M0 0h' + (this.ll * 8 + 9) + 'v20H0z'
56+
},
57+
d2: function () {
58+
return 'M' + (this.ll * 8 + 9) + ' 0h' + (this.lv * 8 + 9) + 'v20H' + (this.ll * 8 + 9) + 'z'
59+
},
60+
d3: function () {
61+
return 'M0 0h' + ((this.ll + this.lv) * 8 + 18) + 'v20H0z'
62+
}
63+
}
64+
}
65+
</script>
66+
67+
<style scoped>
68+
</style>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<script>
2+
export default {
3+
name: 'github-button',
4+
props: ['href', 'ariaLabel', 'title', 'dataIcon', 'dataColorScheme', 'dataSize', 'dataShowCount', 'dataText'],
5+
render: function (h) {
6+
return h('span', [
7+
h('a', {
8+
attrs: {
9+
'href': this.href,
10+
'aria-label': this.ariaLabel,
11+
'title': this.title,
12+
'data-icon': this.dataIcon,
13+
'data-color-scheme': this.dataColorScheme,
14+
'data-size': this.dataSize,
15+
'data-show-count': this.dataShowCount,
16+
'data-text': this.dataText
17+
},
18+
ref: '_'
19+
}, this.$slots.default)
20+
])
21+
},
22+
mounted: function () {
23+
this.paint()
24+
},
25+
beforeUpdate: function () {
26+
this.reset()
27+
},
28+
updated: function () {
29+
this.paint()
30+
},
31+
beforeDestroy: function () {
32+
this.reset()
33+
},
34+
methods: {
35+
paint: function () {
36+
const _ = this.$el.appendChild(document.createElement('span'))
37+
const _this = this
38+
import(/* webpackMode: "eager" */ 'github-buttons').then(function (module) {
39+
module.render(_.appendChild(_this.$refs._), function (el) {
40+
try {
41+
_.parentNode.replaceChild(el, _)
42+
} catch (_) {
43+
}
44+
})
45+
})
46+
},
47+
reset: function () {
48+
this.$el.replaceChild(this.$refs._, this.$el.lastChild)
49+
}
50+
}
51+
}
52+
</script>

0 commit comments

Comments
 (0)