Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuping committed Aug 20, 2017
1 parent 007073b commit 1966142
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions js/dotting.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
var isTestEnv = true;
var isKaolaEnv = false;
var allScripts = document.getElementsByTagName('script');
var allLinks = document.getElementsByTagName('link');


// 根据页面包含统计脚本来判断是否是测试环境
for (var i = 0; i < allScripts.length; i++) {
Expand All @@ -9,8 +12,16 @@ for (var i = 0; i < allScripts.length; i++) {
}
}

if (isTestEnv) {
// 判断是否是考拉相关的环境
for (var j= 0; j < allLinks.length; j++) {
if (allLinks[j].href.indexOf('kaola') > -1) {
isKaolaEnv = true;
break;
}
}

if (isTestEnv && isKaolaEnv) {
var script = document.createElement('script');
script.src = '//haitao.nos.netease.com/2f5267e0-b803-4478-ba29-fe13120cac59.js';
allScripts[0].parentNode.insertBefore(script, allScripts[0]);
allScripts[0] && allScripts[0].parentNode.insertBefore(script, allScripts[0]);
}

0 comments on commit 1966142

Please sign in to comment.