Skip to content

Commit 5f44443

Browse files
committed
- Temporarily fallback to local docsify (fixed includes being out of order, see docsifyjs/docsify#866)
1 parent 9487056 commit 5f44443

27 files changed

+8313
-4
lines changed

docs/docsify/lib/docsify.js

Lines changed: 5676 additions & 0 deletions
Large diffs are not rendered by default.

docs/docsify/lib/docsify.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docsify/lib/plugins/disqus.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
(function () {
2+
var fixedPath = location.href.replace('/-/', '/#/');
3+
if (fixedPath !== location.href) {
4+
location.href = fixedPath;
5+
}
6+
7+
function install(hook, vm) {
8+
var dom = Docsify.dom;
9+
var disqus = vm.config.disqus;
10+
if (!disqus) {
11+
throw Error('$docsify.disqus is required')
12+
}
13+
14+
hook.init(function (_) {
15+
var script = dom.create('script');
16+
17+
script.async = true;
18+
script.src = "https://" + disqus + ".disqus.com/embed.js";
19+
script.setAttribute('data-timestamp', Number(new Date()));
20+
dom.appendTo(dom.body, script);
21+
});
22+
23+
hook.mounted(function (_) {
24+
var div = dom.create('div');
25+
div.id = 'disqus_thread';
26+
var main = dom.getNode('#main');
27+
div.style = "width: " + (main.clientWidth) + "px; margin: 0 auto 20px;";
28+
dom.appendTo(dom.find('.content'), div);
29+
30+
// eslint-disable-next-line
31+
window.disqus_config = function() {
32+
this.page.url = location.origin + '/-' + vm.route.path;
33+
this.page.identifier = vm.route.path;
34+
this.page.title = document.title;
35+
};
36+
});
37+
38+
hook.doneEach(function (_) {
39+
if (typeof window.DISQUS !== 'undefined') {
40+
window.DISQUS.reset({
41+
reload: true,
42+
config: function () {
43+
this.page.url = location.origin + '/-' + vm.route.path;
44+
this.page.identifier = vm.route.path;
45+
this.page.title = document.title;
46+
}
47+
});
48+
}
49+
});
50+
}
51+
52+
$docsify.plugins = [].concat(install, $docsify.plugins);
53+
54+
}());

docs/docsify/lib/plugins/disqus.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)