Rebuild docsify and delete docs caching code

This commit is contained in:
2022-04-23 00:06:45 +08:00
parent 16183d8b06
commit 6a0e7995df
26 changed files with 13862 additions and 2 deletions

43
docs/lib/plugins/ga.js Normal file
View File

@@ -0,0 +1,43 @@
(function () {
/* eslint-disable no-console */
// From https://github.com/egoist/vue-ga/blob/master/src/index.js
function appendScript() {
var script = document.createElement('script');
script.async = true;
script.src = 'https://www.google-analytics.com/analytics.js';
document.body.appendChild(script);
}
function init(id) {
appendScript();
window.ga =
window.ga ||
function () {
(window.ga.q = window.ga.q || []).push(arguments);
};
window.ga.l = Number(new Date());
window.ga('create', id, 'auto');
}
function collect() {
if (!window.ga) {
init($docsify.ga);
}
window.ga('set', 'page', location.hash);
window.ga('send', 'pageview');
}
var install = function (hook) {
if (!$docsify.ga) {
console.error('[Docsify] ga is required.');
return;
}
hook.beforeEach(collect);
};
$docsify.plugins = [].concat(install, $docsify.plugins);
}());