aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/static/js
diff options
context:
space:
mode:
authorEmily O'Leary <Emma.C.Echo@gmail.com>2013-08-06 18:22:51 -0400
committerRodney Ewing <ewing.rj@gmail.com>2013-08-07 16:33:58 -0700
commit3bd62dc4ca4fb12c772729bbb9dd6a78c3c08e48 (patch)
tree451dc4a9c669421a6ba6ea554a1be447707c1d93 /mediagoblin/static/js
parent3cf4ae0c41618fca764b80c5888c2868b8be5829 (diff)
downloadmediagoblin-3bd62dc4ca4fb12c772729bbb9dd6a78c3c08e48.tar.lz
mediagoblin-3bd62dc4ca4fb12c772729bbb9dd6a78c3c08e48.tar.xz
mediagoblin-3bd62dc4ca4fb12c772729bbb9dd6a78c3c08e48.zip
Changed how the comment was encoded/read.
Fixed CSRF + Post with comment preview. Merged with latest master
Diffstat (limited to 'mediagoblin/static/js')
-rw-r--r--mediagoblin/static/js/comment_show.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/mediagoblin/static/js/comment_show.js b/mediagoblin/static/js/comment_show.js
index 35183beb..42a21817 100644
--- a/mediagoblin/static/js/comment_show.js
+++ b/mediagoblin/static/js/comment_show.js
@@ -18,21 +18,22 @@
var content="";
function previewComment(){
- if ($('#comment_content').val() && (content != $('#comment_content').val())) {
- content = $('#comment_content').val();
- $.getJSON($('#previewURL').val(),JSON.stringify($('#comment_content').val()),
- function(data){
- $('#comment_preview').replaceWith("<div id=comment_preview><h3>{% trans -%}Comment Preview{%- endtrans %}</h3><br />" + decodeURIComponent(data) +
- "<hr style='border: 1px solid #333;' /></div>");
- });
- }
+ if ($('#comment_content').val() && (content != $('#comment_content').val())) {
+ content = $('#comment_content').val();
+ $.post($('#previewURL').val(),$('#form_comment').serialize(),
+ function(data){
+ preview = JSON.parse(data)
+ $('#comment_preview').replaceWith("<div id=comment_preview><h3>" + $('#previewText').val() +"</h3><br />" + preview.content +
+ "<hr style='border: 1px solid #333;' /></div>");
+ });
+ }
}
$(document).ready(function(){
$('#form_comment').hide();
$('#button_addcomment').click(function(){
$(this).fadeOut('fast');
$('#form_comment').slideDown(function(){
- setInterval("previewComment()",500);
+ setInterval("previewComment()",500);
$('#comment_content').focus();
});
});