chore: 注释掉 API 使用
This commit is contained in:
@@ -27,33 +27,33 @@ export const head: HeadConfig[] = [
|
|||||||
s.parentNode.insertBefore(hm, s);
|
s.parentNode.insertBefore(hm, s);
|
||||||
})();`],
|
})();`],
|
||||||
// 页面访问量统计
|
// 页面访问量统计
|
||||||
['script', {}, `
|
// ['script', {}, `
|
||||||
window.addEventListener('load', function() {
|
// window.addEventListener('load', function() {
|
||||||
let oldHref = document.location.href, bodyDOM = document.querySelector('body');
|
// let oldHref = document.location.href, bodyDOM = document.querySelector('body');
|
||||||
const observer = new MutationObserver(function(mutations) {
|
// const observer = new MutationObserver(function(mutations) {
|
||||||
if (oldHref != document.location.href) {
|
// if (oldHref != document.location.href) {
|
||||||
oldHref = document.location.href;
|
// oldHref = document.location.href;
|
||||||
getPv()
|
// getPv()
|
||||||
window.requestAnimationFrame(function() {
|
// window.requestAnimationFrame(function() {
|
||||||
let tmp = document.querySelector('body');
|
// let tmp = document.querySelector('body');
|
||||||
if(tmp != bodyDOM) {
|
// if(tmp != bodyDOM) {
|
||||||
bodyDOM = tmp;
|
// bodyDOM = tmp;
|
||||||
observer.observe(bodyDOM, config);
|
// observer.observe(bodyDOM, config);
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
const config = {
|
// const config = {
|
||||||
childList: true,
|
// childList: true,
|
||||||
subtree: true
|
// subtree: true
|
||||||
};
|
// };
|
||||||
observer.observe(bodyDOM, config);
|
// observer.observe(bodyDOM, config);
|
||||||
getPv()
|
// getPv()
|
||||||
}, true);
|
// }, true);
|
||||||
|
|
||||||
function getPv() {
|
// function getPv() {
|
||||||
xhr = new XMLHttpRequest();
|
// xhr = new XMLHttpRequest();
|
||||||
xhr.open('GET', 'https://api.charles7c.top/blog/pv?pageUrl=' + location.href);
|
// xhr.open('GET', 'https://api.charles7c.top/blog/pv?pageUrl=' + location.href);
|
||||||
xhr.send();
|
// xhr.send();
|
||||||
}`]
|
// }`]
|
||||||
];
|
];
|
Reference in New Issue
Block a user