|
@@ -85,17 +85,58 @@ var jyClabUtils = {
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
+
|
|
|
|
+ function checkHasJquery () {
|
|
|
|
+ if (typeof jQuery === 'undefined') {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ return $.fn.jquery
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function loadJS (url, success) {
|
|
|
|
+ var scripts = document.getElementsByTagName('script')
|
|
|
|
+ for (var i = 0; i < scripts.length; i++) {
|
|
|
|
+ if (scripts[i].src && scripts[i].src.indexOf(url) > -1) {
|
|
|
|
+ if (success) success();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ var domScript = document.createElement('script');
|
|
|
|
+ domScript.src = url;
|
|
|
|
+ success = success || function () {
|
|
|
|
+ };
|
|
|
|
+ domScript.onload = domScript.onreadystatechange = function () {
|
|
|
|
+ if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) {
|
|
|
|
+ success();
|
|
|
|
+ this.onload = this.onreadystatechange = null;
|
|
|
|
+ //this.parentNode.removeChild(this);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ document.getElementsByTagName('head')[0].appendChild(domScript);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function initClabTrack () {
|
|
|
|
+ // 荟聚
|
|
|
|
+ $('body').on('click','*[data-cl-event]', function () {
|
|
|
|
+ clab_tracker && clab_tracker.track($(this).attr('data-cl-event'))
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
jyClabUtils.init()
|
|
jyClabUtils.init()
|
|
// 荟聚
|
|
// 荟聚
|
|
- $.getScript('//cbe.huiju.cool/cbe/collect?tid=281617177&at=0&h=web', function () {
|
|
|
|
|
|
+ loadJS('//cbe.huiju.cool/cbe/collect?tid=281617177&at=0&h=web', function () {
|
|
clab_tracker.ready(function () {
|
|
clab_tracker.ready(function () {
|
|
this.push({"pageType":"web"});
|
|
this.push({"pageType":"web"});
|
|
this.track("open_page", jyClabUtils.getNowPageInfo());
|
|
this.track("open_page", jyClabUtils.getNowPageInfo());
|
|
})
|
|
})
|
|
- $('body').on('click','*[data-cl-event]', function () {
|
|
|
|
- clab_tracker && clab_tracker.track($(this).attr('data-cl-event'))
|
|
|
|
- })
|
|
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+ if (checkHasJquery()) {
|
|
|
|
+ initClabTrack()
|
|
|
|
+ } else {
|
|
|
|
+ loadJS('//cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js', initClabTrack)
|
|
|
|
+ }
|
|
|
|
+
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.log(error)
|
|
console.log(error)
|
|
-}
|
|
|
|
|
|
+}
|