Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit 6cf02ad

Browse files
committed
Small js lib updates
1 parent 66cff78 commit 6cf02ad

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

readthedocs_ext/_static/javascript/lib/comm.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ function displayCommentIcon() {
7272
var addcls = count == 0 ? ' nocomment' : '';
7373
addCommentIcon(id, title, image, addcls)
7474
}
75+
$.each($('.sphinx-has-comment'), function () {
76+
count = 0
77+
id = $(this).attr('id')
78+
if (!(id in settings.metadata)) {
79+
var title = count + ' comment' + (count == 1 ? '' : 's');
80+
var image = count > 0 ? settings.opts.commentBrightImage : settings.opts.commentImage;
81+
var addcls = count == 0 ? ' nocomment' : '';
82+
addCommentIcon(id, title, image, addcls)
83+
}
84+
})
7585
}
7686

7787
function addCommentIcon(id, title, image, addcls) {

readthedocs_ext/_static/javascript/lib/display.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function displayComments(id) {
4545

4646

4747
function handleComments(id, data) {
48-
showComments(id, data.comments)
48+
showComments(id, data.results)
4949
}
5050

5151

readthedocs_ext/_static/websupport2-bundle.js_t

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ function displayCommentIcon() {
8686
var addcls = count == 0 ? ' nocomment' : '';
8787
addCommentIcon(id, title, image, addcls)
8888
}
89+
$.each($('.sphinx-has-comment'), function () {
90+
count = 0
91+
id = $(this).attr('id')
92+
if (!(id in settings.metadata)) {
93+
var title = count + ' comment' + (count == 1 ? '' : 's');
94+
var image = count > 0 ? settings.opts.commentBrightImage : settings.opts.commentImage;
95+
var addcls = count == 0 ? ' nocomment' : '';
96+
addCommentIcon(id, title, image, addcls)
97+
}
98+
})
8999
}
90100

91101
function addCommentIcon(id, title, image, addcls) {
@@ -229,7 +239,7 @@ function displayComments(id) {
229239

230240
$.ajax({
231241
type: 'GET',
232-
url: 'http://localhost:8000/api/v2/comments/',
242+
url: settings.opts.getCommentsURL,
233243
data: post_data,
234244
crossDomain: true,
235245
xhrFields: {
@@ -248,7 +258,7 @@ function displayComments(id) {
248258

249259

250260
function handleComments(id, data) {
251-
showComments(id, data.comments)
261+
showComments(id, data.results)
252262
}
253263

254264

0 commit comments

Comments
 (0)