Sourcecode in Story/macros.js:
1: function commentcounter_macro(param) {
2: if (!this.site.preferences.getProperty("discussions") || !this.discussions)
3: return;
4: var commentCnt = this.comments.count();
5: if (!param.linkto)
6: param.linkto = "main";
7: var linkParam = this.createLinkParam(param);
8: // delete the macro-specific attributes for valid markup output
9: delete linkParam.as;
10: delete linkParam.one;
11: delete linkParam.more;
12: delete linkParam.no;
13: var linkflag = (param.as == "link" && param.as != "text" ||
14: !param.as && commentCnt > 0);
15: if (linkflag)
16: Html.openTag("a", linkParam);
17: if (commentCnt == 0)
18: res.write(param.no || param.no == "" ?
19: param.no : getMessage("Comment.no"));
20: else if (commentCnt == 1)
21: res.write(param.one ? param.one : getMessage("Comment.one"));
22: else
23: res.write(commentCnt + (param.more ?
24: param.more : " " + getMessage("Comment.more")));
25: if (linkflag)
26: Html.closeTag("a");
27: return;
28: }
|