From 0e824faf1cf4c6de9de18bd5223a7eb480e1a575 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 3 Aug 2012 11:19:15 +0200 Subject: [PATCH] Fix preview function in planet texts. --- www/static/js/site.js | 14 ++++++++++++++ www/templates/admin-planet-compose.html | 6 ++---- www/webapp/handlers_admin.py | 7 +++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/www/static/js/site.js b/www/static/js/site.js index 79e77bf8..6dc07c6f 100644 --- a/www/static/js/site.js +++ b/www/static/js/site.js @@ -36,3 +36,17 @@ if (/.*download-splash.*/i.test(window.location.href)) { } }); } + +function getCookie(name) { + var r = document.cookie.match("\\b" + name + "=([^;]*)\\b"); + return r ? r[1] : undefined; +} + +jQuery.postJSON = function(url, args, callback) { + args._xsrf = getCookie("_xsrf"); + $.ajax({url: url, data: $.param(args), dataType: "text", type: "POST", + success: function(response) { + callback(eval("(" + response + ")")); + } + }); +}; diff --git a/www/templates/admin-planet-compose.html b/www/templates/admin-planet-compose.html index 0a8ef63f..54125041 100644 --- a/www/templates/admin-planet-compose.html +++ b/www/templates/admin-planet-compose.html @@ -32,14 +32,12 @@
-{% end block %} -{% block javascript %}