You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
isso/isso/js/app/count.js

15 lines
505 B

define(["app/api", "lib/HTML"], function(api, HTML) {
return function() {
HTML.query("a").each(function(el, i, all) {
if (! el.href.match("#isso-thread$")) {
return;
};
var uri = el.href.match("^(.+)#isso-thread$")[1]
.replace(/^.*\/\/[^\/]+/, '');
api.count(uri).then(function(rv) {
el.textContent = rv + (rv > 1 ? " Kommentare" : " Kommentar");
})
});
}
});