Skip to content

Commit f05387d

Browse files
committed
update site
1 parent d41c7db commit f05387d

File tree

4 files changed

+49
-39
lines changed

4 files changed

+49
-39
lines changed

site/components/layout.vue

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Sponsors from './sponsors';
77
import zhCN from 'antd/locale-provider/zh_CN';
88
import enUS from 'antd/locale-provider/default';
99
import sortBy from 'lodash/sortBy';
10+
import axios from 'axios';
1011
import { isZhCN } from '../util';
1112
import { Provider, create } from '../../components/_util/store';
1213
import NProgress from 'nprogress';
@@ -156,13 +157,22 @@ export default {
156157
NProgress.done();
157158
document.documentElement.scrollTop = 0;
158159
try {
159-
document.getElementById('ad').innerHTML = '';
160-
const src = '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio';
161-
const hm = document.createElement('script');
162-
hm.src = src;
163-
hm.id = '_carbonads_js';
164-
const s = document.getElementById('ad');
165-
s.append(hm);
160+
const isGithub = location.host.indexOf('github') !== -1;
161+
if(isGithub){
162+
document.getElementById('ad').innerHTML = '';
163+
const src = '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio';
164+
const hm = document.createElement('script');
165+
hm.src = src;
166+
hm.id = '_carbonads_js';
167+
const s = document.getElementById('ad');
168+
s.append(hm);
169+
} else {
170+
axios.get('https://api.codefund.app/properties/162/funder.html?template=square')
171+
.then(function (response) {
172+
document.getElementById("codefund").innerHTML = response.data;
173+
});
174+
}
175+
166176
} catch (error) {}
167177
},
168178
},

site/index.html

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
</style>
1919
<style>
20-
#ad {
20+
#ad, #codefund {
2121
width: 145px;
2222
position: fixed;
2323
bottom: 10px;
@@ -28,16 +28,24 @@
2828
font-size: 13px;
2929
font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
3030
}
31-
#ad a {
31+
#ad a, #codefund a {
3232
display: inline-block;
3333
color: #7f8c8d;
3434
font-weight: normal;
3535
}
36+
#codefund a {
37+
color: #7f8c8d !important;
38+
font-weight: normal !important;
39+
}
3640
#ad span {
3741
color: #7f8c8d;
3842
display: inline-block;
3943
margin-bottom: 5px;
4044
}
45+
#codefund #cf {
46+
margin-bottom: 0px!important;
47+
border-radius: 0px!important;
48+
}
4149
#ad img {
4250
width: 125px;
4351
}
@@ -48,9 +56,21 @@
4856
font-weight: normal;
4957
color: #34495e;
5058
}
51-
#ad .carbon-poweredby {
52-
color: #aaa;
53-
font-weight: normal;
59+
#ad .carbon-text,
60+
#codefund .cf-text {
61+
display: -webkit-box!important;
62+
-webkit-box-orient: vertical!important;
63+
-webkit-line-clamp: 4!important;
64+
overflow: hidden!important;
65+
}
66+
#codefund .cf-text {
67+
padding-bottom: 5px !important;
68+
font-size: 12px !important;
69+
}
70+
#ad .carbon-poweredby, #codefund .cf-powered-by {
71+
color: #aaa !important;
72+
font-weight: normal !important;
73+
line-height: 1.2 !important;
5474
}
5575
</style>
5676
<script>
@@ -74,6 +94,7 @@
7494
<div id="ad">
7595
<!-- <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio" id="_carbonads_js"></script> -->
7696
</div>
97+
<div id="codefund"></div>
7798
<script>
7899
// var SeedAndDewConfig = {};
79100
// (function() {

