现在的位置: 首页 > 综合 > 正文

shawl.qiu Javascript 代码格式化类/Styler, StyleEngine v1.0

2013年09月01日 ⁄ 综合 ⁄ 共 16960字 ⁄ 字号 评论关闭

 shawl.qiu Javascript 代码格式化类/Styler, StyleEngine v1.0

说明:
 码代码这事, 开始的时候没啥经验, 就乱码...
等到积累一定的知识后, 发现代码风格实在是太重要了...
不过先前有可能已码了一堆风格不好的代码...
那怎么办? 逐个手工转换风格吗?
不用.. 鄙人写的这个JS 工具就是对付这类问题的...

本类主要规划四大类的代码格式化功能.

1. 类 C 语言(v1.0 实现, 已实现)
 可完美格式化JS代码,
 也可良好格式化脚本类类C语言, 如: Php
 目前未针对强语言进行设计, 但也可用于格式化类C强语言, 不过因其复杂度而言, 某些代码格式化会不理想, 如C++之类那样庞大复杂的代码.

2. CSS 样式格式化(v1.1 实现, 未实现)

3. Tag 格式化(v1.2 实现, 未实现)
主要针对标签类语言, 如 xml, (x)html

4. 类 Basic 语言(v1.3 实现, 未实现)
 主要规划针对 VBscript 进行设计,
 但也可作用于 Pascal, VB 之类.

欢迎提供反馈: shawl.qiu@gmail.com

目录:
1. 调用(Styler_v1-0.htm)
2. 类 Styler(Styler_v1-0.js)
3. 类 StyleEngine(StyleEngine_v1-0.js)

shawl.qiu
2007-08-06
http://blog.csdn.net/btbtd

演示:
http://files.myopera.com/btbtd/javascript/class/Styler/Styler_v1-0.htm
http://shawl.qiu.googlepages.com/Styler_v1-0.htm

下载:
http://files.myopera.com/btbtd/javascript/class/Styler/Styler_v1-0.7z
http://shawl.qiu.googlepages.com/Styler_v1-0.7z

内容:
1. 调用(Styler_v1-0.htm)

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>shawl.qiu template</title>
  6. <style type="text/css">
  7. /* <![CDATA[ */
  8. hr
  9. {
  10.  border-top: 1px dotted #FFFFFF!important;
  11.  border-right: 1px dotted #FFFFFF!important;
  12.  border-bottom:1px dotted black!important; 
  13.  border-left: 1px dotted #FFFFFF!important;
  14.  margin:2px 0px;
  15. }
  16. /* ]]> */
  17. </style>
  18. <script type="text/javascript">
  19. //<![CDATA[
  20.  if (navigator.appName=="Microsoft Internet Explorer") 
  21.  {
  22.   //最大化窗口
  23.   self.moveTo(-5,-5)
  24.   self.resizeTo(screen.availWidth +8,screen.availHeight+8)
  25.   //这个脚本定义的宽度其实比原窗口还要大那么一点.
  26.  }
  27. //]]>
  28. </script>
  29. </head>
  30. <body>
  31. <form id="StylerId"></form>
  32. <script type="text/javascript" src="./Styler_v1-0.js"></script>
  33. <script type="text/javascript" src="./StyleEngine_v1-0.js"></script>
  34. <script type="text/javascript">
  35. //<![CDATA[
  36.  var Ser = new Styler();
  37.     
  38.  Ser.Go(Initer);
  39.   
  40.  var Au = Ser.Get.Au();
  41.  document.title = Au.Subject + " " + Au.Version;
  42.  
  43.  Ser = null;
  44.  
  45.  function Initer(Param)
  46.  {
  47.   Param.Main.Id = "StylerId";
  48.   
  49.   if(Param.Engine==null)
  50.   {
  51.    Param.Engine = new StyleEngine;
  52.   }
  53.   
  54.   Param.Container.OrderAr = [3, 0, 2, 4, 1];
  55.   
  56.   Param.GenreSelect.Default = "CLike"; // Enum{BasicLike|CLike|Tag|Css}
  57.   
  58.   Param.InputTextarea.DefaultValue = 
  59.    [
  60.     "/n"
  61.     ,"{//shawl.qiu code/n"
  62.     ,"/*/n"
  63.     ,"  xxxxxxxxxxx/n"
  64.     ,"  xxxxxxxxxxx/n"
  65.     ,"  xxxxxxxxxxx/n"
  66.     ,"  xxxxxxxxxxx/n"
  67.     ,"*//n"
  68.     ,"a/n"
  69.     ,"{/n"
  70.     ,"b/n"
  71.     ,"{"
  72.     ,"/* xxxxxxxxxxx/n"
  73.     ," xxxxxxxxxxx/n"
  74.     ," xxxxxxxxxxx/n"
  75.     ," xxxxxxxxxxx/n"
  76.     ,"*//n"
  77.     ,"b0.1/n"
  78.     ,"{/n"
  79.     ,"b1/n"
  80.     ,"}/n"
  81.     ,"c/n"
  82.     ,"}/n"
  83.     ,"d/n"
  84.     ,"}/n"
  85.     ,"d1/n"
  86.     ,"{/n"
  87.     ,"a1/n"
  88.     ,"}/n"
  89.     ,"{/n"
  90.     ,"a2/n"
  91.     ,"}/n"
  92.     ,"a0.1/n"
  93.     ,"}/n"
  94.     ,"/n"
  95.     ,"/n"
  96.     ,"/n"
  97.     ,"{/n"
  98.     ,"a/n"
  99.     ,"{/n"
  100.     ,"b/n"
  101.     ,"{/n"
  102.     ,"c/n"
  103.     ,"{/n"
  104.     ,"d/n"
  105.     ,"}/n"
  106.     ,"}/n"
  107.     ,"}/n"
  108.     ,"}/n"
  109.    ].join("");
  110.  };
  111. //]]>
  112. </script>
  113. </body>
  114. </html>

