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

« back to all changes in this revision

Viewing changes to ivle/webapp/filesystem/browser/media/editor.js

  • Committer: William Grant
  • Date: 2009-08-10 12:27:42 UTC
  • mto: This revision was merged to the branch mainline in revision 1314.
  • Revision ID: grantw@unimelb.edu.au-20090810122742-9zeklbnwetgjzw0w
Disable the save button if not using CodePress.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
function disable_save_if_safe()
2
2
{
3
 
    /* If this is defined, this engine supports change notification, so is able
4
 
     * to enable the button again. Disable it for them. */
5
 
    if(editbox.editor.addChangeHandler)
 
3
    /* If we are using CodePress, we can only safely disable the save button
 
4
     * (indicating that there are no changes to save) if the engine supports
 
5
     * change notification, so the button can be enabled again.
 
6
     *
 
7
     * Our non-CodePress mode just uses normal textarea events, so is always
 
8
     * fine.
 
9
     */
 
10
    if((!using_codepress) || editbox.editor.addChangeHandler)
6
11
    {
7
12
        var savebutton = document.getElementById("save_button");
8
13
        savebutton.disabled = true;
132
137
            more browsers than the previous situation.
133
138
            This should be killed ASAP when we fix/replace CodePress.
134
139
     */
135
 
    if (navigator.userAgent.match('Gecko') &&
136
 
        !navigator.userAgent.match('WebKit') &&
137
 
        !navigator.userAgent.match('Presto'))
138
 
         {
 
140
    using_codepress = (navigator.userAgent.match('Gecko') &&
 
141
                       !navigator.userAgent.match('WebKit') &&
 
142
                       !navigator.userAgent.match('Presto'))
 
143
 
 
144
    if (using_codepress)
 
145
    {
 
146
        /* This is probably real Gecko. Try to fire up CodePress.
 
147
         * If it fails we'll have a horrible mess, so we'll hope.
 
148
         */
139
149
        txt_elem.className = "codepress autocomplete-off " + language;
140
150
        CodePress.run();
141
151
 
145
155
         * the browser is likely to reenable it as needed. */
146
156
        editbox.onload = initialise_codepress;
147
157
    }
 
158
    else
 
159
    {
 
160
        /* Not using CodePress, so we can already disable the Save button. */
 
161
        disable_save_if_safe();
 
162
    }
148
163
}
149
164
 
150
165
function language_from_mime(mime)