site/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Vue from 'vue';
77
import VueI18n from 'vue-i18n';
88
import VueRouter from 'vue-router';
99
import VueClipboard from 'vue-clipboard2';
10+
import NProgress from 'nprogress';
1011
import routes from './routes';
1112
import Md from './components/md';
1213
import Api from './components/api';
@@ -49,6 +50,10 @@ const router = new VueRouter({
4950
fallback: false,
5051
routes,
5152
});
53+
router.beforeEach((to, from, next) => {
54+
NProgress.start();
55+
next();
56+
});
5257
new Vue({
5358
el: '#app',
5459
i18n,

site/routes.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import Layout from './components/layout.vue';
22
import Iframe from './components/iframe.vue';
33
import demoRoutes from './demoRoutes';
4-
import NProgress from 'nprogress';
54

6-
const beforeEnter = (to, from, next) => {
7-
NProgress.start();
8-
next();
9-
};
105
export default [
116
{
127
path: '/ant-design-vue/components',
@@ -15,10 +10,7 @@ export default [
1510
const name = route.path.split('/ant-design-vue/components/')[1].split('/')[0];
1611
return { name, showDemo: true };
1712
},
18-
children: demoRoutes.map(item => ({
19-
...item,
20-
beforeEnter,
21-
})),
13+
children: demoRoutes,
2214
},
2315
{
2416
path: '/ant-design-vue/iframe',
@@ -42,92 +34,74 @@ export default [
4234
{
4335
path: 'docs/vue/customize-theme',
4436
component: () => import('../docs/vue/customize-theme.en-US.md'),
45-
beforeEnter,
4637
},
4738
{
4839
path: 'docs/vue/customize-theme-cn',
4940
component: () => import('../docs/vue/customize-theme.zh-CN.md'),
50-
beforeEnter,
5141
},
5242
{
5343
path: 'docs/vue/getting-started',
5444
component: () => import('../docs/vue/getting-started.en-US.md'),
55-
beforeEnter,
5645
},
5746
{
5847
path: 'docs/vue/getting-started-cn',
5948
component: () => import('../docs/vue/getting-started.zh-CN.md'),
60-
beforeEnter,
6149
},
6250
{
6351
path: 'docs/vue/i18n',
6452
component: () => import('../docs/vue/i18n.en-US.md'),
65-
beforeEnter,
6653
},
6754
{
6855
path: 'docs/vue/i18n-cn',
6956
component: () => import('../docs/vue/i18n.zh-CN.md'),
70-
beforeEnter,
7157
},
7258
{
7359
path: 'docs/vue/introduce',
7460
component: () => import('../docs/vue/introduce.en-US.md'),
75-
beforeEnter,
7661
},
7762
{
7863
path: 'docs/vue/introduce-cn',
7964
component: () => import('../docs/vue/introduce.zh-CN.md'),
80-
beforeEnter,
8165
},
8266
{
8367
path: 'docs/vue/use-with-vue-cli',
8468
component: () => import('../docs/vue/use-with-vue-cli.en-US.md'),
85-
beforeEnter,
8669
},
8770
{
8871
path: 'docs/vue/use-with-vue-cli-cn',
8972
component: () => import('../docs/vue/use-with-vue-cli.zh-CN.md'),
90-
beforeEnter,
9173
},
9274
{
9375
path: 'docs/vue/faq',
9476
component: () => import('../docs/vue/faq.en-US.md'),
95-
beforeEnter,
9677
},
9778
{
9879
path: 'docs/vue/faq-cn',
9980
component: () => import('../docs/vue/faq.zh-CN.md'),
100-
beforeEnter,
10181
},
10282
{
10383
path: 'docs/vue/download',
10484
component: () => import('../docs/vue/download.en-US.md'),
105-
beforeEnter,
10685
},
10786
{
10887
path: 'docs/vue/download-cn',
10988
component: () => import('../docs/vue/download.zh-CN.md'),
110-
beforeEnter,
11189
},
11290
{
11391
path: 'docs/vue/sponsor',
11492
component: () => import('../docs/vue/sponsor.en-US.md'),
115-
beforeEnter,
11693
},
11794
{
11895
path: 'docs/vue/sponsor-cn',
11996
component: () => import('../docs/vue/sponsor.zh-CN.md'),
120-
beforeEnter,
12197
},
12298
{
12399
path: 'docs/vue/changelog',
124100
component: () => import('../CHANGELOG.en-US.md'),
125-
beforeEnter,
126101
},
127102
{
128103
path: 'docs/vue/changelog-cn',
129104
component: () => import('../CHANGELOG.zh-CN.md'),
130-
beforeEnter,
131105
},
132106
{ path: '', redirect: '/ant-design-vue/vue/docs/introduce/' },
133107
],

0 commit comments

Comments
 (0)