mirror of
https://github.com/analyticsjs/vue-baidu-analytics.git
synced 2025-04-05 07:52:44 +08:00
1 line
6.9 KiB
JavaScript
1 line
6.9 KiB
JavaScript
/*! The roject developed by chengpeiquan! */(function(e){function t(t){for(var a,o,i=t[0],u=t[1],s=t[2],l=0,d=[];l<i.length;l++)o=i[l],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&d.push(r[o][0]),r[o]=0;for(a in u)Object.prototype.hasOwnProperty.call(u,a)&&(e[a]=u[a]);f&&f(t);while(d.length)d.shift()();return c.push.apply(c,s||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],a=!0,o=1;o<n.length;o++){var i=n[o];0!==r[i]&&(a=!1)}a&&(c.splice(t--,1),e=u(u.s=n[0]))}return e}var a={},o={app:0},r={app:0},c=[];function i(e){return u.p+"static/js/"+({home:"home"}[e]||e)+"."+{home:"80371ab3"}[e]+".js"}function u(t){if(a[t])return a[t].exports;var n=a[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.e=function(e){var t=[],n={home:1};o[e]?t.push(o[e]):0!==o[e]&&n[e]&&t.push(o[e]=new Promise((function(t,n){for(var a="static/css/"+({home:"home"}[e]||e)+"."+{home:"6fd0d033"}[e]+".css",r=u.p+a,c=document.getElementsByTagName("link"),i=0;i<c.length;i++){var s=c[i],l=s.getAttribute("data-href")||s.getAttribute("href");if("stylesheet"===s.rel&&(l===a||l===r))return t()}var d=document.getElementsByTagName("style");for(i=0;i<d.length;i++){s=d[i],l=s.getAttribute("data-href");if(l===a||l===r)return t()}var f=document.createElement("link");f.rel="stylesheet",f.type="text/css",f.onload=t,f.onerror=function(t){var a=t&&t.target&&t.target.src||r,c=new Error("Loading CSS chunk "+e+" failed.\n("+a+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=a,delete o[e],f.parentNode.removeChild(f),n(c)},f.href=r;var h=document.getElementsByTagName("head")[0];h.appendChild(f)})).then((function(){o[e]=0})));var a=r[e];if(0!==a)if(a)t.push(a[2]);else{var c=new Promise((function(t,n){a=r[e]=[t,n]}));t.push(a[2]=c);var s,l=document.createElement("script");l.charset="utf-8",l.timeout=120,u.nc&&l.setAttribute("nonce",u.nc),l.src=i(e);var d=new Error;s=function(t){l.onerror=l.onload=null,clearTimeout(f);var n=r[e];if(0!==n){if(n){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;d.message="Loading chunk "+e+" failed.\n("+a+": "+o+")",d.name="ChunkLoadError",d.type=a,d.request=o,n[1](d)}r[e]=void 0}};var f=setTimeout((function(){s({type:"timeout",target:l})}),12e4);l.onerror=l.onload=s,document.head.appendChild(l)}return Promise.all(t)},u.m=e,u.c=a,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)u.d(n,a,function(t){return e[t]}.bind(null,a));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="",u.oe=function(e){throw console.error(e),e};var s=window["webpackJsonp"]=window["webpackJsonp"]||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var d=0;d<s.length;d++)t(s[d]);var f=l;c.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("56d7")},"56d7":function(e,t,n){"use strict";n.r(t);n("e260"),n("e6cf"),n("cca6"),n("a79d");var a=n("2b0e"),o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"app"}},[n("router-view")],1)},r=[],c=(n("eafc"),n("2877")),i={},u=Object(c["a"])(i,o,r,!1,null,"74bbf350",null),s=u.exports,l=(n("d3b7"),n("8c4f"));a["a"].use(l["a"]);var d=[{path:"/",redirect:"home"},{path:"/home",name:"home",component:function(){return n.e("home").then(n.bind(null,"6511"))},children:[{path:"room",name:"room",component:function(){return n.e("home").then(n.bind(null,"6511"))}}]},{path:"/user/:id",name:"user",component:function(){return n.e("home").then(n.bind(null,"6511"))}}],f=new l["a"]({linkActiveClass:"cur",linkExactActiveClass:"cur",routes:d}),h=f,p=(n("99af"),n("a15b"),n("fb6a"),n("ac1f"),n("3ca3"),n("1276"),n("10d1"),n("159b"),n("ddb0"),n("d4ec")),b=n("bee2"),v=n("5364"),m=n("9bd1"),y=function(){function e(t,n){Object(p["a"])(this,e),w.set(this,{writable:!0,value:void 0}),g.set(this,{writable:!0,value:void 0}),Object(m["a"])(this,w,t),Object(m["a"])(this,g,n)}return Object(b["a"])(e,[{key:"_loadScript",value:function(){window._hmt=window._hmt?window._hmt:[];var e=document.createElement("script");e["async"]=!0,e["src"]="https://hm.baidu.com/hm.js?".concat(Object(v["a"])(this,w)),document.querySelector("head").appendChild(e),Object(v["a"])(this,g)&&console.log("[vue-baidu-analytics] siteId load done.\nsiteId: ".concat(Object(v["a"])(this,w)))}},{key:"_setAccount",value:function(){window._hmt.push(["_setAccount",Object(v["a"])(this,w)])}},{key:"_trackPageview",value:function(e){"string"===typeof e&&e||(e="/"),this._setAccount(),window._hmt.push(["_trackPageview",e]),Object(v["a"])(this,g)&&console.log("[vue-baidu-analytics] track pv done.\nsiteId: ".concat(Object(v["a"])(this,w),"\nurl: ").concat(e))}},{key:"_trackEvent",value:function(e,t,n,a){if("string"!==typeof e||"string"!==typeof t||!e||!t)throw new Error("[vue-baidu-analytics] Missing necessary category and operation information, and must be of type string.");"string"===typeof n&&n||(n=""),"number"===typeof a&&a||(a=0),this._setAccount(),window._hmt.push(["_trackEvent",e,t,n,a]),Object(v["a"])(this,g)&&console.log("[vue-baidu-analytics] track event done.\nsiteId: ".concat(Object(v["a"])(this,w),"\ncategory: ").concat(e,"\naction: ").concat(t,"\nopt_label: ").concat(n,"\nopt_value: ").concat(a))}}]),e}(),w=new WeakMap,g=new WeakMap;function _(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"===typeof document||"undefined"===typeof window)return!1;var n=t.router,a=t.siteIdList,o=t.debug;if(!n)throw new Error("[vue-baidu-analytics] Must pass a Vue-Router instance to vue-baidu-analytics.");if(!a)throw new Error("[vue-baidu-analytics] Missing tracking domain ID, add at least one of baidu analytics.");var r=!1;!0===o&&(r=!0),a&&a.forEach((function(e){var t=new y(e,r);t._loadScript()})),n.afterEach((function(e){var t=window.location.pathname.split("/").length,o=window.location.pathname.split("/").slice(0,t-1).join("/"),c="hash"===n.mode?"".concat(o,"/#").concat(e.fullPath):"".concat(o).concat(e.fullPath);a.forEach((function(e){var t=new y(e,r);t._trackPageview(c)}))})),e.prototype.$trackBaiduPv=function(e){a.forEach((function(t){var n=new y(t,r);n._trackPageview(e)}))},e.prototype.$trackBaiduEvent=function(e,t,n,o){a.forEach((function(a){var c=new y(a,r);c._trackEvent(e,t,n,o)}))}}a["a"].use(_,{router:h,siteIdList:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","cccccccccccccccccccccccccccccccc"],debug:!0}),a["a"].config.productionTip=!1,new a["a"]({router:h,render:function(e){return e(s)}}).$mount("#app")},a0d5:function(e,t,n){},eafc:function(e,t,n){"use strict";var a=n("a0d5"),o=n.n(a);o.a}}); |