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

📄 script.js.php

📁 架設ROSE私服必備之物 ROSE數據庫
💻 PHP
📖 第 1 页 / 共 5 页
字号:
              tempr.cells(j).rowSpan--;
          }
        }
    
        
        curCI = -1;
        // check for current row cells spanning more than 1 row
        for (var i=0; i<tm[cr.rowIndex].length; i++)
        {
          prevCI = curCI;
          curCI = tm[cr.rowIndex][i];
          if (curCI != -1 && curCI != prevCI && cr.cells(curCI).rowSpan>1 && (cr.rowIndex+1)<ct.rows.length)
          {
            ni = i;
            nrCI = tm[cr.rowIndex+1][ni];
            while (nrCI == -1) 
            {
              ni++;
              if (ni<ct.rows(cr.rowIndex+1).cells.length)
                nrCI = tm[cr.rowIndex+1][ni];
              else
                nrCI = ct.rows(cr.rowIndex+1).cells.length;
            }
            
            var newc = ct.rows(cr.rowIndex+1).insertCell(nrCI);
            ct.rows(cr.rowIndex).cells(curCI).rowSpan--;
            var nc = ct.rows(cr.rowIndex).cells(curCI).cloneNode();
            newc.replaceNode(nc);
            // fix the matrix
            cs = (cr.cells(curCI).colSpan>1)?cr.cells(curCI).colSpan:1;
            for (var j=i; j<(i+cs);j++)
            {
              tm[cr.rowIndex+1][j] = nrCI;
              nj = j;
            }
            for (var j=nj; j<tm[cr.rowIndex+1].length; j++)
            {
              if (tm[cr.rowIndex+1][j] != -1)
                tm[cr.rowIndex+1][j]++;
            }
          }
        }
        // delete row
        ct.deleteRow(cr.rowIndex);
      }
    }
    SPAW_update_toolbar(editor, true);    
  } // deleteRow
  
  function SPAW_table_column_delete_click(editor, sender)
  {
    var ct = SPAW_getTable(editor); // current table
    var cr = SPAW_getTR(editor); // current row
    var cd = SPAW_getTD(editor); // current cell

    if (cd && cr && ct)
    {
      // get "real" cell position and form cell matrix
      var tm = SPAW_formCellMatrix(ct);

      // if there's only one column delete the table
      if (tm[0].length<=1)  
      {
        ct.removeNode(true);
      }
      else
      {
        for (var j=0; j<tm[cr.rowIndex].length; j++)
        {
          if (tm[cr.rowIndex][j] == cd.cellIndex)
          {
            realIndex=j;
            break;
          }
        }
        
        for (var i=0; i<ct.rows.length; i++)
        {
          if (tm[i][realIndex] != -1)
          {
            if (ct.rows(i).cells(tm[i][realIndex]).colSpan>1)
              ct.rows(i).cells(tm[i][realIndex]).colSpan--;
            else
              ct.rows(i).deleteCell(tm[i][realIndex]);
          }
        }
      }
    }
    SPAW_update_toolbar(editor, true);    
  } // deleteColumn
  
  // split cell horizontally
  function SPAW_table_cell_split_horizontal_click(editor, sender)
  {
    var ct = SPAW_getTable(editor); // current table
    var cr = SPAW_getTR(editor); // current row
    var cd = SPAW_getTD(editor); // current cell

    if (cd && cr && ct)
    {
      // get "real" cell position and form cell matrix
      var tm = SPAW_formCellMatrix(ct);
  
      for (var j=0; j<tm[cr.rowIndex].length; j++)
      {
        if (tm[cr.rowIndex][j] == cd.cellIndex)
        {
          realIndex=j;
          break;
        }
      }
      
      if (cd.rowSpan>1) 
      {
        // split only current cell
        // find where to insert a cell in the next row
        i = realIndex;
        while (tm[cr.rowIndex+1][i] == -1) i++;
        if (i == tm[cr.rowIndex+1].length) 
          ni = ct.rows(cr.rowIndex+1).cells.length;
        else
          ni = tm[cr.rowIndex+1][i];
          
        var newc = ct.rows(cr.rowIndex+1).insertCell(ni);
        cd.rowSpan--;
        var nc = cd.cloneNode();
        newc.replaceNode(nc);
  
        cd.rowSpan = 1;
      }
      else
      {
        // add new row and make all other cells to span one row more
        ct.insertRow(cr.rowIndex+1);
        for (var i=0; i<cr.cells.length; i++)
        {
          if (i != cd.cellIndex)
          {
            rs = cr.cells(i).rowSpan>1?cr.cells(i).rowSpan:1;
            cr.cells(i).rowSpan = rs+1;
          }
        }
  
        for (var i=0; i<cr.rowIndex; i++)
        {
          var tempr = ct.rows(i);
          for (var j=0; j<tempr.cells.length; j++)
          {
            if (tempr.cells(j).rowSpan > (cr.rowIndex - i))
              tempr.cells(j).rowSpan++;
          }
        }
        
        // clone current cell to new row
        var newc = ct.rows(cr.rowIndex+1).insertCell(0);
        var nc = cd.cloneNode();
        newc.replaceNode(nc);
      }
    }
    SPAW_update_toolbar(editor, true);    
  } // splitH
  
  function SPAW_table_cell_split_vertical_click(editor, sender)
  {
    var ct = SPAW_getTable(editor); // current table
    var cr = SPAW_getTR(editor); // current row
    var cd = SPAW_getTD(editor); // current cell

    if (cd && cr && ct)
    {
      // get "real" cell position and form cell matrix
      var tm = SPAW_formCellMatrix(ct);
  
      for (var j=0; j<tm[cr.rowIndex].length; j++)
      {
        if (tm[cr.rowIndex][j] == cd.cellIndex)
        {
          realIndex=j;
          break;
        }
      }
      
      if (cd.colSpan>1)    
      {
        // split only current cell
        var newc = ct.rows(cr.rowIndex).insertCell(cd.cellIndex+1);
        cd.colSpan--;
        var nc = cd.cloneNode();
        newc.replaceNode(nc);
        cd.colSpan = 1;
      }
      else
      {
        // clone current cell
        var newc = ct.rows(cr.rowIndex).insertCell(cd.cellIndex+1);
        var nc = cd.cloneNode();
        newc.replaceNode(nc);
        
        for (var i=0; i<tm.length; i++)
        {
          if (i!=cr.rowIndex && tm[i][realIndex] != -1)
          {
            cs = ct.rows(i).cells(tm[i][realIndex]).colSpan>1?ct.rows(i).cells(tm[i][realIndex]).colSpan:1;
            ct.rows(i).cells(tm[i][realIndex]).colSpan = cs+1;
          }
        }
      }
    }
    SPAW_update_toolbar(editor, true);    
  } // splitV
  

  // switch to wysiwyg mode
  function SPAW_design_tab_click(editor, sender)
  {
    //iText = this[editor+'_rEdit'].document.body.innerText;
    iText = document.all[editor].value;
    this[editor+'_rEdit'].document.body.innerHTML = iText;
    
    document.all['SPAW_'+editor+'_editor_mode'].value = 'design';

    // turn off html mode toolbars
    document.all['SPAW_'+editor+'_toolbar_top_html'].style.display = 'none';
    document.all['SPAW_'+editor+'_toolbar_left_html'].style.display = 'none';
    document.all['SPAW_'+editor+'_toolbar_right_html'].style.display = 'none';
    document.all['SPAW_'+editor+'_toolbar_bottom_html'].style.display = 'none';

    // turn on design mode toolbars
    document.all['SPAW_'+editor+'_toolbar_top_design'].style.display = 'inline';
    document.all['SPAW_'+editor+'_toolbar_left_design'].style.display = 'inline';
    document.all['SPAW_'+editor+'_toolbar_right_design'].style.display = 'inline';
    document.all['SPAW_'+editor+'_toolbar_bottom_design'].style.display = 'inline';

    // switch editors    
    document.all[editor].style.display = "none";
    document.all[editor+"_rEdit"].style.display = "inline";
    document.all[editor+"_rEdit"].document.body.focus();
    
    // turn on invisible borders if needed
    SPAW_toggle_borders(editor,this[editor+'_rEdit'].document.body, null);
    
    this[editor+'_rEdit'].focus();
    SPAW_update_toolbar(editor, true);    
  }
  
  // switch to html mode
  function SPAW_html_tab_click(editor, sender)
  {
    var iHTML = SPAW_getHtmlValue(editor, null);

    //iHTML = this[editor+'_rEdit'].document.body.innerHTML;
    //this[editor+'_rEdit'].document.body.innerText = iHTML;
    document.all[editor].value = iHTML;
    
    document.all['SPAW_'+editor+'_editor_mode'].value = 'html';

    // turn off design mode toolbars
    document.all['SPAW_'+editor+'_toolbar_top_design'].style.display = 'none';
    document.all['SPAW_'+editor+'_toolbar_left_design'].style.display = 'none';
    document.all['SPAW_'+editor+'_toolbar_right_design'].style.display = 'none';
    document.all['SPAW_'+editor+'_toolbar_bottom_design'].style.display = 'none';

    // turn on html mode toolbars
    document.all['SPAW_'+editor+'_toolbar_top_html'].style.display = 'inline';
    document.all['SPAW_'+editor+'_toolbar_left_html'].style.display = 'inline';
    document.all['SPAW_'+editor+'_toolbar_right_html'].style.display = 'inline';
    document.all['SPAW_'+editor+'_toolbar_bottom_html'].style.display = 'inline';

    // switch editors    
    document.all[editor+"_rEdit"].style.display = "none";
    document.all[editor].style.display = "inline";
    document.all[editor].focus();

    this[editor+'_rEdit'].focus();
    SPAW_update_toolbar(editor, true);    
  }
  
  function SPAW_getFieldByEditor(editor, field)
  {
    // NOTE: this function doesn't make much sense in the current situation
    // but is left so nothing gets broken
    var thefield;
    // get by id
    //// OLD: get field by editor name if no field passed
    if (field == null || field == "")
    {
      // var flds = document.getElementsByName(editor);
      // thefield = flds[0].id;
      thefield = document.getElementById(editor).id;
    }
    else
    {
      thefield=field;
    }
    return thefield;
  }
  
  function SPAW_stripAbsoluteUrl(editor, url)
  {
	var curl = window.frames[editor+'_rEdit'].location.href;
	var di = curl.lastIndexOf('/', curl.lastIndexOf('?')!=-1?curl.lastIndexOf('?'):curl.length);
	var cdir = curl;
	if (di != -1)
		cdir = curl.substr(0,di+1);
	var chost = curl;
	var hi = curl.indexOf('/',curl.indexOf('://')!=-1?(curl.indexOf('://')+3):curl.length);
	if (hi != -1)
		chost = curl.substr(0,hi);
  	if (url.toLowerCase().indexOf(curl.toLowerCase())==0)
	{
		url = url.substr(curl.length);
	}
	else if (url.toLowerCase().indexOf(cdir.toLowerCase())==0)
	{
		url = url.substr(cdir.length);
	}
	else if (url.toLowerCase().indexOf(chost.toLowerCase())==0)
	{
		url = url.substr(chost.length);
	}
	return(url);
  }

  function SPAW_stripAbsoluteUrlFromImg(editor, url)
  {
	var curl = window.frames[editor+'_rEdit'].location.href;
	var chost = curl;
	var hi = curl.indexOf('/',curl.indexOf('://')!=-1?(curl.indexOf('://')+3):curl.length);
	if (hi != -1)
		chost = curl.substr(0,hi);
	if (url.toLowerCase().indexOf(chost.toLowerCase())==0)
	{
		url = url.substr(chost.length);
	}
	return(url);
  }
  
  function SPAW_getHtmlValue(editor, thefield)
  {
    var htmlvalue;

    if(document.all['SPAW_'+editor+'_editor_mode'].value == 'design')
    {
      // wysiwyg
	  // replace automatic absolute urls
	  var links = this[editor+'_rEdit'].document.getElementsByTagName('A');
	  var aln = 0;
	  if (links != null) aln = links.length;
	  for (var i=0;i<aln;i++)
	  {
	  	links[i].href = SPAW_stripAbsoluteUrl(editor, links[i].href);
		if (!links[i].href)
		{
			links[i].removeAttribute('href',0);
		}
	  }

	  var imgs = this[editor+'_rEdit'].document.getElementsByTagName('IMG');
	  var aln = 0;
	  if (imgs != null) aln = imgs.length;
	  for (var i=0;i<aln;i++)
	  {
	  	imgs[i].src = SPAW_stripAbsoluteUrlFromImg(editor, imgs[i].src);
	  }
	  
      htmlvalue = this[editor+'_rEdit'].document.body.innerHTML;
    }
    else
    {
      // code
      htmlvalue = document.all[thefield].value;
    }
    return htmlvalue;
  }
  
  function SPAW_updateField(editor, field)
  {  
    var thefield = SPAW_getFieldByEditor(editor, field);
    
    var htmlvalue = SPAW_getHtmlValue(editor, thefield);

    if (document.all[thefield].value != htmlvalue)
    {
      // something changed
      document.all[thefield].value = htmlvalue;
    }
  }

  function SPAW_confirm(editor,block,message) {
    return showModalDialog('<?php echo $GLOBALS["spaw_dir"]?>dialogs/confirm.php?lang=' + document.all['SPAW_'+editor+'_lang'].value + '&theme=' + document.all['SPAW_'+editor+'_theme'].value + '&block=' + block + '&message=' + message, null, 'dialogHeight:100px; dialogWidth:300px; resizable:no; status:no');  
  }
  
  // cleanup html
  function SPAW_cleanup_click(editor, sender)
  {
    if (SPAW_confirm(editor,'cleanup','confirm'))
    {
      window.frames[editor+'_rEdit'].focus();     
  
      var found = true;
      while (found)
      {
        found = false;
        var els = window.frames[editor+'_rEdit'].document.body.all;
        for (var i=0; i<els.length; i++)
        {
          // remove tags with urns set
          if (els[i].tagUrn != null && els[i].tagUrn != '')
          {
            els[i].removeNode(false);
            found = true;
          } 
          

⌨️ 快捷键说明

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