mirror of
https://github.com/zhigang1992/docsify.git
synced 2026-04-24 05:06:08 +08:00
fix: remove codesponsor
This commit is contained in:
@@ -15,9 +15,6 @@
|
||||
</p>
|
||||
|
||||
|
||||
<a target='_blank' rel='nofollow' href='https://app.codesponsor.io/link/YdWAqnN2kHQmLtFQhEddaaPT/QingWei-Li/docsify'> <img alt='Sponsor' width='888' height='68' src='https://app.codesponsor.io/embed/YdWAqnN2kHQmLtFQhEddaaPT/QingWei-Li/docsify.svg' /></a>
|
||||
|
||||
|
||||
## Links
|
||||
|
||||
- [Documentation](https://docsify.js.org)
|
||||
|
||||
@@ -48,7 +48,6 @@ var plugins = [
|
||||
{ name: 'external-script', entry: 'external-script.js' },
|
||||
{ name: 'front-matter', entry: 'front-matter/index.js' },
|
||||
{ name: 'zoom-image', entry: 'zoom-image.js' },
|
||||
{ name: 'codesponsor', entry: 'codesponsor.js' },
|
||||
{ name: 'disqus', entry: 'disqus.js' },
|
||||
{ name: 'gitalk', entry: 'gitalk.js' }
|
||||
]
|
||||
|
||||
@@ -106,19 +106,3 @@ Exclude the special image
|
||||
## Edit on github
|
||||
|
||||
Add `Edit on github` button on every pages. provided by 3rd party, check [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
See https://codesponsor.io
|
||||
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
codesponsor: 'id'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
```
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
mergeNavbar: true,
|
||||
maxLevel: 4,
|
||||
subMaxLevel: 2,
|
||||
codesponsor: '7c9Ms7xRs-j_y_8abU03DA',
|
||||
ga: 'UA-106147152-1',
|
||||
name: 'docsify',
|
||||
search: {
|
||||
@@ -56,7 +55,7 @@
|
||||
hook.beforeEach(function (html) {
|
||||
var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs/' + vm.route.file
|
||||
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
||||
|
||||
|
||||
return editHtml
|
||||
+ html
|
||||
+ '\n----\n'
|
||||
@@ -69,7 +68,6 @@
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
||||
|
||||
@@ -116,18 +116,6 @@ When readers expand the demo box, the source code and description are shown ther
|
||||
|
||||
[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported.
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
See https://codesponsor.io
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
codesponsor: 'id'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
```
|
||||
|
||||
## Copy to Clipboard
|
||||
|
||||
|
||||
@@ -103,19 +103,3 @@ Medium's 风格的图片缩放插件. 基于 [medium-zoom](https://github.com/fr
|
||||
## 在 Github 上编辑
|
||||
|
||||
在每一页上添加 `Edit on github` 按钮. 由第三方库提供, 查看 [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
参考 https://codesponsor.io
|
||||
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
codesponsor: 'id'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
```
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
const DEFAULT_OPTIONS = {
|
||||
theme: 'light',
|
||||
image: 'show'
|
||||
}
|
||||
|
||||
function tpl (id, options) {
|
||||
const qs = []
|
||||
|
||||
for (const key in options) {
|
||||
qs.push(`${key}=${options[key]}`)
|
||||
}
|
||||
|
||||
const div = Docsify.dom.create('div')
|
||||
|
||||
Docsify.dom.toggleClass(div, 'codesponsor')
|
||||
div.innerHTML = `<iframe
|
||||
scrolling=0
|
||||
frameborder=0
|
||||
width=250
|
||||
height=auto
|
||||
style="max-height: 250px;"
|
||||
id="code-sponsor-embed-iframe"
|
||||
src="https://app.codesponsor.io/widgets/${id}?${qs.join('&')}">
|
||||
</iframe>`
|
||||
|
||||
return div
|
||||
}
|
||||
|
||||
function appIframe (id, opts) {
|
||||
const html = tpl(id, opts)
|
||||
|
||||
Docsify.dom.before(Docsify.dom.find('section.content'), html)
|
||||
}
|
||||
|
||||
function appendStyle () {
|
||||
Docsify.dom.style(`
|
||||
.codesponsor {
|
||||
position: relative;
|
||||
float: right;
|
||||
right: 10px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1600px) {
|
||||
body.sticky .codesponsor {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.codesponsor {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
top: auto;
|
||||
float: none;
|
||||
}
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
const install = function (hook, vm) {
|
||||
let config = vm.config.codesponsor
|
||||
let id
|
||||
|
||||
if (typeof config === 'string') {
|
||||
id = config
|
||||
config = {}
|
||||
} else {
|
||||
id = config.id
|
||||
}
|
||||
|
||||
const opts = Docsify.util.merge(DEFAULT_OPTIONS, config)
|
||||
|
||||
if (!id) {
|
||||
throw Error('codesponsor plugin need id')
|
||||
}
|
||||
|
||||
if (Docsify.util.isMobile) {
|
||||
return
|
||||
}
|
||||
|
||||
// Append style
|
||||
hook.ready(() => {
|
||||
appendStyle()
|
||||
appIframe(id, opts)
|
||||
})
|
||||
}
|
||||
|
||||
window.$docsify.plugins = [].concat(install, window.$docsify.plugins)
|
||||
Reference in New Issue
Block a user