[ Index ]
 

Code source de Kupu-1.3.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/common/ -> kupustart_form.js (source)

   1  /*****************************************************************************
   2   *
   3   * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
   4   *
   5   * This software is distributed under the terms of the Kupu
   6   * License. See LICENSE.txt for license text. For a list of Kupu
   7   * Contributors see CREDITS.txt.
   8   *
   9   *****************************************************************************/
  10  
  11  // $Id$
  12  
  13  function startKupu() {
  14      // initialize the editor, initKupu groks 1 arg, a reference to the iframe
  15      var frame = getFromSelector('kupu-editor'); 
  16      var kupu = initKupu(frame);
  17      
  18      // first let's load the message catalog
  19      // if there's no global 'i18n_message_catalog' variable available, don't
  20      // try to load any translations
  21      if (!window.i18n_message_catalog) {
  22          continueStartKupu(kupu);
  23          return kupu;
  24      };
  25      // loading will be done asynchronously (to keep Mozilla from freezing)
  26      // so we'll continue in a follow-up function (continueStartKupu() below)
  27      var handler = function(request) {
  28          if (this.readyState == 4) {
  29              var status = this.status;
  30              if (status != '200') {
  31                  alert(_('Error loading translation (status $status} ' +
  32                          '), falling back to english'), {'status': status});
  33                  continueStartKupu(kupu);
  34                  return;
  35              };
  36              var dom = this.responseXML;
  37              window.i18n_message_catalog.initialize(dom);
  38              continueStartKupu(kupu);
  39          };
  40      };
  41      var request = new XMLHttpRequest();
  42      request.onreadystatechange = (new ContextFixer(handler, request)).execute;
  43      request.open('GET', 'kupu.pox', true);
  44      request.send('');
  45  
  46      // we need to return a reference to the editor here for certain 'external'
  47      // stuff, developers should note that it's not yet initialized though, we
  48      // need to wait for i18n data before we can do that
  49      return kupu;
  50  };
  51  
  52  function continueStartKupu(kupu) {
  53      kupu.initialize();
  54  
  55      return kupu;
  56  };


Généré le : Sun Feb 25 15:30:41 2007 par Balluche grâce à PHPXref 0.7