Commit 166599a2 authored by Adhityaa Chandrasekar's avatar Adhityaa Chandrasekar

count.js: support data-page-id paths

Closes #255
parent 15022ba3
Pipeline #106718238 passed with stage
in 3 minutes and 13 seconds
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
var scripts = tags("script") var scripts = tags("script")
for (var i = 0; i < scripts.length; i++) { for (var i = 0; i < scripts.length; i++) {
if (scripts[i].src.match(/\/js\/count\.js$/)) { if (scripts[i].src.match(/\/js\/count\.js$/)) {
var customCommentsText = attrGet(scripts[i], "data-custom-text"); var customCommentsText = attrGet(scripts[i], "data-custom-text");
if (customCommentsText !== undefined) { if (customCommentsText !== undefined) {
commentsText = eval(customCommentsText); commentsText = eval(customCommentsText);
} }
...@@ -61,12 +61,15 @@ ...@@ -61,12 +61,15 @@
href = href.replace(/^.*\/\/[^\/]+/, ""); href = href.replace(/^.*\/\/[^\/]+/, "");
if (href.endsWith("#commento")) { if (href.endsWith("#commento")) {
var path = href.substr(0, href.indexOf("#commento")); var pageId = attrGet(as[i], "data-page-id");
if (path.startsWith(parent.location.host)) { if (pageId === undefined) {
path = path.substr(parent.location.host.length); pageId = href.substr(0, href.indexOf("#commento"));
if (pageId.startsWith(parent.location.host)) {
pageId = pageId.substr(parent.location.host.length);
}
} }
paths.push(path); paths.push(pageId);
doms.push(as[i]); doms.push(as[i]);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment