⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 script_gecko.js.php

📁 架設ROSE私服必備之物 ROSE數據庫
💻 PHP
📖 第 1 页 / 共 4 页
字号:
            newtable.bgColor = nt.bgColor;
          if (nt.background)
            newtable.style.backgroundImage = "url("+nt.background+");";
          if (nt.className)
            newtable.className = nt.className;
          
          // create rows
          for (var i=0;i<parseInt(nt.rows);i++)
          {
            var newrow = document.createElement('TR');
            for (var j=0; j<parseInt(nt.cols); j++)
            {
              var newcell = document.createElement('TD');
              newcell.innerHTML = "&nbsp;"; // otherwise it doesn't show cell borders
              newrow.appendChild(newcell);
            }
            newtable.appendChild(newrow);
          }
          
          insertNodeAtSelection(ed.contentWindow, newtable);
          
          SPAW_toggle_borders(editor, ed.contentDocument.body, null);
          SPAW_update_toolbar(editor, true);    
        }
        catch (excp)
        {
          alert('error');
        }
      }
  }
  
  function SPAW_table_prop_click(editor, sender)
  {
    var tTable = SPAW_getTable(editor);
    
    if (tTable)
    {
      var tProps = {};
      tProps.width = (tTable.style.width)?tTable.style.width:tTable.width;
      tProps.height = (tTable.style.height)?tTable.style.height:tTable.height;
      tProps.border = tTable.border;
      tProps.cellPadding = tTable.cellPadding;
      tProps.cellSpacing = tTable.cellSpacing;
      tProps.bgColor = tTable.bgColor;
      tProps.className = tTable.className;
      if (tTable.style.backgroundImage != undefined)
        tProps.background = tTable.style.backgroundImage.substr(4,tTable.style.backgroundImage.length-5);
      
      var wnd = window.open('<?php echo $GLOBALS["spaw_dir"]?>dialogs/table.php?lang=' 
      + document.getElementById('SPAW_'+editor+'_lang').value + '&theme=' 
      + document.getElementById('SPAW_'+editor+'_theme').value
      + '&editor=' + editor + '&callback=SPAW_table_prop_click_callback', "table_prop", 
      'status=no,modal=yes,width=420,height=420'); 
      wnd.dialogArguments = tProps;
    }
    
  }

  function SPAW_table_prop_click_callback(editor, sender)
  {
    var ntProps = sender.returnValue;

    var ed = document.getElementById(editor+'_rEdit');
    
    var tTable = SPAW_getTable(editor)

    if (tTable && ntProps)
    {
      // set new settings
      if (ntProps.width)
        tTable.width = ntProps.width;
      else
        tTable.removeAttribute('width',0);
      if (ntProps.height)
        tTable.height = ntProps.height
      else
        tTable.removeAttribute('height',0);
      if (ntProps.border)
        tTable.border = ntProps.border;
      else
        tTable.removeAttribute('border',0);
      if (ntProps.cellPadding) 
        tTable.cellPadding = ntProps.cellPadding;
      else
        tTable.removeAttribute('cellpadding',0);
      if (ntProps.cellSpacing) 
        tTable.cellSpacing = ntProps.cellSpacing;
      else
        tTable.removeAttribute('cellspacing',0);
      if (ntProps.bgColor)
        tTable.bgColor = ntProps.bgColor;
      else
        tTable.removeAttribute('bgcolor',0);
      if (ntProps.background)
	  	  tTable.style.backgroundImage = "url("+ntProps.background+")";
      else
	  	  tTable.style.backgroundImage = "";
      if (ntProps.className)
        tTable.className = ntProps.className;
      else
        tTable.removeAttribute('className',0);

      SPAW_toggle_borders(editor, tTable, null);
    }

    SPAW_update_toolbar(editor, true);    
  }
  
  // edits table cell properties
  function SPAW_table_cell_prop_click(editor, sender)
  {
    var cd = SPAW_getTD(editor);
    if (cd)
    {
      var cProps = {};
      cProps.width = (cd.style.width)?cd.style.width:cd.width;
      cProps.height = (cd.style.height)?cd.style.height:cd.height;
      cProps.bgColor = cd.bgColor;
      if (cd.style.backgroundImage != undefined)
        cProps.background = cd.style.backgroundImage.substr(4,cd.style.backgroundImage.length-5);

      cProps.align = cd.align;
      cProps.vAlign = cd.vAlign;
      cProps.className = cd.className;
      cProps.noWrap = cd.noWrap;
      cProps.styleOptions = new Array();
      if (document.getElementById('SPAW_'+editor+'_tb_style') != null)
      {
        cProps.styleOptions = document.getElementById('SPAW_'+editor+'_tb_style').options;
      }
      
      var wnd = window.open('<?php echo $GLOBALS["spaw_dir"]?>dialogs/td.php?lang=' 
      + document.getElementById('SPAW_'+editor+'_lang').value + '&theme=' 
      + document.getElementById('SPAW_'+editor+'_theme').value
      + '&editor=' + editor + '&callback=SPAW_table_cell_prop_click_callback', "table_prop", 
      'status=no,modal=yes,width=420,height=420'); 
      wnd.dialogArguments = cProps;
    }    
  }

  function SPAW_table_cell_prop_click_callback(editor, sender)
  {
    var ncProps = sender.returnValue;

    var ed = document.getElementById(editor+'_rEdit');
    
    var cd = SPAW_getTD(editor)

    if (cd && ncProps)  
    {
      if (ncProps.align)
        cd.align = ncProps.align;
      else
        cd.removeAttribute('align',0);
      if (ncProps.vAlign)
        cd.vAlign = ncProps.vAlign;
      else
        cd.removeAttribute('valign',0);
      if (ncProps.width)
        cd.width = ncProps.width;
      else
        cd.removeAttribute('width',0);
      if (ncProps.height)
        cd.height = ncProps.height;
      else
        cd.removeAttribute('height',0);
      if (ncProps.bgColor)
        cd.bgColor = ncProps.bgColor;
      else
        cd.removeAttribute('bgcolor',0);
      if (ncProps.background)
        cd.style.backgroundImage = "url(" + ncProps.background + ")";
      else
        cd.style.backgroundImage = "";
      if (ncProps.className)
        cd.className = ncProps.className;
      else
        cd.removeAttribute('className',0);
      if (ncProps.noWrap)
        cd.noWrap = ncProps.noWrap;
      else
        cd.removeAttribute('nowrap',0);
    }
    SPAW_update_toolbar(editor, true);    
  }


  // returns current table cell  
  function SPAW_getTD(editor)
  {
    var ed = document.getElementById(editor+'_rEdit');
    var selection = ed.contentWindow.getSelection();
    var selectedRange;
    var aControl;
    if (selection.rangeCount > 0) {
      selectedRange = selection.getRangeAt(0);
      aControl = selectedRange.startContainer;
      if (aControl.nodeType != 1)
        aControl = aControl.parentNode;
      while ((aControl.tagName.toLowerCase() != 'td')
        && (aControl.tagName.toLowerCase() != 'th') 
        && (aControl.tagName.toLowerCase() != 'table') 
        && (aControl.tagName.toLowerCase() != 'body'))
      {
        aControl = aControl.parentNode;
      }
    }
    if (aControl.tagName.toLowerCase() == 'td' || aControl.tagName.toLowerCase() == 'th')
      return(aControl);
    else
      return(null);
  }

  // returns current table row  
  function SPAW_getTR(editor)
  {
    var ed = document.getElementById(editor+'_rEdit');
    var selection = ed.contentWindow.getSelection();
    var selectedRange;
    var aControl;
    if (selection.rangeCount > 0) {
      selectedRange = selection.getRangeAt(0);
      aControl = selectedRange.startContainer;
      if (aControl.nodeType != 1)
        aControl = aControl.parentNode;
      while ((aControl.tagName.toLowerCase() != 'tr')
        && (aControl.tagName.toLowerCase() != 'table') 
        && (aControl.tagName.toLowerCase() != 'body'))
      {
        aControl = aControl.parentNode;
      }
    }
    if (aControl.tagName.toLowerCase() == 'tr')
      return(aControl);
    else
      return(null);
  }
  
  // returns current table  
  function SPAW_getTable(editor)
  {
    var ed = document.getElementById(editor+'_rEdit');
    var selection = ed.contentWindow.getSelection();
    var selectedRange;
    var aControl = null;
    if (selection && selection.rangeCount > 0) {
      selectedRange = selection.getRangeAt(0);
      aControl = selectedRange.startContainer;
      if (aControl.nodeType != 1)
        aControl = aControl.parentNode;
      while ((aControl.tagName.toLowerCase() != 'table') && (aControl.tagName.toLowerCase() != 'body'))
      {
        aControl = aControl.parentNode;
      }
      if (aControl.tagName.toLowerCase() != 'table')
        aControl = null;
    }
    return(aControl);
  }
  
  // returns selected image
  function SPAW_getImg(editor) 
  {
    var result = null;
    var ed = document.getElementById(editor+'_rEdit');
    var selection = ed.contentWindow.getSelection();
    var selectedRange;
    if (selection && selection.rangeCount > 0) {
      selectedRange = selection.getRangeAt(0);
      if (selectedRange.startContainer.nodeType == 1) // element node
      {
        var aControl = selectedRange.startContainer.childNodes[selectedRange.startOffset];
        if (aControl && aControl.tagName && aControl.tagName.toLowerCase() == 'img')
          result = aControl
      }
    }
    return result;
  }

  function SPAW_table_row_insert_click(editor, sender)
  {
  } // insertRow
  
  function SPAW_formCellMatrix(ct)
  {
  }
  
  function SPAW_table_column_insert_click(editor, sender)
  {
  } // insertColumn
  
  function SPAW_table_cell_merge_right_click(editor, sender)
  {
  } // mergeRight


  function SPAW_table_cell_merge_down_click(editor, sender)
  {
  } // mergeDown
  
  function SPAW_table_row_delete_click(editor, sender)
  {
  } // deleteRow
  
  function SPAW_table_column_delete_click(editor, sender)
  {
  } // deleteColumn
  
  // split cell horizontally
  function SPAW_table_cell_split_horizontal_click(editor, sender)
  {
  } // splitH
  
  function SPAW_table_cell_split_vertical_click(editor, sender)
  {
  } // splitV
  

  // switch to wysiwyg mode
  function SPAW_design_tab_click(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
    iText = document.getElementById(editor).value;
    // mozilla bug? workaround
    ed.contentDocument.designMode = "off";
    
    ed.contentDocument.body.innerHTML = iText;
    
    document.getElementById('SPAW_'+editor+'_editor_mode').value = 'design';

    // turn off html mode toolbars
    document.getElementById('SPAW_'+editor+'_toolbar_top_html').style.display = 'none';
    document.getElementById('SPAW_'+editor+'_toolbar_left_html').style.display = 'none';
    document.getElementById('SPAW_'+editor+'_toolbar_right_html').style.display = 'none';
    document.getElementById('SPAW_'+editor+'_toolbar_bottom_html').style.display = 'none';

    // turn on design mode toolbars
    document.getElementById('SPAW_'+editor+'_toolbar_top_design').style.display = '';
    document.getElementById('SPAW_'+editor+'_toolbar_left_design').style.display = '';
    document.getElementById('SPAW_'+editor+'_toolbar_right_design').style.display = '';
    document.getElementById('SPAW_'+editor+'_toolbar_bottom_design').style.display = '';

    // switch editors    
    document.getElementById(editor).style.display = "none";
    ed.style.display = "";
    // workaround mozilla bug with losing design mode
    ed.contentDocument.designMode = "on";
    //document.getElementById(editor+"_rEdit").contentDocument.body.focus();
    
    // turn on invisible borders if needed
    //SPAW_toggle_borders(editor,ed.contentDocument.body, null);
    
    SPAW_update_toolbar(editor, true);    
  }
  
  // switch to html mode
  function SPAW_html_tab_click(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
    var iHTML = SPAW_getHtmlValue(editor, null);

    document.getElementById(editor).value = iHTML;
    
    document.getElementById('SPAW_'+editor+'_editor_mode').value = 'html';

    // turn off design mode toolbars
    document.getElementById('SPAW_'+editor+'_toolbar_top_design').style.display = 'none';
    document.getElementById('SPAW_'+editor+'_toolbar_left_design').style.display = 'none';
    document.getElementById('SPAW_'+editor+'_toolbar_right_design').style.display = 'none';
    document.getElementById('SPAW_'+editor+'_toolbar_bottom_design').style.display = 'none';

    // turn on html mode toolbars
    document.getElementById('SPAW_'+editor+'_toolbar_top_html').style.display = '';
    document.getElementById('SPAW_'+editor+'_toolbar_left_html').style.display = '';
    document.getElementById('SPAW_'+editor+'_toolbar_right_html').style.display = '';
    document.getElementById('SPAW_'+editor+'_toolbar_bottom_html').style.display = '';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -