~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/browser/editor.js

  • Committer: wagrant
  • Date: 2008-07-16 00:24:07 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:879
diffservice, fileservice_lib: Factor out conversion of strings to
      revision specifications, to common.svn.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
    data = editbox.getCode();
16
16
    /* Do NOT refresh the page contents (causes problems for editarea and is
17
17
     * unnecessary). */
18
 
    if (current_file.svnstatus != "revision" ||
19
 
        confirm("You are currently viewing an older version of this file. " +
20
 
                "Saving will overwrite the current version. " +
21
 
                "Are you sure you want to continue?"))
22
 
    {
23
 
        do_action("putfile", filename,
24
 
                  {"path":".", "data":data, "overwrite":"true"},
25
 
                  "multipart/form-data", true);
26
 
        disable_save_if_safe();
27
 
    }
 
18
    do_action("putfile", filename,
 
19
              {"path":".", "data":data, "overwrite":"true"},
 
20
              "multipart/form-data", true);
 
21
    disable_save_if_safe();
28
22
}
29
23
 
30
24
function save_file_as(default_filename)
83
77
function initialise_codepress()
84
78
{
85
79
    editbox.addChangeHandler(edit_text);
86
 
    editbox.addSaveHandler(function() {document.getElementById("save_button").click()});
87
80
     
88
81
    /* We can only safely disable the save button on the first load.
89
82
     * Syntax highlighting changes will also get this function called.
120
113
    language = language ? language : "text";
121
114
    document.getElementById("highlighting_select").value = language;
122
115
 
123
 
    txt_elem.className = "codepress autocomplete-off " + language;
 
116
    txt_elem.className = "codepress " + language;
124
117
    txt_elem.setAttribute("onchange", "edit_text()");
125
118
    /* TODO: Make CSS height: 100% work */
126
119
    txt_elem.setAttribute("rows", "35");
138
131
function language_from_mime(mime)
139
132
{
140
133
    return {'text/x-python': 'python',
141
 
            'application/x-javascript': 'javascript',
142
134
            'application/javascript': 'javascript',
143
135
            'text/css': 'css',
144
136
            'text/plain': 'text',
145
137
            'text/html': 'html',
146
 
            'application/xml': 'html',
147
138
            'application/xhtml+xml': 'html'}[mime];
148
139
}