Skip to content

Commit

Permalink
fix(client): compat serverURL end with slash fix #122
Browse files Browse the repository at this point in the history
  • Loading branch information
lizheming committed Jan 5, 2021
1 parent 3c8c6a1 commit 196a959
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ export default function Waline({
} catch(e) {
//ignore error
}
//compat multiple slash
serverURL = serverURL.replace(/\/+$/, '');

//阅读统计
//visitor count
if(visitor) {
const visitorPromise = path ? Visitor.add({serverURL, path}) : Promise.resolve();
visitorPromise.then(() => Visitor.show({serverURL}));
}

//评论数统计
//comment count
const $counts = [].slice.call(document.querySelectorAll('.waline-comment-count'));
if($counts.length) {
$counts.filter(
Expand All @@ -62,7 +64,7 @@ export default function Waline({
//mathml
window.addEventListener('load', mathML);

//评论列表展示
//comment list display
const root = document.querySelector(el);
if(!root) {
return;
Expand Down

0 comments on commit 196a959

Please sign in to comment.