[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/public_html/javascript/ -> storyeditor_fckeditor.js (source)

   1  // +---------------------------------------------------------------------------+
   2  // | Copyright (C) 2003,2004,2005,2006 by the following authors:               |
   3  // | Version 1.1    Date: Jun 4, 2006                                          |
   4  // | Authors:   Blaine Lang - blaine@portalparts.com                           |
   5  // |                                                                           |
   6  // | Javascript functions for FCKEditor Integration into Geeklog               |
   7  // |                                                                           |
   8  // +---------------------------------------------------------------------------+
   9  
  10      window.onload = function() {
  11          var oFCKeditor1 = new FCKeditor( 'introhtml' ) ;
  12          oFCKeditor1.BasePath = geeklogEditorBasePath;
  13          oFCKeditor1.Config['CustomConfigurationsPath'] = geeklogEditorBaseUrl + '/fckeditor/myconfig.js';
  14          oFCKeditor1.ToolbarSet = 'editor-toolbar2' ;
  15          oFCKeditor1.Height = 200 ;
  16          oFCKeditor1.ReplaceTextarea() ;
  17  
  18          var oFCKeditor2 = new FCKeditor( 'bodyhtml' ) ;
  19          oFCKeditor2.BasePath = geeklogEditorBasePath ;
  20          oFCKeditor2.Config['CustomConfigurationsPath'] = geeklogEditorBaseUrl + '/fckeditor/myconfig.js';
  21          oFCKeditor2.ToolbarSet = 'editor-toolbar2' ;
  22          oFCKeditor2.Height = 200 ;
  23          oFCKeditor2.ReplaceTextarea() ;
  24      }
  25  
  26      function change_editmode(obj) {
  27          if (obj.value == 'html') {
  28              document.getElementById('html_editor').style.display='none';
  29              document.getElementById('text_editor').style.display='';
  30              swapEditorContent('html','introhtml');
  31              swapEditorContent('html','bodyhtml');
  32          } else if (obj.value == 'adveditor') {
  33              document.getElementById('text_editor').style.display='none';
  34              document.getElementById('html_editor').style.display='';
  35              swapEditorContent('adveditor','introhtml');
  36              swapEditorContent('adveditor','bodyhtml');
  37          } else {
  38              document.getElementById('html_editor').style.display='none';
  39              document.getElementById('text_editor').style.display='';
  40              swapEditorContent('text','introhtml');
  41              swapEditorContent('text','bodyhtml');
  42          }
  43      }
  44  
  45      function changeHTMLTextAreaSize(element, option) {
  46          var size = 0;
  47          var size = document.getElementById(element + '___Frame').height;
  48          if (option == 'larger') {
  49              document.getElementById(element + '___Frame').height = +(size) + 50;
  50  
  51          } else if (option == 'smaller') {
  52              document.getElementById(element + '___Frame').height = +(size) - 50;
  53          }
  54      }
  55  
  56      function changeTextAreaSize(element, option) {
  57          var size = 0;
  58          var size = document.getElementById(element).rows;
  59          if (option == 'larger') {
  60              document.getElementById(element).rows = +(size) + 3;
  61          } else if (option == 'smaller') {
  62              document.getElementById(element).rows = +(size) - 3;
  63          }
  64      }
  65  
  66  
  67      function getEditorContent(instanceName) {
  68          // Get the editor instance that we want to interact with.
  69          var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
  70          // return the editor contents in XHTML.
  71          return oEditor.GetXHTML( true );
  72      }
  73  
  74      function swapEditorContent(curmode,instanceName) {
  75          var content = '';
  76          var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
  77          //alert(curmode + ':' + instanceName);
  78          if (curmode == 'adveditor') { // Switching from Text to HTML mode
  79              // Get the content from the textarea 'text' content and copy it to the editor
  80              if (instanceName == 'introhtml' )  {
  81                  content = document.getElementById('introtext').value;
  82                  //alert('Intro :' + instanceName + '\n' + content);
  83              } else {
  84                  content = document.getElementById('bodytext').value;
  85                  //alert('HTML :' + instanceName + '\n' + content);
  86              }
  87              oEditor.SetHTML(content);
  88          } else {
  89                 content = getEditorContent(instanceName);
  90                if (instanceName == 'introhtml' )  {
  91                    document.getElementById('introtext').value = content;
  92                } else {
  93                    document.getElementById('bodytext').value = content;
  94                }
  95            }
  96      }
  97  
  98      function set_postcontent() { 
  99          if (document.getElementById('sel_editmode').value == 'adveditor') {
 100              document.getElementById('introtext').value = getEditorContent('introhtml');
 101              document.getElementById('bodytext').value = getEditorContent('bodyhtml');
 102          }
 103      }
 104  
 105     function changeToolbar(toolbar) {
 106          var oEditor1 = FCKeditorAPI.GetInstance('introhtml');
 107          oEditor1.ToolbarSet.Load( toolbar ) ;
 108          var oEditor2 = FCKeditorAPI.GetInstance('bodyhtml');
 109          oEditor2.ToolbarSet.Load( toolbar ) ;
 110     }


Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics