[build] 4.0.0 next

This commit is contained in:
qingwei.li 2017-05-30 04:39:43 +08:00
commit b9b9d87681
No known key found for this signature in database
GPG key ID: B6DDC2F7AE80B2F4
8 changed files with 774 additions and 614 deletions

View file

@ -11,24 +11,28 @@ function appendScript () {
}
function init (id) {
if (!window.ga) {
var ga = window.ga;
if (!ga) {
appendScript();
window.ga = window.ga || function () {
(window.ga.q = window.ga.q || []).push(arguments);
ga = ga || function () {
(ga.q = ga.q || []).push(arguments);
};
window.ga.l = Number(new Date());
window.ga('create', id, 'auto');
ga.l = Number(new Date());
ga('create', id, 'auto');
}
return ga
}
function collect () {
init(window.$docsify.ga);
window.ga('set', 'page', location.hash);
window.ga('send', 'pageview');
var ga = init($docsify.ga);
ga('set', 'page', location.hash);
ga('send', 'pageview');
}
var install = function (hook) {
if (!window.$docsify.ga) {
if (!$docsify.ga) {
console.error('[Docsify] ga is required.');
return
}
@ -36,6 +40,6 @@ var install = function (hook) {
hook.beforeEach(collect);
};
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
$docsify.plugins = [].concat(install, $docsify.plugins);
}());