2. 类 Styler(Styler_v1-0.js)

  1.  // shawl.qiu JavaScript Document
  2.  /*-----------------------------------------------------------------------------------*/
  3.   * shawl.qiu Javascript Styler class v1.0
  4.  /*-----------------------------------------------------------------------------------*/
  5.  //---------------------------------begin class Styler()-------------------------------//
  6.  function Styler()
  7.  { // shawl.qiu code
  8.   //------------------------------------begin public variable
  9.   //------------------------------------end public variable
  10.   
  11.   //------------------------------------begin private variable
  12.   //---------------begin about
  13.   var Au = {}
  14.    Au.Subject = "shawl.qiu Javascript Styler class";
  15.    Au.Version = "v1.0";
  16.    Au.Name = "shawl.qiu";
  17.    Au.Email = "shawl.qiu@gmail.com";
  18.    Au.Blog = "http://blog.csdn.net/btbtd/";
  19.    Au.CreatedDate = "2007-7-31";
  20.    Au.Update = {};
  21.    Au.Update["1"] = "";
  22.   //---------------end about
  23.   var This = this;
  24.   
  25.   var Param = {};
  26.   
  27.    Param.Main = {};
  28.    Param.Main.Id = "StylerId";
  29.    Param.Main.Element = null;
  30.    
  31.    Param.Engine = null;
  32.    
  33.    Param.Inti = false;
  34.    
  35.    Param.GenreSelect = {};
  36.    Param.GenreSelect.Default = "CLike"; //CLike|BasicLike
  37.    Param.GenreSelect.Label= "<b>流派:</b> ";
  38.    fExtendElementBSE(Param.GenreSelect, true, "GenreSelectId", null);
  39.    
  40.    Param.Container = {};
  41.    Param.Container.OrderAr = [0, 1, 2, 3, 4];
  42.    Param.Container.Init = false;
  43.    Param.Container.Set = [];
  44.    Param.Container.Len = 5;
  45.    Param.Container.PrefixId = function(){return Param.Main.Id+"Container";};
  46.    
  47.    Param.InputTextarea = {};
  48.    fExtendTextareaIESSII
  49.     (Param.InputTextarea, "TextareaId", null, "", "输入: <br/>", 15, 100);
  50.    Param.ResultTextarea = {};
  51.    fExtendTextareaIESSII
  52.     (Param.ResultTextarea, "ResultTextarea", null, "", "结果: <br/>", 15, 100);
  53.    
  54.    Param.Button = {};
  55.    Param.Button.Label = "操作: ";
  56.    Param.Button.Submit = {};
  57.    fExtendButtonSES(Param.Button.Submit, "SubmitId", null, "执行");
  58.    
  59.    Param.Button.Reset = {};
  60.    fExtendButtonSES(Param.Button.Reset, "ResetId", null, "重置");
  61.      
  62.    Param.Genre = {};
  63.    
  64.    Param.Genre.CLike = {};
  65.    
  66.    Param.Genre.CLike.Indent = {};
  67.    Param.Genre.CLike.Indent.Default = 1;
  68.    Param.Genre.CLike.Indent.Min = 1;
  69.    Param.Genre.CLike.Indent.Max = 8;
  70.    fExtendElementBSE(Param.Genre.CLike.Indent, true, "CLikeIndentId", null);
  71.    
  72.    Param.Genre.CLike.Space = {};
  73.    Param.Genre.CLike.Space.Default = "Space"; // Enum{Space|Tab}
  74.    fExtendElementBSE(Param.Genre.CLike.Space, true, "CLikeSpaceId", null);
  75.    
  76.    Param.Genre.CLike.Paren = {};
  77.    fExtendElementBSE(Param.Genre.CLike.Paren, true, "CLikeParenIndent", null);
  78.    
  79.    Param.Genre.CLike.BreakEmptyBrace = {};
  80.    fExtendElementBSE(Param.Genre.CLike.BreakEmptyBrace, true, "CLikeBreakEmptyBrace", null);
  81.    
  82.    Param.Genre.CLike.LeftBraceBreakLeft = {};
  83.    fExtendElementBSE
  84.     (Param.Genre.CLike.LeftBraceBreakLeft, true, "CLikeLeftBraceBreakLeft", null);
  85.    
  86.    Param.Genre.CLike.LeftBraceBreakRight = {};
  87.    fExtendElementBSE
  88.     (Param.Genre.CLike.LeftBraceBreakRight, false, "CLikeLeftBraceBreakRight", null);
  89.    
  90.    Param.Genre.CLike.RightBraceBreakLeft = {};
  91.    fExtendElementBSE
  92.     (Param.Genre.CLike.RightBraceBreakLeft, true, "CLikeRightBraceBreakLeft", null);
  93.    
  94.    Param.Genre.CLike.RightBraceBreakRight = {};
  95.    fExtendElementBSE
  96.     (Param.Genre.CLike.RightBraceBreakRight, false, "CLikeRightBraceBreakRight", null);
  97.    
  98.    Param.Genre.CLike.BreakSuperBrace = {};
  99.    fExtendElementBSE(Param.Genre.CLike.BreakSuperBrace, true, "CLikeBreakSuperBrace", null);
  100.      
  101.    Param.Genre.CLike.BreakFunc = {};
  102.    fExtendElementBSE(Param.Genre.CLike.BreakFunc, true, "CLikeBreakFunc", null);
  103.    
  104.    Param.Genre.CLike.BreakAnnoFunc = {};
  105.    fExtendElementBSE(Param.Genre.CLike.BreakAnnoFunc, true, "CLikeBreakAnnoFunc", null);
  106.    
  107.    Param.Genre.CLike.FixOperator = {};
  108.    fExtendElementBSE(Param.Genre.CLike.FixOperator, true, "CLikeFixOperator", null);
  109.    
  110.    Param.Genre.CLike.Custom = {};
  111.    
  112.    Param.Genre.CLike.Custom.Before = {};
  113.    fExtendElementBSE(Param.Genre.CLike.Custom.Before, true, "CLikeCustomBeforeId", null);
  114.    
  115.    Param.Genre.CLike.Custom.Before.Paren = {};
  116.    fExtendElementBSE
  117.     (Param.Genre.CLike.Custom.Before.Paren, true, "CLikeCustomBeforeParenId", null);
  118.    
  119.    Param.Genre.CLike.Custom.Before.Brace = {};
  120.    fExtendElementBSE
  121.     (Param.Genre.CLike.Custom.Before.Brace, true, "CLikeCustomBeforeBraceId", null);
  122.    
  123.    Param.Genre.CLike.Custom.After = {};
  124.    fExtendElementBSE(Param.Genre.CLike.Custom.After, true, "CLikeCustomAfterId", null);
  125.    
  126.    Param.Genre.CLike.Custom.After.General = {};
  127.    fExtendElementBSE
  128.     (Param.Genre.CLike.Custom.After.General, true, "CLikeCustomAfterGeneralId", null);
  129.    
  130.    Param.Genre.CLike.DefaultSpace = {};
  131.    Param.Genre.CLike.DefaultSpace.Num = 1;
  132.    Param.Genre.CLike.DefaultSpace.Max = 80;
  133.    Param.Genre.CLike.DefaultSpace.Min = 0;
  134.    fExtendElementBSE(Param.Genre.CLike.DefaultSpace, true, "CLikeDefaultSpace", null);
  135.    
  136.   //------------------------------------end private variable
  137.   
  138.   //------------------------------------begin public method
  139.   this.Get = {};
  140.   this.Get.Au = fGetAu;
  141.   
  142.   this.Go = fGo;
  143.   this.SetContainer = fSetContainer;
  144.   //------------------------------------end public method
  145.  
  146.   //------------------------------------begin private method
  147.   function fGo(ConfigFunc)
  148.   {
  149.    if(ConfigFunc&&ConfigFunc.constructor==Function)
  150.    {
  151.     ConfigFunc(Param);
  152.    }
  153.    
  154.    if(!Param.Inti)
  155.    {
  156.     Param.Main.Element = fSetObj(Param.Main.Id);
  157.     fSetContainer();
  158.     fGenreSelect();
  159.     fSetButton();
  160.     fSetTextarea();
  161.     fSetResultTextarea();
  162.     fSetOptions();
  163.    }
  164.    
  165.    Param.Inti = true;
  166.   } // end function fGo(ConfigFunc)
  167.   
  168.   function fSetOptions()
  169.   {
  170.    var Sle = Param.GenreSelect.Element;
  171.    var sGenre = Sle.options[Sle.selectedIndex].value;
  172.    
  173.    switch(sGenre)
  174.    {
  175.     case "Tag":
  176.      fSetTagOptions();
  177.      break;
  178.      
  179.     case "Css":
  180.      fSetCssOptions();
  181.      break;
  182.     
  183.     case "BasicLike":
  184.      fSetBasicLikeOptions()
  185.      break;
  186.      
  187.     default:
  188.      fSetCLikeOptions();
  189.      break;
  190.    }
  191.   } // end function fSetOptions
  192.   
  193.   function fGenreSelect(sDefaultSelect)
  194.   {
  195.    var GenreSelect = Param.GenreSelect;
  196.    
  197.    var sId = GenreSelect.Id();
  198.    var sLbl = GenreSelect.Label;
  199.       
  200.    var Sle = document.createElement("select");  
  201.     Sle.id = sId;
  202.    
  203.    switch(GenreSelect.Default)
  204.    { 
  205.     case "Tag":
  206.      fAddOption(Sle, "Tag", "Tag", truetrue);
  207.      fAddOption(Sle, "Css", "Css", falsefalse);
  208.      fAddOption(Sle, "类C", "CLike", falsefalse);
  209.      fAddOption(Sle, "类Basic", "BasicLike", falsefalse);
  210.      break;
  211.      
  212.     case "Css":
  213.      fAddOption(Sle, "Css", "Css", truetrue);
  214.      fAddOption(Sle, "Tag", "Tag", falsefalse);
  215.      fAddOption(Sle, "类C", "CLike", falsefalse);
  216.      fAddOption(Sle, "类Basic", "BasicLike", falsefalse);
  217.      break;
  218.      
  219.     case "BasicLike":
  220.      fAddOption(Sle, "类Basic", "BasicLike", truetrue);
  221.      fAddOption(Sle, "类C", "CLike", falsefalse);
  222.      fAddOption(Sle, "Tag", "Tag", falsefalse);
  223.      fAddOption(Sle, "Css", "Css", falsefalse);
  224.      break;
  225.      
  226.     default:
  227.      fAddOption(Sle, "类C", "CLike", truetrue);
  228.      fAddOption(Sle, "类Basic", "BasicLike", falsefalse);
  229.      fAddOption(Sle, "Tag", "Tag", falsefalse);
  230.      fAddOption(Sle, "Css", "Css", falsefalse);
  231.      break;
  232.    }
  233.     
  234.    Param.Container.Set[0].innerHTML = sLbl;
  235.    Param.Container.Set[0].appendChild(Sle);
  236.    Param.GenreSelect.Element = document.getElementById(sId);
  237.    
  238.    Param.GenreSelect.Element.onchange =
  239.     function()
  240.     {
  241.      fSetOptions();
  242.     }
  243.    
  244.    Param.Container.Set[0].appendChild(document.createElement("hr"));
  245.   } // end function fGenreSelect
  246.   
  247.   function fSetCssOptions()
  248.   {
  249.    var Container = Param.Container;
  250.    var CLike = Param.Genre.CLike;
  251.    
  252.    var EgCLike = Param.Engine.Get.CLike();
  253.    
  254.    Container.Set[1].innerHTML = "<div><b>选项:</b> (打勾表示真, 不打表示假)</div>";
  255.    Container.Set[1].innerHTML += "<p style='color:red;'>本功能暂未实现!</p>";
  256.   }
  257.   
  258.   function fSetTagOptions()
  259.   {
  260.    var Container = Param.Container;
  261.    var CLike = Param.Genre.CLike;
  262.    
  263.    var EgCLike = Param.Engine.Get.CLike();
  264.    
  265.    Container.Set[1].innerHTML = "<div><b>选项:</b> (打勾表示真, 不打表示假)</div>";
  266.    Container.Set[1].innerHTML += "<p style='color:red;'>本功能暂未实现!</p>";
  267.   }
  268.   
  269.   function fSetBasicLikeOptions()
  270.   {
  271.    var Container = Param.Container;
  272.    var CLike = Param.Genre.CLike;
  273.    
  274.    var EgCLike = Param.Engine.Get.CLike();
  275.    
  276.    Container.Set[1].innerHTML = "<div><b>选项:</b> (打勾表示真, 不打表示假)</div>";
  277.    Container.Set[1].innerHTML += "<p style='color:red;'>本功能暂未实现!</p>";
  278.   }
  279.   
  280.   function fSetTextarea()
  281.   {
  282.    var Textarea = Param.InputTextarea;
  283.    var Container = Param.Container;
  284.    
  285.    if(Textarea.Element!=nullreturn;
  286.    
  287.    var sLbl = Textarea.Label;
  288.    
  289.    var sId = Textarea.Id();
  290.    var iRows = Textarea.Rows;
  291.    var iCols = Textarea.Cols;
  292.    
  293.    var Txa = document.createElement("textarea");
  294.    Txa.id = sId;
  295.    Txa.rows = iRows;
  296.    Txa.cols = iCols;
  297.    
  298.    Txa.value = Textarea.DefaultValue;
  299.    
  300.    Container.Set[3].innerHTML = sLbl;
  301.    Container.Set[3].appendChild(Txa);
  302.    Textarea.Element = document.getElementById(sId);
  303.    
  304.    Param.Container.Set[3].appendChild(document.createElement("hr"));
  305.   }
  306.   
  307.   function fSetResultTextarea()
  308.   {
  309.    var Textarea = Param.ResultTextarea;
  310.    var Container = Param.Container;
  311.    
  312.    if(Textarea.Element!=nullreturn;
  313.    
  314.    var sLbl = Textarea.Label;
  315.    
  316.    var sId = Textarea.Id();
  317.    var iRows = Textarea.Rows;
  318.    var iCols = Textarea.Cols;
  319.    
  320.    var Txa = document.createElement("textarea");
  321.    Txa.id = sId;
  322.    Txa.rows = iRows;
  323.    Txa.cols = iCols;
  324.    
  325.    Txa.value = Textarea.DefaultValue;
  326.    
  327.    Container.Set[4].innerHTML = sLbl;
  328.    Container.Set[4].appendChild(Txa);
  329.    Textarea.Element = document.getElementById(sId);
  330.    
  331.    Param.Container.Set[4].appendChild(document.createElement("hr"));
  332.   }
  333.   
  334.   function fSetButton()
  335.   {
  336.    var Button = Param.Button;
  337.    var Textarea = Param.InputTextarea;
  338.    var ResultTextarea = Param.ResultTextarea;
  339.    var Container = Param.Container;
  340.    
  341.    if(Button.Submit.Element==null)
  342.    {
  343.     var SubmitText = Button.Submit.Text;
  344.     var ResetText = Button.Reset.Text;
  345.     
  346.     Container.Set[2].innerHTML = Button.Label;
  347.     
  348.     var ExecBtn = document.createElement("input");
  349.      ExecBtn.type="button"
  350.      ExecBtn.id = Button.Submit.Id();
  351.      ExecBtn.value = SubmitText;
  352.      
  353.      ExecBtn.onclick = 
  354.       function ()
  355.       {
  356.        var Sle = Param.GenreSelect.Element;
  357.        var sGenre = Sle.options[Sle.selectedIndex].value;
  358.        
  359.        var TempFunc = 
  360.         function(CLike)
  361.         {
  362.          
  363.          switch(sGenre)
  364.          {
  365.           case "Tag":
  366.            break;
  367.            
  368.           case "Css":
  369.            break;
  370.           
  371.           case "BasicLike":
  372.            break;
  373.            
  374.           default:
  375.            //BreakEmptyBrace
  376.            CLike.Options.Space = Param.Genre.CLike.Space.Element.value;
  377.            CLike.Options.Indent = Param.Genre.CLike.Indent.Element.value-0;
  378.            CLike.Options.Parenthesis.Indent = Param.Genre.CLike.Paren.Element.checked;
  379.             
  380.            CLike.Options.Brace.Inline.Break = 
  381.             !Param.Genre.CLike.BreakEmptyBrace.Element.checked;
  382.               
  383.            CLike.Options.Brace.Left.BreakLeft = 
  384.             Param.Genre.CLike.LeftBraceBreakLeft.Element.checked;  
  385.               
  386.            CLike.Options.Brace.Left.BreakRight = 
  387.             Param.Genre.CLike.LeftBraceBreakRight.Element.checked;  
  388.               
  389.            CLike.Options.Brace.Right.BreakLeft = 
  390.             Param.Genre.CLike.RightBraceBreakLeft.Element.checked;  
  391.               
  392.            CLike.Options.Brace.Right.BreakRight = 
  393.             Param.Genre.CLike.RightBraceBreakRight.Element.checked; 
  394.               
  395.            CLike.Options.Brace.Super.Separate = 
  396.             Param.Genre.CLike.BreakSuperBrace.Element.checked;  
  397.               
  398.            CLike.Options.Func.Break = 
  399.             Param.Genre.CLike.BreakFunc.Element.checked;  
  400.               
  401.            CLike.Options.AnonFunc.Break = 
  402.             Param.Genre.CLike.BreakAnnoFunc.Element.checked;  
  403.               
  404.            CLike.Options.Operator.Fix = 
  405.             Param.Genre.CLike.FixOperator.Element.checked;  
  406.               
  407.            CLike.BreakLine.Before.Bool = 
  408.             Param.Genre.CLike.Custom.Before.Element.checked;  
  409.               
  410.            CLike.BreakLine.Before.ParenList = 
  411.             Param.Genre.CLike.Custom.Before.Paren.Element.value;  
  412.               
  413.            CLike.BreakLine.Before.BraceList = 
  414.             Param.Genre.CLike.Custom.Before.Brace.Element.value; 
  415.               
  416.            CLike.BreakLine.After.Bool = 
  417.             Param.Genre.CLike.Custom.After.Element.checked;   
  418.               
  419.            CLike.BreakLine.After.General = 
  420.             Param.Genre.CLike.Custom.After.General.Element.value;
  421.             
  422.            var TempNum = parseInt(Param.Genre.CLike.DefaultSpace.Element.value);
  423.            if(isNaN(TempNum)) TempNum= Param.Genre.CLike.DefaultSpace.Num;
  424.            
  425.            if(TempNum<Param.Genre.CLike.DefaultSpace.Min) 
  426.             TempNum = Param.Genre.CLike.DefaultSpace.Min;
  427.            
  428.            if(TempNum>Param.Genre.CLike.DefaultSpace.Max) 
  429.             TempNum = Param.Genre.CLike.DefaultSpace.Max;
  430.               
  431.            CLike.Options.DefaultSpace = TempNum;
  432.            break;
  433.          }
  434.         };
  435.             
  436.        Param.Engine.Config = TempFunc;
  437.        ResultTextarea.Element.value = Param.Engine.Go(Textarea.Element.value, sGenre);
  438.       }
  439.    }
  440.    
  441.    if(Button.Reset.Element==null)
  442.    {
  443.     var ResetIpt = document.createElement("input");
  444.      ResetIpt.id = Button.Reset.Id();
  445.      ResetIpt.type = "reset";
  446.      ResetIpt.value = ResetText;
  447.      
  448.      ResetIpt.onclick =
  449.       function()
  450.       {
  451.        Textarea.Element.value = Textarea.DefaultValue;
  452.        fSetOptions();
  453.        return false;
  454.       }
  455.      
  456.      Container.Set[2].appendChild(ExecBtn);
  457.      Container.Set[2].appendChild(document.createTextNode(" "));
  458.      Container.Set[2].appendChild(ResetIpt);
  459.      
  460.      Button.Submit.Element = document.getElementById(Button.Submit.Id);
  461.      Button.Reset.Element = document.getElementById(Button.Reset.Id);
  462.    }
  463.    
  464.    Param.Container.Set[2].appendChild(document.createElement("hr"));
  465.   } // end function fSetButton
  466.   
  467.   function fAddOption(sle, text, value, defaultSelected, selected)
  468.   {// shawl.qiu script
  469.    if(!defaultSelected) defaultSelected = false;
  470.    if(!selected) selected = false;
  471.    sle.options[

抱歉!评论已关闭.