Line | |
---|
1 | $(function() { |
---|
2 | var msg = false; |
---|
3 | $('#file-form input[name="write"]').click(function() { |
---|
4 | var f = this.form; |
---|
5 | |
---|
6 | var data = { |
---|
7 | file_content: (!dotclear.colorsyntax ? $(f).find('#file_content').get(0).value : editor.getValue()), |
---|
8 | xd_check: $(f).find('input[name="xd_check"]').get(0).value, |
---|
9 | write: 1 |
---|
10 | }; |
---|
11 | |
---|
12 | if (msg == false) { |
---|
13 | msg = $('<p style="font-weight:bold; color:red;"></p>'); |
---|
14 | $('#file_content').parent().after(msg); |
---|
15 | } |
---|
16 | |
---|
17 | msg.text(dotclear.msg.saving_document); |
---|
18 | |
---|
19 | $.post(document.location.href,data,function(res,status) { |
---|
20 | var err = $(res).find('div.error li:first'); |
---|
21 | if (err.length > 0) { |
---|
22 | msg.text(dotclear.msg.error_occurred + ' ' + err.text()); |
---|
23 | return; |
---|
24 | } else { |
---|
25 | msg.text(dotclear.msg.document_saved); |
---|
26 | $('#file-chooser').empty(); |
---|
27 | $(res).find('#file-chooser').children().appendTo('#file-chooser'); |
---|
28 | } |
---|
29 | }); |
---|
30 | |
---|
31 | return false; |
---|
32 | }); |
---|
33 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.