fix: 本地调试环境下不执行埋点上报

This commit is contained in:
ZiuChen 2022-08-19 22:26:07 +08:00
parent e96ac7009a
commit 3c6f1183c2

View File

@ -9,12 +9,14 @@ module.exports = {
/* js */ `
var _hmt = _hmt || [];
(function() {
var isDev = document.location.href.indexOf("localhost") !== -1
var isGitee = document.location.href.indexOf("gitee.io") !== -1
var hm1 = document.createElement("script");
hm1.src = "https://hm.baidu.com/hm.js?08b4ef50a9244e83e5a1bd5822442829"; // gitee
var hm2 = document.createElement("script");
hm2.src = "https://hm.baidu.com/hm.js?50bac15a1f238d1aa61f104a5fb6f5e0"; // github
var s = document.getElementsByTagName("script")[0];
if(isDev) return // 不上报
if (isGitee) s.parentNode.insertBefore(hm1, s);
else s.parentNode.insertBefore(hm2, s);
})();