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

📄 script_gecko.js.php

📁 架設ROSE私服必備之物 ROSE數據庫
💻 PHP
📖 第 1 页 / 共 4 页
字号:
      if (naProps.name)
      {
        a.name = naProps.name;
      }
      else
      if (naProps.href)
        a.href = naProps.href;
      if (naProps.target && naProps.target!='_self')
        a.target = naProps.target;
      if (naProps.title)
        a.title = naProps.title;
      
      if (ed.contentWindow.getSelection().rangeCount>0 
      && ed.contentWindow.getSelection().getRangeAt(0).startOffset != ed.contentWindow.getSelection().getRangeAt(0).endOffset)
      {
        a.appendChild(ed.contentWindow.getSelection().getRangeAt(0).cloneContents());
      }
      else
      {
        a.innerHTML = (a.href && a.attributes["href"].nodeValue!='')?a.attributes["href"].nodeValue:a.name;
      }
      
      insertNodeAtSelection(ed.contentWindow, a);        
        
    }
  }

  function SPAW_internal_link_click(editor, sender)
  {
  }
  
  function SPAW_image_insert_click(editor, sender)
  {
    var wnd = window.open('<?php echo $GLOBALS["spaw_dir"]?>dialogs/img_library.php?lang=' 
      + document.getElementById('SPAW_'+editor+'_lang').value + '&theme=' 
      + document.getElementById('SPAW_'+editor+'_theme').value
      + '&editor=' + editor + '&callback=SPAW_image_insert_click_callback', "img_library", 
      'status=no,modal=yes,width=420,height=420'); 
  }
  
  function SPAW_image_insert_click_callback(editor, sender)
  {
    var imgSrc = sender.returnValue;
    if (imgSrc != null)
    {
      var ed = document.getElementById(editor+'_rEdit');
     	ed.contentDocument.execCommand('insertimage', false, imgSrc);
    }
    ed.contentWindow.focus();
  }
  
  function SPAW_image_prop_click(editor, sender)
  {
    var im = SPAW_getImg(editor); // current img
    
    if (im)
    {
      var iProps = {};
      if (im.attributes["src"])
        iProps.src = im.attributes["src"].nodeValue;
      iProps.alt = im.alt;
      iProps.width = (im.style.width)?im.style.width:im.width;
      iProps.height = (im.style.height)?im.style.height:im.height;
      iProps.border = im.border;
      iProps.align = im.align;
      if (im.hspace>-1) // (-1 when not set under gecko for some reason)
        iProps.hspace = im.attributes["hspace"].nodeValue;
      if (im.vspace>-1)
        iProps.vspace = im.attributes["vspace"].nodeValue;

      var wnd = window.open('<?php echo $GLOBALS["spaw_dir"]?>dialogs/img.php?lang=' 
        + document.getElementById('SPAW_'+editor+'_lang').value + '&theme=' 
        + document.getElementById('SPAW_'+editor+'_theme').value
        + '&editor=' + editor + '&callback=SPAW_image_prop_click_callback', "img_prop", 
        'status=no,modal=yes,width=420,height=420'); 
      wnd.dialogArguments = iProps;
    }
  }

  function SPAW_image_prop_click_callback(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
    var niProps = sender.returnValue;
    var im = SPAW_getImg(editor); // current img
    
    if (im && niProps)
    {
      im.src = (niProps.src)?niProps.src:'';
      if (niProps.alt) {
        im.alt = niProps.alt;
      }
      else
      {
        im.removeAttribute("alt",0);
      }
      im.align = (niProps.align)?niProps.align:'';
      im.width = (niProps.width)?niProps.width:'';
      //im.style.width = (niProps.width)?niProps.width:'';
      im.height = (niProps.height)?niProps.height:'';
      //im.style.height = (niProps.height)?niProps.height:'';
      if (niProps.border) {
        im.border = niProps.border;
      }
      else
      {
        im.removeAttribute("border",0);
      }
      if (niProps.hspace) {
        im.hspace = niProps.hspace;
      }
      else
      {
        im.removeAttribute("hspace",0);
      }
      if (niProps.vspace) {
        im.vspace = niProps.vspace;
      }
      else
      {
        im.removeAttribute("vspace",0);
      }
    }    
  
    ed.contentWindow.focus();
  }


  function SPAW_image_popup_click(editor, sender)
  {
    var wnd = window.open('<?php echo $GLOBALS["spaw_dir"]?>dialogs/img_library.php?lang=' 
      + document.getElementById('SPAW_'+editor+'_lang').value + '&theme=' 
      + document.getElementById('SPAW_'+editor+'_theme').value
      + '&editor=' + editor + '&callback=SPAW_image_popup_click_callback', "img_library", 
      'status=no,modal=yes,width=420,height=420'); 
  }
  
  function SPAW_image_popup_click_callback(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
   	var a = SPAW_getA(editor);
   	var imgSrc = sender.returnValue;

    if(imgSrc != null)    
    {
      if (a)
      {
        // edit hyperlink
        a.href="#";
        a.setAttribute("onclick","window.open('<?php echo $spaw_img_popup_url?>?img_url="+imgSrc+"','Image','width=500,height=300,scrollbars=no,toolbar=no,location=no,status=no,resizable=yes,screenX=120,screenY=100');return false;");
      }
      else
      {
        var a;
        a = document.createElement('A');
        a.href="#";
        a.setAttribute("onclick","window.open('<?php echo $spaw_img_popup_url?>?img_url="+imgSrc+"','Image','width=500,height=300,scrollbars=no,toolbar=no,location=no,status=no,resizable=yes,screenX=120,screenY=100');return false;");

        if (ed.contentWindow.getSelection().rangeCount>0 
        && ed.contentWindow.getSelection().getRangeAt(0).startOffset != ed.contentWindow.getSelection().getRangeAt(0).endOffset)
        {
          a.appendChild(ed.contentWindow.getSelection().getRangeAt(0).cloneContents());
        }
        else
        {
          a.innerHTML = (a.href && a.attributes["href"].nodeValue!='')?a.attributes["href"].nodeValue:a.name;
        }
        
        insertNodeAtSelection(ed.contentWindow, a);  
      }      
		}	
    ed.contentWindow.focus();
  }
  
  function SPAW_hr_click(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
   	ed.contentDocument.execCommand('inserthorizontalrule', false, null);
    ed.contentWindow.focus();
    SPAW_update_toolbar(editor, true);    
  }

  function SPAW_copy_click(editor, sender)
  {
    // not implemented in gecko
  }

  function SPAW_paste_click(editor, sender)
  {
    // not implemented in gecko
  }
  
  function SPAW_cut_click(editor, sender)
  {
    // not implemented in gecko
  }

  function SPAW_delete_click(editor, sender)
  {
    // not implemented in gecko
  }

  function SPAW_indent_click(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
   	ed.contentDocument.execCommand('indent', false, null);
    ed.contentWindow.focus();
    SPAW_update_toolbar(editor, true);    
  }

  function SPAW_unindent_click(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
   	ed.contentDocument.execCommand('outdent', false, null);
    ed.contentWindow.focus();
    SPAW_update_toolbar(editor, true);    
  }

  function SPAW_undo_click(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
   	ed.contentDocument.execCommand('undo','',null);
    ed.contentWindow.focus();
    SPAW_update_toolbar(editor, true);    
  }

  function SPAW_redo_click(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
   	ed.contentDocument.execCommand('redo', false, null);
    ed.contentWindow.focus();
    SPAW_update_toolbar(editor, true);    
  }
  
  
  function SPAW_getParentTag(editor)
  {
    var ed = document.getElementById(editor+'_rEdit');
    var selection = ed.contentWindow.getSelection();
    var selectedRange;
    var aControl;
    if (selection && selection.rangeCount > 0) {
      selectedRange = selection.getRangeAt(0);
      aControl = selectedRange.startContainer;
      if (aControl.nodeType != 1)
        aControl = aControl.parentNode;
    }
    return aControl;
 
  }

  // trim functions  
  function SPAW_ltrim(txt)
  {
  }
  function SPAW_rtrim(txt)
  {
  }
  function SPAW_trim(txt)
  {
  }

  
  // is selected text a full tags inner html?
  function SPAW_isFoolTag(editor, el)
  {
  }
  
  function SPAW_style_change(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
    
    var classname = sender.options[sender.selectedIndex].value;
    
    if (ed.contentWindow.getSelection().rangeCount>0)
    {
      var currentRange = ed.contentWindow.getSelection().getRangeAt(0);

      var parent = currentRange.commonAncestorContainer;
      if (parent.nodeType != 1)
        parent = currentRange.commonAncestorContainer.parentNode;
      
      if (parent && parent.tagName.toLowerCase() != "body" && parent.tagName.toLowerCase() != "html")
      {
        // set class on parent
        parent.className = classname;
      }
      else
      {
        // create new container
        var newSpan = ed.contentDocument.createElement("SPAN");
        newSpan.className = classname;
        newSpan.appendChild(currentRange.cloneContents());
        insertNodeAtSelection(ed.contentWindow, newSpan);
      }
    }

    ed.contentWindow.focus();
    SPAW_update_toolbar(editor, true);    
  }

  function SPAW_font_change(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
    var fontname = sender.options[sender.selectedIndex].value;
    
    if (fontname == null || fontname == '')
    {
      ed.contentDocument.execCommand('RemoveFormat', false, null);
    }
    else   
    {
      ed.contentDocument.execCommand('fontname', false, fontname);
    }

    sender.selectedIndex = 0;

    ed.contentWindow.focus();
    SPAW_update_toolbar(editor, true);    
  
  }

  function SPAW_fontsize_change(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
    var fontsize = sender.options[sender.selectedIndex].value;

    ed.contentDocument.execCommand('fontsize', false, fontsize);

    sender.selectedIndex = 0;
    ed.contentWindow.focus();
    SPAW_update_toolbar(editor, true);    
  }

  function SPAW_paragraph_change(editor, sender)
  {
    var ed = document.getElementById(editor+'_rEdit');
    var format = sender.options[sender.selectedIndex].value;

    ed.contentDocument.execCommand('formatBlock', false, format);

    sender.selectedIndex = 0;
    ed.contentWindow.focus();
    SPAW_update_toolbar(editor, true);    
  }
    
  function SPAW_table_create_click(editor, sender)
  {
      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_create_click_callback', "table_prop", 
      'status=no,modal=yes,width=420,height=420'); 
  }
  
  function SPAW_table_create_click_callback(editor, sender)
  {
    var nt = sender.returnValue;

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

      if (nt)
      {
        var newtable = document.createElement('TABLE');
        try 
        {
          if (nt.width)
            newtable.width = nt.width;
          if (nt.height)
            newtable.height = nt.height;
          if (nt.border)
            newtable.border = nt.border;
          if (nt.cellPadding) 
            newtable.cellPadding = nt.cellPadding;
          if (nt.cellSpacing) 
            newtable.cellSpacing = nt.cellSpacing;
          if (nt.bgColor)

⌨️ 快捷键说明

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