diff --git a/index.js b/index.js index 96385c2..353da83 100644 --- a/index.js +++ b/index.js @@ -107,7 +107,7 @@ hexo.on("deployAfter", async function (post) { //insert webpushr tracking code hexo.extend.filter.register('after_render:html', data => { var payload = `(function (w, d, s, id) { - if (typeof (w.webpushr) !== 'undefined') return; w.webpushr = w.webpushr || function () { (w.webpushr.q = w.webpushr.q || []).push(arguments) }; var js, fjs = d.getElementsByTagName(s)[0]; js = d.createElement(s); js.id = id; js.async = 1; js.src = "https://cdn.webpushr.com/app.min.js";fjs.parentNode.appendChild(js);}(window, document, 'script', 'webpushr-jssdk'));webpushr('setup', { 'key': '${hexo.config.webPushNotification.trackingCode}' });` + if (typeof (w.webpushr) !== 'undefined') return; w.webpushr = w.webpushr || function () { (w.webpushr.q = w.webpushr.q || []).push(arguments) }; var js, fjs = d.getElementsByTagName(s)[0]; js = d.createElement(s); js.id = id; js.async = false; js.src = "https://cdn.webpushr.com/app.min.js";fjs.parentNode.appendChild(js);}(window, document, 'script', 'webpushr-jssdk'));webpushr('setup', { 'key': '${hexo.config.webPushNotification.trackingCode}' });` // return data.replace(/
(?!<\/body>).+?<\/body>/s, str => str.replace('', "