[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/fckeditor/ -> img_assist_fckeditor.js (source)

   1  // $Id: img_assist_fckeditor.js,v 1.1.4.3.2.6 2009/08/02 20:31:21 jorrit Exp $
   2  /**
   3   * This script loads img_assist_textarea.js and modifies its functionality to
   4   * work with FCKeditor.
   5   * 
   6   * This file does not have to be replaced (in contrast to older versions of this
   7   * file)
   8   */
   9  new function() {
  10    // Step 2: do our own loading
  11    var initFCKeditor = function() {
  12      var oldInsertToEditor = insertToEditor;
  13  
  14      insertToEditor = function(content) {
  15        // handle FCKeditor in popup mode
  16        if ((myTextarea == '') && (window.opener)) {
  17          var opener = window.opener;
  18          if (opener.oFCKeditor) {
  19            var inst = opener.oFCKeditor.InstanceName;
  20            var oEditor = opener.FCKeditorAPI.GetInstance(inst);
  21            if (oEditor.EditMode == opener.FCK_EDITMODE_WYSIWYG) {
  22              oEditor.InsertHtml(content);
  23            } else {
  24              alert(Drupal.t('Inserting image into FCKeditor is allowed only in WYSIWYG mode'));
  25            }
  26            cancelAction();
  27            return false;
  28          }
  29        }
  30  
  31        // FCKeditor enabled and running == textarea not displayed
  32        if (myTextarea.style.display == 'none') {
  33          var opener = window.opener;
  34          if (opener.fckLaunchedJsId) {
  35            for ( var i = 0; i < opener.fckLaunchedJsId.length; i++) {
  36              if (opener.fckLaunchedTextareaId[i] == myTextarea.id) {
  37                var oEditor = opener.FCKeditorAPI.GetInstance(opener.fckLaunchedJsId[i]);
  38                if (oEditor.EditMode == opener.FCK_EDITMODE_WYSIWYG) {
  39                  oEditor.InsertHtml(content);
  40                } else {
  41                  alert(Drupal.t('Inserting image into FCKeditor is allowed only in WYSIWYG mode'));
  42                }
  43              }
  44            }
  45          } else {
  46            var oEditor = opener.FCKeditorAPI.GetInstance(myTextarea.id);
  47            if (oEditor.EditMode == opener.FCK_EDITMODE_WYSIWYG) {
  48              oEditor.InsertHtml(content);
  49            } else {
  50              alert(Drupal.t('Inserting image into FCKeditor is allowed only in WYSIWYG mode'));
  51            }
  52          }
  53          cancelAction();
  54          return false;
  55        }
  56  
  57        oldInsertToEditor(content);
  58      };
  59    }
  60  
  61    // Step 1: wait until textarea.js is loaded
  62    var count = 0;
  63    var checkAndLoad = function() {
  64      if (typeof (initLoader) != 'undefined') {
  65        initFCKeditor();
  66      } else if (count < 5) {
  67        setTimeout(checkAndLoad, 1000);
  68        count++;
  69      } else {
  70        alert('Could not load ' + textareafile + ' after 5 seconds');
  71      }
  72    }
  73  
  74    checkAndLoad();
  75  }();


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7