mirror of
https://scm.univ-tours.fr/22107988t/rappaurio-sae501_502.git
synced 2025-08-29 21:05:57 +02:00
278 lines
59 KiB
HTML
278 lines
59 KiB
HTML
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"> <style>
|
||
.KEYW {color: #933;}
|
||
.COMM {color: #bbb; font-style: italic;}
|
||
.NUMB {color: #393;}
|
||
.STRN {color: #393;}
|
||
.REGX {color: #339;}
|
||
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
||
</style></head><body><pre><span class='line'> 1</span> <span class="TOKN"></span><span class="WHIT">
|
||
<span class='line'> 2</span> </span><span class="COMM">/**
|
||
<span class='line'> 3</span> * @name CeL function for debug
|
||
<span class='line'> 4</span> * @fileoverview
|
||
<span class='line'> 5</span> * 本檔案包含了 debug 的 functions。
|
||
<span class='line'> 6</span> * @since
|
||
<span class='line'> 7</span> */</span><span class="WHIT">
|
||
<span class='line'> 8</span>
|
||
<span class='line'> 9</span> </span><span class="COMM">/*
|
||
<span class='line'> 10</span>
|
||
<span class='line'> 11</span> http://code.google.com/apis/ajax/playground/
|
||
<span class='line'> 12</span>
|
||
<span class='line'> 13</span> */</span><span class="WHIT">
|
||
<span class='line'> 14</span>
|
||
<span class='line'> 15</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">CeL</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'> 16</span>
|
||
<span class='line'> 17</span> </span><span class="COMM">/**
|
||
<span class='line'> 18</span> * 本 module 之 name(id),<span style="text-decoration:line-through;">不設定時會從呼叫時之 path 取得</span>。
|
||
<span class='line'> 19</span> * @type String
|
||
<span class='line'> 20</span> * @constant
|
||
<span class='line'> 21</span> * @inner
|
||
<span class='line'> 22</span> * @ignore
|
||
<span class='line'> 23</span> */</span><span class="WHIT">
|
||
<span class='line'> 24</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">module_name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'code.debug'</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'> 25</span>
|
||
<span class='line'> 26</span> </span><span class="COMM">//===================================================</span><span class="WHIT">
|
||
<span class='line'> 27</span> </span><span class="COMM">/**
|
||
<span class='line'> 28</span> * 若欲 include 整個 module 時,需囊括之 code。
|
||
<span class='line'> 29</span> * @type Function
|
||
<span class='line'> 30</span> * @param {Function} library_namespace namespace of library
|
||
<span class='line'> 31</span> * @param load_arguments 呼叫時之 argument(s)
|
||
<span class='line'> 32</span> * @return
|
||
<span class='line'> 33</span> * @name CeL.code.debug
|
||
<span class='line'> 34</span> * @constant
|
||
<span class='line'> 35</span> * @inner
|
||
<span class='line'> 36</span> * @ignore
|
||
<span class='line'> 37</span> */</span><span class="WHIT">
|
||
<span class='line'> 38</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">code_for_including</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">library_namespace</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">load_arguments</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'> 39</span>
|
||
<span class='line'> 40</span> </span><span class="COMM">// requires</span><span class="WHIT">
|
||
<span class='line'> 41</span> </span><span class="COMM">/*
|
||
<span class='line'> 42</span> if (eval(library_namespace.use_function(
|
||
<span class='line'> 43</span> 'code.compatibility.is_DOM,data.split_String_to_Object')))
|
||
<span class='line'> 44</span> return;
|
||
<span class='line'> 45</span> */</span><span class="WHIT">
|
||
<span class='line'> 46</span>
|
||
<span class='line'> 47</span>
|
||
<span class='line'> 48</span> </span><span class="COMM">/**
|
||
<span class='line'> 49</span> * null module constructor
|
||
<span class='line'> 50</span> * @class code.debug 的 functions
|
||
<span class='line'> 51</span> */</span><span class="WHIT">
|
||
<span class='line'> 52</span> </span><span class="NAME">CeL.code.debug</span><span class="WHIT">
|
||
<span class='line'> 53</span> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="COMM">// null module constructor</span><span class="WHIT">
|
||
<span class='line'> 55</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'> 56</span>
|
||
<span class='line'> 57</span> </span><span class="COMM">/**
|
||
<span class='line'> 58</span> * for JSDT: 有 prototype 才會將之當作 Class
|
||
<span class='line'> 59</span> */</span><span class="WHIT">
|
||
<span class='line'> 60</span> </span><span class="NAME">CeL.code.debug</span><span class="WHIT">
|
||
<span class='line'> 61</span> </span><span class="PUNC">.</span><span class="NAME">prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'> 62</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'> 63</span>
|
||
<span class='line'> 64</span>
|
||
<span class='line'> 65</span>
|
||
<span class='line'> 66</span>
|
||
<span class='line'> 67</span>
|
||
<span class='line'> 68</span>
|
||
<span class='line'> 69</span>
|
||
<span class='line'> 70</span>
|
||
<span class='line'> 71</span>
|
||
<span class='line'> 72</span> </span><span class="COMM">//JSalert[generateCode.dLK]='getScriptName';//,*var ScriptName=getScriptName();</span><span class="WHIT">
|
||
<span class='line'> 73</span> </span><span class="NAME">CeL.code.debug</span><span class="WHIT">
|
||
<span class='line'> 74</span> </span><span class="PUNC">.</span><span class="WHIT">
|
||
<span class='line'> 75</span> </span><span class="COMM">/**
|
||
<span class='line'> 76</span> * 顯示訊息視窗<br/>
|
||
<span class='line'> 77</span> * alert() 改用VBScript的MsgBox可產生更多效果,但NS不支援的樣子。
|
||
<span class='line'> 78</span> * @param message message or object
|
||
<span class='line'> 79</span> * @param {Number} [wait] the maximum length of time (in seconds) you want the pop-up message box displayed.
|
||
<span class='line'> 80</span> * @param {String} [title] title of the pop-up message box.
|
||
<span class='line'> 81</span> * @param {Number} [type] type of buttons and icons you want in the pop-up message box.
|
||
<span class='line'> 82</span> * @return {Integer} number of the button the user clicked to dismiss the message box.
|
||
<span class='line'> 83</span> * @requires CeL.get_script_name
|
||
<span class='line'> 84</span> * @see <a href="http://msdn.microsoft.com/library/en-us/script56/html/wsmthpopup.asp">Popup Method</a>
|
||
<span class='line'> 85</span> * @memberOf CeL.code.debug
|
||
<span class='line'> 86</span> */</span><span class="WHIT">
|
||
<span class='line'> 87</span> </span><span class="NAME">JSalert</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">wait</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">title</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_f</span><span class="PUNC">=</span><span class="NAME">arguments.callee</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">_f.cmd</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="COMM">// 控制是否彈跳出視窗</span><span class="WHIT">
|
||
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="NAME">_f.cmd</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">WScript</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="WHIT">
|
||
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="REGX">/cscript\.exe$/i</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">WScript.FullName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'> 92</span>
|
||
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="COMM">// if(!message)message+='';//if(typeof message==='undefined')message='';else if(!message)message+=''; //</span><span class="WHIT">
|
||
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="COMM">// 有時傳入如message==null會造成error</span><span class="WHIT">
|
||
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="COMM">// WScript.Echo()會視情況:視窗執行時彈跳出視窗,cmd執行時直接顯示。但需要用cscript執行時才有效果。</span><span class="WHIT">
|
||
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="COMM">// http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_mokz.mspx</span><span class="WHIT">
|
||
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="COMM">// 可以用 WScript.Echo(t1,t2,..),中間會以' '間隔</span><span class="WHIT">
|
||
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">_f.cmd</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">argument.length</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'> 99</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">WScript.Echo</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>100</span>
|
||
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">title</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
|
||
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="COMM">// typeof getScriptName === 'function'</span><span class="WHIT">
|
||
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="NAME">this.get_script_name</span><span class="WHIT">
|
||
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'>105</span> </span><span class="WHIT"> </span><span class="NAME">title</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">getScriptName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>106</span>
|
||
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="COMM">// typeof type!=='number'</span><span class="WHIT">
|
||
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">64</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>109</span>
|
||
<span class='line'>110</span> </span><span class="COMM">/*
|
||
<span class='line'>111</span> if (typeof WshShell != 'object')
|
||
<span class='line'>112</span> if (typeof WScript === 'object')
|
||
<span class='line'>113</span> WshShell = WScript.CreateObject("WScript.Shell");
|
||
<span class='line'>114</span> else
|
||
<span class='line'>115</span> return undefined;
|
||
<span class='line'>116</span> */</span><span class="WHIT">
|
||
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.WshShell</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">WScript</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="NAME">this.WshShell</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">WScript.CreateObject</span><span class="PUNC">(</span><span class="STRN">"WScript.Shell"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>122</span>
|
||
<span class='line'>123</span>
|
||
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.WshShell.Popup</span><span class="PUNC">(</span><span class="WHIT">
|
||
<span class='line'>125</span> </span><span class="WHIT"> </span><span class="COMM">// ''+message: 會出現 typeof message==='object' 卻不能顯示的</span><span class="WHIT">
|
||
<span class='line'>126</span> </span><span class="WHIT"> </span><span class="STRN">''</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">,</span><span class="WHIT">
|
||
<span class='line'>127</span> </span><span class="WHIT"> </span><span class="NAME">wait</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">title</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT">
|
||
<span class='line'>128</span> </span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>129</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>130</span>
|
||
<span class='line'>131</span> </span><span class="COMM">// popup object Error(錯誤)</span><span class="WHIT">
|
||
<span class='line'>132</span> </span><span class="COMM">//popErr[generateCode.dLK]='JSalert,setTool,parse_Function';</span><span class="WHIT">
|
||
<span class='line'>133</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">popErr</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// error object, title, additional text(etc. function name)</span><span class="WHIT">
|
||
<span class='line'>134</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">T</span><span class="PUNC">=</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>135</span> </span><span class="WHIT"> </span><span class="COMM">//alert((T=='object')+','+(e.constructor)+','+(Error)+','+(e instanceof Error))</span><span class="WHIT">
|
||
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="COMM">// 這裡e instanceof Error若是T=='object'&&e.constructor==Error有時不能達到效果!</span><span class="WHIT">
|
||
<span class='line'>137</span> </span><span class="WHIT"> </span><span class="COMM">// use: for(i in e)</span><span class="WHIT">
|
||
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="NAME">T</span><span class="PUNC">=</span><span class="NAME">e</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">?</span><span class="STRN">'Error '</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">e.number</span><span class="PUNC">&</span><span class="NUMB">0xFFFF</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">e.name</span><span class="PUNC">?</span><span class="STRN">' ['</span><span class="PUNC">+</span><span class="NAME">e.name</span><span class="PUNC">+</span><span class="STRN">']'</span><span class="PUNC">:</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">' (facility code '</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">e.number</span><span class="PUNC">>></span><span class="NUMB">16</span><span class="PUNC">&</span><span class="NUMB">0x1FFF</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'):\n'</span><span class="PUNC">+</span><span class="NAME">e.description</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">e.message</span><span class="PUNC">||</span><span class="NAME">e.message</span><span class="PUNC">==</span><span class="NAME">e.description</span><span class="PUNC">?</span><span class="STRN">''</span><span class="PUNC">:</span><span class="STRN">'\n\n'</span><span class="PUNC">+</span><span class="NAME">e.message</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="PUNC">!</span><span class="NAME">e</span><span class="PUNC">||</span><span class="NAME">T</span><span class="PUNC">==</span><span class="STRN">'string'</span><span class="PUNC">?</span><span class="NAME">e</span><span class="PUNC">:</span><span class="STRN">'('</span><span class="PUNC">+</span><span class="NAME">T</span><span class="PUNC">+</span><span class="STRN">')'</span><span class="PUNC">+</span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>139</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">=</span><span class="NAME">f</span><span class="PUNC">?</span><span class="PUNC">(</span><span class="STRN">''</span><span class="PUNC">+</span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/\0/g</span><span class="PUNC">,</span><span class="STRN">'\\0'</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'\n\n'</span><span class="PUNC">+</span><span class="NAME">T</span><span class="PUNC">:</span><span class="NAME">T</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="COMM">// .caller只在執行期間有效。_function_self_.caller可用 arguments.callee.caller 代替,卻不能用arguments.caller</span><span class="WHIT">
|
||
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="COMM">// arguments.callee.caller 被取消了。 http://www.opera.com/docs/specs/js/ecma/ http://bytes.com/forum/thread761008.html http://www.javaeye.com/post/602661 http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/cd3d6d6abcdd048b</span><span class="WHIT">
|
||
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">WshShell</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'>143</span> </span><span class="WHIT"> </span><span class="NAME">WshShell.Popup</span><span class="PUNC">(</span><span class="NAME">f</span><span class="PUNC">,</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">||</span><span class="STRN">'Error '</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">arguments.callee.caller</span><span class="PUNC">==</span><span class="KEYW">null</span><span class="PUNC">?</span><span class="STRN">'from the top level'</span><span class="PUNC">:</span><span class="STRN">'on '</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">parse_Function</span><span class="PUNC">==</span><span class="STRN">'function'</span><span class="PUNC">?</span><span class="NAME">parse_Function</span><span class="PUNC">(</span><span class="NAME">arguments.callee.caller</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">funcName</span><span class="PUNC">:</span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">' of '</span><span class="PUNC">+</span><span class="NAME">ScriptName</span><span class="PUNC">,</span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="NAME">alert</span><span class="PUNC">(</span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>145</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">T</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>146</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||
<span class='line'>147</span>
|
||
<span class='line'>148</span>
|
||
<span class='line'>149</span>
|
||
<span class='line'>150</span>
|
||
<span class='line'>151</span>
|
||
<span class='line'>152</span>
|
||
<span class='line'>153</span> </span><span class="COMM">/* debug用: show function Class 2008/7/23 16:33:42
|
||
<span class='line'>154</span> !! unfinished !!
|
||
<span class='line'>155</span> // http://fillano.blog.ithome.com.tw/post/257/59403
|
||
<span class='line'>156</span> // ** 一些內建的物件,他的屬性可能會是[[DontEnum]],也就是不可列舉的,而自訂的物件在下一版的ECMA-262中,也可以這樣設定他的屬性。
|
||
<span class='line'>157</span>
|
||
<span class='line'>158</span>
|
||
<span class='line'>159</span> usage:
|
||
<span class='line'>160</span> showClass('registryF');
|
||
<span class='line'>161</span> showClass(registryF);
|
||
<span class='line'>162</span>
|
||
<span class='line'>163</span>
|
||
<span class='line'>164</span> trace 的技巧:
|
||
<span class='line'>165</span>
|
||
<span class='line'>166</span> 對沒 prototype 的,可能是:
|
||
<span class='line'>167</span> var cl=(function(){
|
||
<span class='line'>168</span> return new ((function(){var kkk='xsa',aa=function(){return kkk;},init=function(){kkk='22';},_=function(){init();};_.prototype.get=function(){return aa();};return _;})());
|
||
<span class='line'>169</span> })();
|
||
<span class='line'>170</span> cl.constructor=null; // 絕技…無效
|
||
<span class='line'>171</span>
|
||
<span class='line'>172</span> sl(cl.get());
|
||
<span class='line'>173</span> showClass('cl');
|
||
<span class='line'>174</span> eval('sl(kkk)',cl.get);
|
||
<span class='line'>175</span>
|
||
<span class='line'>176</span>
|
||
<span class='line'>177</span> */</span><span class="WHIT">
|
||
<span class='line'>178</span>
|
||
<span class='line'>179</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">showClass</span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">,</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="NAME">sp</span><span class="PUNC">=</span><span class="STRN">'<hr style="width:40%;float:left;"/><br style="clear:both;"/>'</span><span class="PUNC">,</span><span class="NAME">h</span><span class="PUNC">=</span><span class="STRN">'<span style="color:#bbb;font-size:.8em;">'</span><span class="WHIT">
|
||
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="PUNC">,</span><span class="NAME">p</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">,</span><span class="NAME">p</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">sl</span><span class="PUNC">(</span><span class="NAME">h</span><span class="PUNC">+</span><span class="NAME">n</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">?</span><span class="STRN">'.prototype'</span><span class="PUNC">:</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'.</span><em>'</span><span class="PUNC">+</span><span class="NAME">m</span><span class="PUNC">+</span><span class="STRN">'</em> '</span><span class="PUNC">+</span><span class="NAME">h</span><span class="PUNC">+</span><span class="STRN">'=</span> '</span><span class="PUNC">+</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">[</span><span class="NAME">m</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="WHIT">
|
||
<span class='line'>182</span> </span><span class="WHIT"> </span><span class="PUNC">,</span><span class="NAME">f</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">''</span><span class="PUNC">+</span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/\n/g</span><span class="PUNC">,</span><span class="STRN">'<br/>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/ /g</span><span class="PUNC">,</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">==</span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">n</span><span class="PUNC">)</span><span class="NAME">n</span><span class="PUNC">=</span><span class="NAME">c</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>185</span> </span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">=</span><span class="NAME">eval</span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>186</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">n</span><span class="PUNC">)</span><span class="NAME">n</span><span class="PUNC">=</span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>188</span> </span><span class="WHIT"> </span><span class="NAME">sl</span><span class="PUNC">(</span><span class="STRN">'<hr/>Show class: ('</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">')'</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">?</span><span class="STRN">' [<em>'</span><span class="PUNC">+</span><span class="NAME">n</span><span class="PUNC">+</span><span class="STRN">'</em>]'</span><span class="PUNC">:</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'<br/>'</span><span class="WHIT">
|
||
<span class='line'>189</span> </span><span class="WHIT"> </span><span class="COMM">//+(n?'<em>'+n+'</em> '+h+'=</span> ':'')</span><span class="WHIT">
|
||
<span class='line'>190</span> </span><span class="WHIT"> </span><span class="PUNC">+</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>191</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'>192</span> </span><span class="WHIT"> </span><span class="NAME">sl</span><span class="PUNC">(</span><span class="NAME">sp</span><span class="PUNC">+</span><span class="STRN">'class member:'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>193</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">!=</span><span class="STRN">'prototype'</span><span class="PUNC">)</span><span class="NAME">p</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>195</span> </span><span class="WHIT"> </span><span class="NAME">sl</span><span class="PUNC">(</span><span class="NAME">sp</span><span class="PUNC">+</span><span class="STRN">'prototype:'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>196</span> </span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">=</span><span class="NAME">c.prototype</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>197</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="NAME">sl</span><span class="PUNC">(</span><span class="STRN">'<hr/>'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>201</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||
<span class='line'>202</span>
|
||
<span class='line'>203</span> </span><span class="NAME">showClass.repository</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>204</span> </span><span class="NAME">showClass.repositoryName</span><span class="PUNC">=</span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>205</span> </span><span class="NAME">showClass.setRepository</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'>206</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_f</span><span class="PUNC">=</span><span class="NAME">arguments.callee</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>207</span> </span><span class="WHIT"> </span><span class="NAME">_f.repositoryName</span><span class="PUNC">=</span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="NAME">_f.repository</span><span class="PUNC">=</span><span class="NAME">eval</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>209</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">_f.repository</span><span class="PUNC">)</span><span class="NAME">_f.repository</span><span class="PUNC">=</span><span class="NAME">eval</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">+</span><span class="STRN">'={}'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>210</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>211</span> </span><span class="COMM">/**
|
||
<span class='line'>212</span> * ** loop?
|
||
<span class='line'>213</span> * @param name name
|
||
<span class='line'>214</span> * @param scope scope
|
||
<span class='line'>215</span> * @ignore
|
||
<span class='line'>216</span> * @return
|
||
<span class='line'>217</span> */</span><span class="WHIT">
|
||
<span class='line'>218</span> </span><span class="NAME">showClass.showOnScope</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_f</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments.callee</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_f.repository</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="COMM">// 遇到 _f.repositoryName 剛好為 local 值時會失效。</span><span class="WHIT">
|
||
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="NAME">eval</span><span class="PUNC">(</span><span class="NAME">_f.repositoryName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'.'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">scope</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>222</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_f</span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>223</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>224</span>
|
||
<span class='line'>225</span>
|
||
<span class='line'>226</span> </span><span class="COMM">// debug用: show contents of object 2000-2003/2/22 15:49</span><span class="WHIT">
|
||
<span class='line'>227</span> </span><span class="COMM">//var i,t='';for(i in o)t+=i+':'+o[i];alert(t);</span><span class="WHIT">
|
||
<span class='line'>228</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">showObj</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="NAME">mode</span><span class="PUNC">,</span><span class="NAME">searchKey</span><span class="PUNC">,</span><span class="NAME">printmode</span><span class="PUNC">,</span><span class="NAME">range</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="COMM">//object,mode,search string</span><span class="WHIT">
|
||
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">Obj</span><span class="PUNC">,</span><span class="NAME">m</span><span class="PUNC">=</span><span class="STRN">''</span><span class="PUNC">,</span><span class="NAME">M</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">M_</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">i</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">search</span><span class="PUNC">,</span><span class="NAME">r2</span><span class="PUNC">=</span><span class="NUMB">99</span><span class="PUNC">,</span><span class="NAME">sp</span><span class="PUNC">=</span><span class="STRN">' '</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">range</span><span class="PUNC">)</span><span class="NAME">range</span><span class="PUNC">=</span><span class="NUMB">2</span><span class="NAME">e3</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="NAME">Obj</span><span class="PUNC">=</span><span class="NAME">obj</span><span class="PUNC">;</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">==</span><span class="STRN">'string'</span><span class="PUNC">&&</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">!=</span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NAME">obj.indexOf</span><span class="PUNC">(</span><span class="STRN">'.'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC"><</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="NAME">Obj</span><span class="PUNC">=</span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">Obj</span><span class="PUNC">=</span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">obj.slice</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">Obj</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="NAME">Obj</span><span class="PUNC">=</span><span class="NAME">eval</span><span class="PUNC">(</span><span class="STRN">'Obj.'</span><span class="PUNC">+</span><span class="NAME">obj.substr</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">Obj</span><span class="PUNC">)</span><span class="KEYW">try</span><span class="PUNC">{</span><span class="NAME">Obj</span><span class="PUNC">=</span><span class="NAME">eval</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">Obj</span><span class="PUNC">=</span><span class="NAME">obj</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="WHIT">
|
||
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="NAME">search</span><span class="PUNC">=</span><span class="NAME">searchKey</span><span class="PUNC">?</span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">searchKey</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">searchKey</span><span class="PUNC">==</span><span class="STRN">''</span><span class="PUNC">?</span><span class="NUMB">0</span><span class="PUNC">:</span><span class="NUMB">2</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">:</span><span class="NAME">searchKey</span><span class="PUNC">==</span><span class="NUMB">0</span><span class="PUNC">?</span><span class="NUMB">1</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="COMM">//0:not search,1:num,2:string</span><span class="WHIT">
|
||
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">search</span><span class="PUNC">==</span><span class="NUMB">1</span><span class="PUNC">&&</span><span class="NAME">searchKey</span><span class="PUNC">!=</span><span class="STRN">''</span><span class="PUNC">+</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">searchKey</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="NAME">search</span><span class="PUNC">=</span><span class="NUMB">2</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>236</span> </span><span class="WHIT"> </span><span class="COMM">//if(searchKey)if(isNaN(searchKey))if(searchKey=='')search=0;else search=2;else search=1;else search=0;</span><span class="WHIT">
|
||
<span class='line'>237</span> </span><span class="WHIT"> </span><span class="COMM">//if(!mode&&mode!=0&&is.ns4)mode=1;</span><span class="WHIT">
|
||
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">Obj</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">&&</span><span class="NAME">Obj</span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">mode</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">Obj</span><span class="PUNC">)</span><span class="NAME">m</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">i</span><span class="PUNC">+</span><span class="NAME">sp</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="NAME">M.push</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">M_</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">m.length</span><span class="PUNC">,</span><span class="NAME">m</span><span class="PUNC">=</span><span class="STRN">''</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="WHIT">
|
||
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">mode</span><span class="PUNC">==</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">Obj</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">v</span><span class="PUNC">=</span><span class="STRN">''</span><span class="PUNC">+</span><span class="NAME">Obj</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="COMM">//''+eval('Obj.'+i);</span><span class="WHIT">
|
||
<span class='line'>242</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">search</span><span class="PUNC">&&</span><span class="NAME">i.indexOf</span><span class="PUNC">(</span><span class="NAME">searchKey</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">&&</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">v</span><span class="PUNC">||</span><span class="NAME">search</span><span class="PUNC">==</span><span class="NUMB">2</span><span class="PUNC">&&</span><span class="NAME">v.indexOf</span><span class="PUNC">(</span><span class="NAME">searchKey</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">||</span><span class="NAME">v</span><span class="PUNC">!=</span><span class="NAME">searchKey</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="KEYW">continue</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>243</span> </span><span class="WHIT"> </span><span class="NAME">m</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">i</span><span class="PUNC">+</span><span class="STRN">'='</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">?</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">==</span><span class="STRN">'string'</span><span class="PUNC">&&</span><span class="NAME">v.length</span><span class="PUNC">></span><span class="NAME">r2</span><span class="PUNC">?</span><span class="NAME">v.slice</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">r2</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'..(string length '</span><span class="PUNC">+</span><span class="NAME">v.length</span><span class="PUNC">+</span><span class="STRN">')'</span><span class="PUNC">:</span><span class="NAME">v</span><span class="PUNC">:</span><span class="STRN">'(nothing:'</span><span class="PUNC">+</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">+</span><span class="STRN">')'</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NAME">sp</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>244</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">m.length</span><span class="PUNC">></span><span class="NAME">range</span><span class="PUNC">)</span><span class="NAME">M.push</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">M_</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">m.length</span><span class="PUNC">,</span><span class="NAME">m</span><span class="PUNC">=</span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>245</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="NAME">M.push</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">M_</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">m.length</span><span class="PUNC">,</span><span class="NAME">m</span><span class="PUNC">=</span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="NAME">m</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="STRN">'Error mode '</span><span class="PUNC">+</span><span class="NAME">mode</span><span class="PUNC">+</span><span class="STRN">' .'</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="NAME">m</span><span class="PUNC">=</span><span class="STRN">'** No such object: '</span><span class="PUNC">+</span><span class="NAME">obj</span><span class="PUNC">+</span><span class="STRN">' ! **\n('</span><span class="PUNC">+</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">+</span><span class="STRN">')'</span><span class="PUNC">+</span><span class="NAME">obj</span><span class="PUNC">+</span><span class="STRN">'='</span><span class="PUNC">+</span><span class="NAME">Obj</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>249</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">printmode</span><span class="PUNC">&&</span><span class="NAME">printmode</span><span class="PUNC">==</span><span class="NUMB">1</span><span class="PUNC">&&</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">!=</span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT">
|
||
<span class='line'>250</span> </span><span class="WHIT"> </span><span class="KEYW">with</span><span class="PUNC">(</span><span class="NAME">document</span><span class="PUNC">)</span><span class="NAME">open</span><span class="PUNC">(</span><span class="STRN">'text/plain'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">clear</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">write</span><span class="PUNC">(</span><span class="STRN">'content of '</span><span class="PUNC">+</span><span class="NAME">obj</span><span class="PUNC">+</span><span class="STRN">':'</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">search</span><span class="PUNC">?</span><span class="STRN">'search for '</span><span class="PUNC">+</span><span class="NAME">searchKey</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">search</span><span class="PUNC">==</span><span class="NUMB">1</span><span class="PUNC">?</span><span class="STRN">'(num)'</span><span class="PUNC">:</span><span class="STRN">'(str)'</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">' <!-- reload to HTML --><br/>\n'</span><span class="PUNC">+</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">close</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>251</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">M_</span><span class="PUNC">)</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">=</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC"><</span><span class="NAME">M.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="NAME">t</span><span class="PUNC">=</span><span class="NAME">obj</span><span class="PUNC">+</span><span class="STRN">' : '</span><span class="PUNC">+</span><span class="NAME">v</span><span class="PUNC">+</span><span class="STRN">'-'</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">M</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'/'</span><span class="PUNC">+</span><span class="NAME">M_</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">search</span><span class="PUNC">?</span><span class="STRN">', search for '</span><span class="PUNC">+</span><span class="NAME">searchKey</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">search</span><span class="PUNC">==</span><span class="NUMB">1</span><span class="PUNC">?</span><span class="STRN">'(number)'</span><span class="PUNC">:</span><span class="STRN">'(string)'</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'.'</span><span class="PUNC">:</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">alert</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">+</span><span class="STRN">' [Enter] to continue..\n\n'</span><span class="PUNC">+</span><span class="NAME">M</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>252</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="NAME">alert</span><span class="PUNC">(</span><span class="STRN">'showObj() error:\n'</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">||</span><span class="STRN">'show '</span><span class="PUNC">+</span><span class="NAME">obj</span><span class="PUNC">+</span><span class="STRN">': Got nothing!'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>253</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||
<span class='line'>254</span>
|
||
<span class='line'>255</span>
|
||
<span class='line'>256</span>
|
||
<span class='line'>257</span>
|
||
<span class='line'>258</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT">
|
||
<span class='line'>259</span> </span><span class="WHIT"> </span><span class="NAME">CeL.code.debug</span><span class="WHIT">
|
||
<span class='line'>260</span> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>261</span>
|
||
<span class='line'>262</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>263</span>
|
||
<span class='line'>264</span>
|
||
<span class='line'>265</span> </span><span class="COMM">//===================================================</span><span class="WHIT">
|
||
<span class='line'>266</span>
|
||
<span class='line'>267</span>
|
||
<span class='line'>268</span> </span><span class="NAME">CeL.setup_module</span><span class="PUNC">(</span><span class="NAME">module_name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">code_for_including</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>269</span>
|
||
<span class='line'>270</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||
<span class='line'>271</span> </span></pre></body></html> |