+ \r
+ if(doc === '') {\r
+ doc = '<document>\n\\r
+ <section\n\\r
+ xmlns="http://nowoczesnapolska.org.pl/sst#"\n\\r
+ xmlns:xlink="http://www.w3.org/1999/xlink"\n\\r
+ xmlns:dc="http://purl.org/dc/elements/1.1/"\n\\r
+ xmlns:dcterms="http://purl.org/dc/terms/"\n\\r
+ >\n\\r
+ <metadata>\n\\r
+ </metadata>\n\\r
+ <div class="p"></div>\n\\r
+ </section>\n\\r
+</document>';\r
+ }\r
+ \r
+ \r
+ function readCookie(name) {\r
+ var nameEQ = escape(name) + "=";\r
+ var ca = document.cookie.split(';');\r
+ for (var i = 0; i < ca.length; i++) {\r
+ var c = ca[i];\r
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length);\r
+ if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length, c.length));\r
+ }\r
+ return null;\r
+ }\r
+ \r
+ $.ajaxSetup({\r
+ crossDomain: false,\r
+ beforeSend: function(xhr, settings) {\r
+ if (!(/^(GET|HEAD|OPTIONS|TRACE)$/.test(settings.type))) {\r
+ xhr.setRequestHeader("X-CSRFToken", readCookie('csrftoken'));\r
+ }\r
+ }\r
+ });\r
+ \r