0%

Git 标签

2016

Counter?where=${JSON.stringify({ url: { '$in': entries } })}`) .then(response => response.json()) .then(({ results }) => { if (results.length === 0) { document.querySelectorAll('.leancloud_visitors .leancloud-visitors-count').forEach(element => { element.innerText = 0; }); return; } for (let item of results) { let { url, time } = item; leancloudSelector(url).innerText = time; } for (let url of entries) { var element = leancloudSelector(url); if (element.innerText == '') { element.innerText = 0; } } }) .catch(error => { console.error('LeanCloud Counter Error', error); }); } } fetch('https://app-router.leancloud.cn/2/route?appId=zdJOK5Wn1s2FEW08bsWrJSNr-MdYXbMMI') .then(response => response.json()) .then(({ api_server }) => { var Counter = (method, url, data) => { return fetch(`https://${api_server}/1.1${url}`, { method: method, headers: { 'X-LC-Id': 'zdJOK5Wn1s2FEW08bsWrJSNr-MdYXbMMI', 'X-LC-Key': 'srfkdNQHPwr0YhmluCDtB65R', 'Content-Type': 'application/json', }, body: JSON.stringify(data) }); }; if (CONFIG.page.isPost) { if (CONFIG.hostname !== location.hostname) return; addCount(Counter); } else if (document.querySelectorAll('.post-title-link').length >= 1) { showTime(Counter); } });