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