[build] 4.0.0 next
This commit is contained in:
parent
d4f6072d10
commit
b9b9d87681
8 changed files with 774 additions and 614 deletions
|
|
@ -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);
|
||||
|
||||
}());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue