aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/static/js')
-rw-r--r--mediagoblin/static/js/comment_show.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/mediagoblin/static/js/comment_show.js b/mediagoblin/static/js/comment_show.js
index c5ccee66..cb69fccd 100644
--- a/mediagoblin/static/js/comment_show.js
+++ b/mediagoblin/static/js/comment_show.js
@@ -15,12 +15,24 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+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>Comment Preview</h3><br />" + decodeURIComponent(data) +
+ "<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);
$('#comment_content').focus();
});
});