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

📄 script.js.php

📁 又是一款WEB游戏的源代码
💻 PHP
📖 第 1 页 / 共 5 页
字号:
  // control registration array  var spaw_editors = new Array();    // returns true if editor is already registered  function SPAW_editor_registered(editor)  {    var found = false;    for(var i=0;i<spaw_editors.length;i++)    {      if (spaw_editors[i] == editor)      {        found = true;        break;      }    }    return(found);  }    // onsubmit  function SPAW_UpdateFields()  {    for (var i=0; i<spaw_editors.length; i++)    {      SPAW_updateField(spaw_editors[i], null);    }  }    // adds event handler for the form to update hidden fields  function SPAW_addOnSubmitHandler(editor)  {    thefield = SPAW_getFieldByEditor(editor, null);    var sTemp = "";    oForm = document.all[thefield].form;    if(oForm.onsubmit != null) {      sTemp = oForm.onsubmit.toString();      iStart = sTemp.indexOf("{") + 2;      sTemp = sTemp.substr(iStart,sTemp.length-iStart-2);    }    if (sTemp.indexOf("SPAW_UpdateFields();") == -1)    {      oForm.onsubmit = new Function("SPAW_UpdateFields();" + sTemp);    }  }  // editor initialization  function SPAW_editorInit(editor, css_stylesheet, direction)  {          if (this[editor+'_rEdit'].document.designMode != 'on')     {      this[editor+'_rEdit'].document.designMode = 'On';     }      // check if the editor completely loaded and schedule to try again if not     if (this[editor+'_rEdit'].document.readyState != 'complete')     {       setTimeout(function(){SPAW_editorInit(editor, css_stylesheet, direction);},20);       return;     }     // register the editor   // prevent from executing twice on the same editor     if (!SPAW_editor_registered(editor))     {       spaw_editors[spaw_editors.length] = editor;     }       // add on submit handler     SPAW_addOnSubmitHandler(editor);      if (this[editor+'_rEdit'].document.readyState == 'complete')     {       this[editor+'_rEdit'].document.createStyleSheet(css_stylesheet);       this[editor+'_rEdit'].document.body.dir = direction;       this[editor+'_rEdit'].document.body.innerHTML = document.all[editor].value;SPAW_toggle_borders(editor,this[editor+'_rEdit'].document.body,null);        // hookup active toolbar related events       this[editor+'_rEdit'].document.onkeyup = function() { SPAW_onkeyup(editor); }       this[editor+'_rEdit'].document.onmouseup = function() { SPAW_update_toolbar(editor, true); }              // initialize toolbar       spaw_context_html = "";       SPAW_update_toolbar(editor, true);     }  }        function SPAW_showColorPicker(editor,curcolor) {    return showModalDialog('<?php echo $spaw_dir?>dialogs/colorpicker.php?lang=' + document.all['SPAW_'+editor+'_lang'].value + '&theme=' + document.all['SPAW_'+editor+'_theme'].value, curcolor,       'dialogHeight:250px; dialogWidth:366px; resizable:no; status:no');    }  function SPAW_bold_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();         this[editor+'_rEdit'].document.execCommand('bold', false, null);    SPAW_update_toolbar(editor, true);      }  function SPAW_italic_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();        	this[editor+'_rEdit'].document.execCommand('italic', false, null);    SPAW_update_toolbar(editor, true);      }  function SPAW_underline_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();         this[editor+'_rEdit'].document.execCommand('underline', false, null);    SPAW_update_toolbar(editor, true);      }    function SPAW_left_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();         this[editor+'_rEdit'].document.execCommand('justifyleft', false, null);    SPAW_update_toolbar(editor, true);      }  function SPAW_center_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();       	this[editor+'_rEdit'].document.execCommand('justifycenter', false, null);    SPAW_update_toolbar(editor, true);      }  function SPAW_right_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();       	this[editor+'_rEdit'].document.execCommand('justifyright', false, null);    SPAW_update_toolbar(editor, true);      }  function SPAW_justify_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();       	this[editor+'_rEdit'].document.execCommand('justifyfull', false, null);    SPAW_update_toolbar(editor, true);      }    function SPAW_ordered_list_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();       	this[editor+'_rEdit'].document.execCommand('insertorderedlist', false, null);    SPAW_update_toolbar(editor, true);      }  function SPAW_bulleted_list_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();       	this[editor+'_rEdit'].document.execCommand('insertunorderedlist', false, null);    SPAW_update_toolbar(editor, true);      }    function SPAW_fore_color_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();         var fCol = SPAW_showColorPicker(editor,null);    if(fCol != null)      this[editor+'_rEdit'].document.execCommand('forecolor', false, fCol);    SPAW_update_toolbar(editor, true);      }  function SPAW_bg_color_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();         var bCol = SPAW_showColorPicker(editor,null);        if(bCol != null)    	this[editor+'_rEdit'].document.execCommand('backcolor', false, bCol);    SPAW_update_toolbar(editor, true);      }  /*  // using standard IE link dialog  function SPAW_hyperlink_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();       	var l = this[editor+'_rEdit'].document.execCommand('createlink');    SPAW_update_toolbar(editor, true);      }  */    function SPAW_getA(editor)  {  	var aControl = window.frames[editor+'_rEdit'].document.selection.createRange();    if (window.frames[editor+'_rEdit'].document.selection.type != "Control")    {    	aControl = aControl.parentElement();    }    else    {    	aControl = aControl(0);    }    	while ((aControl.tagName != 'A') && (aControl.tagName != 'BODY'))    {      aControl = aControl.parentElement;    }    if (aControl.tagName == 'A')      return(aControl);    else      return(null);  }  function SPAW_hyperlink_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();       	var a = SPAW_getA(editor);	    var aProps = {};	// get anchors on the page	aProps.anchors = new Array();	var links = this[editor+'_rEdit'].document.getElementsByTagName('A');	var aln = 0;	if (links != null) aln = links.length;	for (var i=0;i<aln;i++)	{		if (links[i].name != null && links[i].name != '')			aProps.anchors[aProps.anchors.length] = links[i].name;	}	if (a)	{	  // edit hyperlink      aProps.href = SPAW_stripAbsoluteUrl(editor, a.href);      aProps.name = a.name;      aProps.target = a.target;      aProps.title = a.title;        var naProps = showModalDialog('<?php echo $spaw_dir?>dialogs/a.php?lang=' + document.all['SPAW_'+editor+'_lang'].value + '&theme=' + document.all['SPAW_'+editor+'_theme'].value, aProps,         'dialogHeight:220px; dialogWidth:366px; resizable:no; status:no');              if (naProps)        {	  	if (!naProps.href && !naProps.name)		{			// remove hyperlink			a.outerHTML = a.innerHTML;		}		else		{			// set link properties		  	if (naProps.href)		        a.href = naProps.href;			else				a.removeAttribute('href',0);			if (naProps.name)		        a.name = naProps.name;			else				a.removeAttribute('name',0);			if (naProps.target && naProps.target!='_self')		        a.target = naProps.target;			else				a.removeAttribute('target',0);			if (naProps.title)		        a.title = naProps.title;			else				a.removeAttribute('title',0);			  	a.removeAttribute('onclick',0);		}      }      	}	else	{	  // new hyperlink      var naProps = showModalDialog('<?php echo $spaw_dir?>dialogs/a.php?lang=' + document.all['SPAW_'+editor+'_lang'].value + '&theme=' + document.all['SPAW_'+editor+'_theme'].value, aProps,         'dialogHeight:220px; dialogWidth:366px; resizable:no; status:no');              if (naProps)        {		var a;		if (naProps.name)		{		  a = document.createElement('<A NAME="'+naProps.name+'"></A>');		}		else		{		  a = document.createElement('A');		}	  	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 (window.frames[editor+'_rEdit'].document.selection.type == "Control")		{	        var selection = window.frames[editor+'_rEdit'].document.selection.createRange();			a.innerHTML = selection(0).outerHTML;			selection(0).outerHTML = a.outerHTML;		}		else		{	        var selection = window.frames[editor+'_rEdit'].document.selection.createRange();		    if (selection.htmlText == '')			  a.innerHTML = (a.href && a.href!='')?a.href:a.name;		    else			  a.innerHTML = selection.htmlText;				    selection.pasteHTML(a.outerHTML);      		}      }      	}    SPAW_update_toolbar(editor, true);      }  function SPAW_internal_link_click(editor, sender)  {    window.frames[editor+'_rEdit'].focus();       	var a = SPAW_getA(editor);		if (a)	{	  // edit hyperlink      var aProps = {};      aProps.href = SPAW_stripAbsoluteUrl(editor, a.href);      aProps.name = a.name;      aProps.target = a.target;      aProps.title = a.title;	  aProps.description = a.innerHTML;        var naProps = showModalDialog('<?php echo $spaw_internal_link_script?>?lang=' + document.all['SPAW_'+editor+'_lang'].value + '&theme=' + document.all['SPAW_'+editor+'_theme'].value, aProps,         'dialogHeight:220px; dialogWidth:366px; resizable:yes; status:no');              if (naProps)        {	  	if (naProps.href)	        a.href = naProps.href;		else			a.removeAttribute('href',0);		if (naProps.name)	        a.name = naProps.name;		else			a.removeAttribute('name',0);		if (naProps.target && naProps.target!='_self')	        a.target = naProps.target;		else			a.removeAttribute('target',0);		if (naProps.title)	        a.title = naProps.title;		else			a.removeAttribute('title',0);		if (naProps.description)			a.innerHTML = naProps.description;      }      	}	else	{	  // new hyperlink      var naProps = showModalDialog('<?php echo $spaw_internal_link_script?>?lang=' + document.all['SPAW_'+editor+'_lang'].value + '&theme=' + document.all['SPAW_'+editor+'_theme'].value, null,         'dialogHeight:220px; dialogWidth:366px; resizable:no; status:no');              if (naProps)        {		var a;		if (naProps.name)		{		  a = document.createElement('<A NAME="'+naProps.name+'"></A>');		}		else		{		  a = document.createElement('A');		}	  	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 (window.frames[editor+'_rEdit'].document.selection.type == "Control")		{	        var selection = window.frames[editor+'_rEdit'].document.selection.createRange();			a.innerHTML = selection(0).outerHTML;			selection(0).outerHTML = a.outerHTML;		}		else		{	        var selection = window.frames[editor+'_rEdit'].document.selection.createRange();			if (naProps.description)			{				a.innerHTML = naProps.description;			}			else			{			    if (selection.htmlText == '')					a.innerHTML = (a.href)?a.href:a.name;			    else				    a.innerHTML = selection.htmlText;			}			    selection.pasteHTML(a.outerHTML);      		}      }      	}    SPAW_update_toolbar(editor, true);      }    function SPAW_image_insert_click(editor, sender)  {

⌨️ 快捷键说明

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