Skip to content

Commit

Permalink
feat: add cnzz support
Browse files Browse the repository at this point in the history
Change-Id: I72ef5009cd6653cbf77d493a7d37054cbff522ac
  • Loading branch information
x-cold committed Sep 25, 2018
1 parent 7c7e069 commit 070728d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ module.exports = {
'no-template-curly-in-string': 0,
'react/no-danger': 0,
'react/prop-types': 0,
'no-mixed-operators': 0,
'max-len': [
'error',
{ "code": 120 }
]
'no-mixed-operators': 0
},
};
7 changes: 7 additions & 0 deletions themes/txd/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default class Index extends Component {
render() {
const { props } = this;
const { html, helper, state, config = {}, post = {} } = props;
const { cnzz = {} } = config;
return (
<html>
<head>
Expand All @@ -45,6 +46,12 @@ export default class Index extends Component {
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta charSet="UTF-8" />
<link rel="stylesheet" href={helper.asset('index.css')} />
{
cnzz.siteId && <script dangerouslySetInnerHTML={{
__html: `!function(a,b){if(!b.__SV){var c,d,e,f;window.dplus=b,b._i=[],b.init=function(a,c,d){function g(a,b){var c=b.split(".");2==c.length&&(a=a[c[0]],b=c[1]),a[b]=function(){a.push([b].concat(Array.prototype.slice.call(arguments,0)))}}var h=b;for("undefined"!=typeof d?h=b[d]=[]:d="dplus",h.people=h.people||[],h.toString=function(a){var b="dplus";return"dplus"!==d&&(b+="."+d),a||(b+=" (stub)"),b},h.people.toString=function(){return h.toString(1)+".people (stub)"},e="disable track track_links track_forms register unregister get_property identify clear set_config get_config get_distinct_id track_pageview register_once track_with_tag time_event people.set people.unset people.delete_user".split(" "),f=0;f<e.length;f++)g(h,e[f]);b._i.push([a,c,d])},b.__SV=1.1,c=a.createElement("script"),c.type="text/javascript",c.charset="utf-8",c.async=!0,c.src="//w.cnzz.com/dplus.php?id=${cnzz.siteId}",d=a.getElementsByTagName("script")[0],d.parentNode.insertBefore(c,d)}}(document,window.dplus||[]),dplus.init("${cnzz.siteId}");`,
}}
/>
}
</head>
<body>
<div id="container" dangerouslySetInnerHTML={{ __html: html }} />
Expand Down

0 comments on commit 070728d

Please sign in to comment.