equal
deleted
inserted
replaced
|
1 {% load i18n %} |
|
2 <script type="text/javascript" src="{{ MEDIA_URL }}js/lib/markitup/1.1.5/markitup/jquery.markitup.js"></script> |
|
3 <script type="text/javascript" src="{{ MEDIA_URL }}js/markitup/sets.js"></script> |
|
4 |
|
5 <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}js/lib/markitup/1.1.5/markitup/skins/markitup/style.css" /> |
|
6 <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/markitup/style.css" /> |
|
7 <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/markitup/editor.css" /> |
|
8 |
|
9 <script type="text/javascript" > |
|
10 |
|
11 /* yes 2 different variables */ |
|
12 myHTMLSettings.previewTemplatePath = "{% url text-wysiwyg-preview "html" %}"; |
|
13 myMarkdownSettings.previewParserPath = "{% url text-wysiwyg-preview "markdown" %}"; |
|
14 |
|
15 $(document).ready(function() { |
|
16 adaptMarkitup = function() { |
|
17 $('#id_content').markItUpRemove(); |
|
18 var newSet = $('#id_format').val(); |
|
19 switch(newSet) { |
|
20 case 'markdown': |
|
21 $('#id_content').markItUp(myMarkdownSettings); |
|
22 break; |
|
23 case 'html': |
|
24 $('#id_content').markItUp(myHTMLSettings); |
|
25 break; |
|
26 } |
|
27 return false; |
|
28 } |
|
29 |
|
30 adaptMarkitup(); |
|
31 |
|
32 $('#id_format').change(function() {adaptMarkitup();}) ; |
|
33 }); |
|
34 |
|
35 needToConfirm = false ; |
|
36 function confirmExit() { |
|
37 if (needToConfirm) |
|
38 return "{% blocktrans %}You have attempted to leave this page. Unsaved changes will be lost. Are you sure you want to exit this page?{% endblocktrans %}"; |
|
39 } ; |
|
40 |
|
41 $(document).ready(function() { |
|
42 $("input[type='text']").add("textarea").change(function() {needToConfirm = true ;}) ; |
|
43 window.onbeforeunload = confirmExit; |
|
44 }) ; |
|
45 </script> |