pentamedia-comments.js: jetzt mit noch mehr HTML exklusiv aus Pentamedia
This commit is contained in:
parent
16b86dccb4
commit
5051b5a7d0
|
@ -18,7 +18,7 @@ $(document).ready(
|
|||
}
|
||||
});
|
||||
if (load) {
|
||||
$(document).append('<script src="' + PENTAMEDIA + '/comments.json?jsonp=ShowStats" type="text/javascript"></script>');
|
||||
$(document).append('<script src="' + PENTAMEDIA + '/comments/count.json?jsonp=ShowStats" type="text/javascript"></script>');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -46,21 +46,18 @@ $(document).ready(
|
|||
var m;
|
||||
if ((m = /\/(penta[a-zA-Z0-9\-]+)\./.exec(document.location))) {
|
||||
slug = m[1];
|
||||
$(document).append('<script src="'+PENTAMEDIA+'/'+slug+'/comments.json?jsonp=ShowComments" type="text/javascript"></script>');
|
||||
$(document).append('<script src="'+PENTAMEDIA+'/'+slug+'/comments.json?jsonp=ShowComments&html=mitsahne" type="text/javascript"></script>');
|
||||
}
|
||||
});
|
||||
|
||||
function ShowComments(r) {
|
||||
r.comments.forEach(
|
||||
function(comment) {
|
||||
var div = $("<div></div>");
|
||||
$("#content").append(div);
|
||||
div.addClass("comment");
|
||||
div.append(comment.text);
|
||||
div.append($("<span class='author'></small>"));
|
||||
div.find('.author').text(comment.author);
|
||||
div.append($("<small class='date'></small>"));
|
||||
div.find('.date').text(comment.date);
|
||||
});
|
||||
$("#content").append("<p><a href='" + PENTAMEDIA + r.new_link + "'>Kommentar hinzufügen</a></p>");
|
||||
$("#content").append(r.html);
|
||||
$("#content").
|
||||
find(".comments").
|
||||
find("a").
|
||||
map(function() {
|
||||
var a = $(this);
|
||||
if (a.attr("href").substr(0, 1) == "/")
|
||||
a.attr("href", PENTAMEDIA + a.attr("href"));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue