bump: 2.2.0

This commit is contained in:
qingwei.li 2017-02-09 22:17:23 +08:00
parent ac61bb0e75
commit a4bd5fd295
5 changed files with 55 additions and 3 deletions

View File

@ -1,6 +1,6 @@
![logo](_media/icon.svg)
# docsify <small>2.1.0</small>
# docsify <small>2.2.0</small>
> A magical documentation site generator.

View File

@ -2799,7 +2799,8 @@ var OPTIONS = merge({
auto2top: false,
name: '',
themeColor: '',
nameLink: window.location.pathname
nameLink: window.location.pathname,
ga: ''
}, window.$docsify);
var script = document.currentScript || [].slice.call(document.getElementsByTagName('script')).pop();

2
lib/docsify.min.js vendored

File diff suppressed because one or more lines are too long

50
lib/plugins/ga.js Normal file
View File

@ -0,0 +1,50 @@
this.D = this.D || {};
this.D.GA = (function () {
'use strict';
// 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) {
if (!window.ga) {
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 () {
init(window.$docsify.ga);
window.ga('set', 'page', location.href);
window.ga('send', 'pageview');
}
var install = function () {
if (!window.Docsify || !window.Docsify.installed) {
console.error('[Docsify] Please load docsify.js first.');
return
}
if (!window.$docsify.ga) {
console.error('[Docsify] ga is required.');
return
}
collect();
window.$docsify.plugins = [].concat(window.$docsify.plugins, collect);
};
var ga = install();
return ga;
}());

1
lib/plugins/ga.min.js vendored Normal file
View File

@ -0,0 +1 @@
this.D=this.D||{},this.D.GA=function(){"use strict";function o(){var o=document.createElement("script");o.async=!0,o.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(o)}function i(i){window.ga||(o(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",i,"auto"))}function n(){i(window.$docsify.ga),window.ga("set","page",location.href),window.ga("send","pageview")}var w=function(){return window.Docsify&&window.Docsify.installed?window.$docsify.ga?(n(),void(window.$docsify.plugins=[].concat(window.$docsify.plugins,n))):void console.error("[Docsify] ga is required."):void console.error("[Docsify] Please load docsify.js first.")},s=w();return s}();