Split page rendering and CORS requests against stacosys

This commit is contained in:
Yax
2015-05-09 20:46:48 +02:00
parent 71383eff9a
commit 37920f6c97
3 changed files with 52 additions and 40 deletions
+23 -1
View File
@@ -8,8 +8,30 @@ function show_hide(panel_id, button_id){
}
function show_comments() {
stacosys_load();
stacosys_load(comments_loaded);
}
function comments_loaded(response) {
for (var i = 0, numTokens = response.data.length; i < numTokens; ++i) {
response.data[i].mdcontent = markdown.toHTML(response.data[i].content);
}
show_hide('stacosys-comments', 'show-comments-button');
var template = document.getElementById('stacosys-template').innerHTML;
var rendered = Mustache.render(template, response);
document.getElementById('stacosys-comments').innerHTML = rendered;
}
function initialize_comments() {
stacosys_count(comments_initialized);
}
function comments_initialized(count) {
if (count > 0) {
if (count > 1) {
document.getElementById('show-comment-label').innerHTML = 'Voir les ' + count + ' commentaires';
}
document.getElementById('show-comments-button').style.display = '';
}
}
function preview_markdown() {