Files
rappaurio-sae501_502/app/node_modules/cejs/_documents/JsDoc/symbols/src/D__USB_cgi-bin_lib_JS_net_Ajax.origin.js.html
2023-09-25 13:27:24 +02:00

366 lines
75 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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 Ajax
<span class='line'> 4</span> * @fileoverview
<span class='line'> 5</span> * 本檔案包含了 web Ajax 的 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="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'> 10</span>
<span class='line'> 11</span> </span><span class="COMM">/**
<span class='line'> 12</span> * 本 module 之 name(id)&lt;span style="text-decoration:line-through;">不設定時會從呼叫時之 path 取得&lt;/span>。
<span class='line'> 13</span> * @type String
<span class='line'> 14</span> * @constant
<span class='line'> 15</span> * @inner
<span class='line'> 16</span> * @ignore
<span class='line'> 17</span> */</span><span class="WHIT">
<span class='line'> 18</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">'net.Ajax'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 19</span>
<span class='line'> 20</span> </span><span class="COMM">//===================================================</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="COMM">/**
<span class='line'> 22</span> * 若欲 include 整個 module 時,需囊括之 code。
<span class='line'> 23</span> * @type Function
<span class='line'> 24</span> * @param {Function} library_namespace namespace of library
<span class='line'> 25</span> * @param load_arguments 呼叫時之 argument(s)
<span class='line'> 26</span> * @return
<span class='line'> 27</span> * @name CeL.net.Ajax
<span class='line'> 28</span> * @constant
<span class='line'> 29</span> * @inner
<span class='line'> 30</span> * @ignore
<span class='line'> 31</span> */</span><span class="WHIT">
<span class='line'> 32</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'> 33</span>
<span class='line'> 34</span> </span><span class="COMM">// requires</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">eval</span><span class="PUNC">(</span><span class="NAME">library_namespace.use_function</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="STRN">'code.compatibility.is_DOM'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 38</span>
<span class='line'> 39</span>
<span class='line'> 40</span> </span><span class="COMM">/**
<span class='line'> 41</span> * null module constructor
<span class='line'> 42</span> * @class web Ajax 的 functions
<span class='line'> 43</span> */</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="NAME">CeL.net.Ajax</span><span class="WHIT">
<span class='line'> 45</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'> 46</span> </span><span class="WHIT"> </span><span class="COMM">// null module constructor</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 48</span>
<span class='line'> 49</span> </span><span class="COMM">/**
<span class='line'> 50</span> * for JSDT: 有 prototype 才會將之當作 Class
<span class='line'> 51</span> */</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="NAME">CeL.net.Ajax</span><span class="WHIT">
<span class='line'> 53</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'> 54</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 55</span>
<span class='line'> 56</span>
<span class='line'> 57</span>
<span class='line'> 58</span>
<span class='line'> 59</span>
<span class='line'> 60</span>
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="COMM">// XMLHttp set ajax通信処理ライブラリ ==================</span><span class="WHIT">
<span class='line'> 62</span>
<span class='line'> 63</span>
<span class='line'> 64</span>
<span class='line'> 65</span> </span><span class="COMM">/*
<span class='line'> 66</span> to use: include in front:
<span class='line'> 67</span> way1(good: 以reg代替functionPath!):
<span class='line'> 68</span> // [function.js]_iF
<span class='line'> 69</span> // [function.js]End
<span class='line'> 70</span>
<span class='line'> 71</span> way2(old):
<span class='line'> 72</span> // [function.js]getU,functionPath,'eval(getU(functionPath));'
<span class='line'> 73</span> // [function.js]End
<span class='line'> 74</span>
<span class='line'> 75</span> old:
<span class='line'> 76</span> function getU(p){var o;try{o=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){o=new XMLHttpRequest();}if(o)with(o){open('GET',p,false),send(null);return responseText;}}
<span class='line'> 77</span> */</span><span class="WHIT">
<span class='line'> 78</span>
<span class='line'> 79</span>
<span class='line'> 80</span>
<span class='line'> 81</span> </span><span class="COMM">/* JScript or .wsh only, 能 encode
<span class='line'> 82</span> http://neural.cs.nthu.edu.tw/jang/books/asp/getWebPage.asp?title=10-1%20%E6%8A%93%E5%8F%96%E7%B6%B2%E9%A0%81%E8%B3%87%E6%96%99
<span class='line'> 83</span> */</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">getPage</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">,</span><span class="NAME">enc</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// page url, encode, POST text</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">X</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="STRN">'Microsoft.XMLHTTP'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">AS</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// may error</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="NAME">X.open</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">?</span><span class="STRN">'POST'</span><span class="PUNC">:</span><span class="STRN">'GET'</span><span class="PUNC">,</span><span class="NAME">p</span><span class="PUNC">,</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="NAME">X.setRequestHeader</span><span class="PUNC">(</span><span class="STRN">"Content-Type"</span><span class="PUNC">,</span><span class="STRN">"application/x-www-form-urlencoded"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// POST need this</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="NAME">X.send</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">||</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// Download the file</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="KEYW">with</span><span class="PUNC">(</span><span class="NAME">AS</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="STRN">"ADODB.Stream"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="NAME">Mode</span><span class="PUNC">=</span><span class="NUMB">3</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// 可同時進行讀寫</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">Type</span><span class="PUNC">=</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// 以二進位方式操作</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="NAME">Open</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// 開啟物件</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="NAME">Write</span><span class="PUNC">(</span><span class="NAME">X.responseBody</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// 將 binary 的資料寫入物件內 may error</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="NAME">Position</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="NAME">Type</span><span class="PUNC">=</span><span class="NUMB">2</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// 以文字模式操作</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">enc</span><span class="PUNC">)</span><span class="NAME">Charset</span><span class="PUNC">=</span><span class="NAME">enc</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// 設定編碼方式</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="NAME">X</span><span class="PUNC">=</span><span class="NAME">ReadText</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// 將物件內的文字讀出</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="NAME">AS</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="COMM">//AS=null; // free</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">X</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>102</span> </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="WHIT">
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="COMM">//sl('getPage: '+e.message);</span><span class="WHIT">
<span class='line'>104</span> </span><span class="PUNC">}</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>105</span>
<span class='line'>106</span>
<span class='line'>107</span>
<span class='line'>108</span> </span><span class="COMM">/* set a new XMLHttp
<span class='line'>109</span> Ajax程式應該考慮到server沒有回應時之處置
<span class='line'>110</span>
<span class='line'>111</span> return new XMLHttpRequest(for Ajax, Asynchronous JavaScript and XML) controller
<span class='line'>112</span> http://www.xulplanet.com/references/objref/XMLHttpRequest.html
<span class='line'>113</span> http://zh.wikipedia.org/wiki/AJAX
<span class='line'>114</span> http://jpspan.sourceforge.net/wiki/doku.php?id=javascript:xmlhttprequest:behaviour
<span class='line'>115</span> http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/
<span class='line'>116</span> http://developer.apple.com/internet/webcontent/xmlhttpreq.html
<span class='line'>117</span> http://www.klstudio.com/catalog.asp?cate=4
<span class='line'>118</span> http://wiki.moztw.org/index.php/AJAX_%E4%B8%8A%E6%89%8B%E7%AF%87
<span class='line'>119</span> http://www.15seconds.com/issue/991125.htm
<span class='line'>120</span> http://www.xmlhttp.cn/manual/xmlhttprequest.members.html
<span class='line'>121</span> http://www.blogjava.net/eamoi/archive/2005/10/31/17489.html
<span class='line'>122</span> http://www.kawa.net/works/js/jkl/parsexml.html
<span class='line'>123</span> http://www.twilightuniverse.com/
<span class='line'>124</span>
<span class='line'>125</span> XMLHttp.readyState 所有可能的值如下:
<span class='line'>126</span> 0 還沒開始
<span class='line'>127</span> 1 讀取中 Sending Data
<span class='line'>128</span> 2 已讀取 Data Sent
<span class='line'>129</span> 3 資訊交換中 interactive: getting data
<span class='line'>130</span> 4 一切完成 Completed
<span class='line'>131</span>
<span class='line'>132</span> XMLHttp.responseText 會把傳回值當字串用
<span class='line'>133</span> XMLHttp.responseXML 會把傳回值視為 XMLDocument 物件,而後可用 JavaScript DOM 相關函式處理
<span class='line'>134</span> IE only(?):
<span class='line'>135</span> XMLHttp.responseBody 以unsigned array格式表示binary data
<span class='line'>136</span> try{responseBody=(new VBArray(XMLHttp.responseBody)).toArray();}catch(e){}
<span class='line'>137</span> http://aspdotnet.cnblogs.com/archive/2005/11/30/287481.html
<span class='line'>138</span> XMLHttp.responseStream return AdoStream
<span class='line'>139</span> */</span><span class="WHIT">
<span class='line'>140</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">newXMLHttp</span><span class="PUNC">(</span><span class="NAME">enc</span><span class="PUNC">,</span><span class="NAME">isText</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="COMM">//if(typeof XMLHttp=='object')XMLHttp=null;</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_new_obj_XMLHttp</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>143</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">newXMLHttp.objId</span><span class="PUNC">==</span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="NAME">_new_obj_XMLHttp</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">newXMLHttp.objId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// speedy</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="COMM">// jQuery: Microsoft failed to properly implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available.</span><span class="WHIT">
<span class='line'>145</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="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">!=</span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">a</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="STRN">'Msxml2.XMLHTTP'</span><span class="PUNC">,</span><span class="STRN">'Microsoft.XMLHTTP'</span><span class="PUNC">,</span><span class="STRN">'Msxml2.XMLHTTP.4.0'</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">a.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="NAME">_new_obj_XMLHttp</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">newXMLHttp.objId</span><span class="PUNC">=</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">break</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="PUNC">}</span><span class="COMM">//'Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0',["MSXML2", "Microsoft", "MSXML"].['XMLHTTP','DOMDocument'][".6.0", ".4.0", ".3.0", ""]</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT"> </span><span class="COMM">// 或直接設定: XMLHttpRequest=function(){return new ActiveXObject(newXMLHttp.objId);}</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT"> </span><span class="COMM">// 皆無use XMLDocument. The document.all().XMLDocument is a Microsoft IE subset of JavaScript. http://www.bindows.net/ http://www.java2s.com/Code/JavaScriptReference/Javascript-Properties/XMLDocument.htm</span><span class="WHIT">
<span class='line'>149</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="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">&&</span><span class="NAME">window.XMLHttpRequest</span><span class="COMM">/* && !window.ActiveXObject*/</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="COMM">//typeof XMLHttpRequest!='undefined'</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT"> </span><span class="NAME">_new_obj_XMLHttp</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XMLHttpRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT"> </span><span class="COMM">// 有些版本的 Mozilla 瀏覽器在伺服器送回的資料未含 XML mime-type 檔頭header時會出錯。為了避免這個問題你可以用下列方法覆寫伺服器傳回的檔頭以免傳回的不是 text/xml。</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT"> </span><span class="COMM">// http://squio.nl/blog/2006/06/27/xmlhttprequest-and-character-encoding/</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="COMM">// http://www.w3.org/TR/XMLHttpRequest/ search encoding</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">_new_obj_XMLHttp.overrideMimeType</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT"> </span><span class="NAME">_new_obj_XMLHttp.overrideMimeType</span><span class="PUNC">(</span><span class="STRN">'text/'</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">isText</span><span class="PUNC">?</span><span class="STRN">'plain'</span><span class="PUNC">:</span><span class="STRN">'xml'</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">enc</span><span class="PUNC">?</span><span class="STRN">'; charset='</span><span class="PUNC">+</span><span class="NAME">enc</span><span class="PUNC">:</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="COMM">//oXML</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_new_obj_XMLHttp</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>158</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>159</span>
<span class='line'>160</span> </span><span class="COMM">/* 讀取URL by XMLHttpRequest
<span class='line'>161</span> http://jck11.pixnet.net/blog/post/11630232
<span class='line'>162</span>
<span class='line'>163</span> * 若有多行程或為各URL設定個別XMLHttp之必要請在一開始便設定getURL.multi_request並且別再更改。
<span class='line'>164</span> ** 在此情況下單一URL仍只能有單一個request!
<span class='line'>165</span> ** 設定 dealFunction 須注意程式在等待回應時若無執行其他程式碼將自動中止!
<span class='line'>166</span> 可設定:
<span class='line'>167</span> while(getURL.doing)WScript.Sleep(1); //||timeout
<span class='line'>168</span>
<span class='line'>169</span> arguments f:{
<span class='line'>170</span> URL:'', // The same origin policy prevents document or script loaded from one origin, from getting or setting properties from a of a document from a different origin.(http://www.mozilla.org/projects/security/components/jssec.html#sameorigin)
<span class='line'>171</span> enc:'UTF-8', // encoding: big5, euc-jp,..
<span class='line'>172</span> fn:(dealFunction), // onLoad:function(){},
<span class='line'>173</span> method:'GET', // POST,..
<span class='line'>174</span> sendDoc:'text send in POST,..'
<span class='line'>175</span> async:ture/false, // true if want to asynchronous(非同期), false if synchronous(同期的,會直到readyState==4才return) http://jpspan.sourceforge.net/wiki/doku.php?id=javascript:xmlhttprequest:behaviour
<span class='line'>176</span> user:'userName',
<span class='line'>177</span> passwd:'****', // password
<span class='line'>178</span>
<span class='line'>179</span> //TODO:
<span class='line'>180</span> parameters:'~=~&~=~', // {a:1,b:2}
<span class='line'>181</span> header:{contentType:'text/xml'},
<span class='line'>182</span> contentType:'text/xml',
<span class='line'>183</span> run:true/false, // do eval
<span class='line'>184</span> update:DOMDocument, // use onLoad/onFailed to 加工 return text. onFailed(){throw;} will about change.
<span class='line'>185</span> interval:\d,
<span class='line'>186</span> decay:\d, // wait decay*interval when no change
<span class='line'>187</span> maxInterval::\d,
<span class='line'>188</span> //insertion:top/bottom,..
<span class='line'>189</span> onFailed:function(error){this.status;}, // onFailed.apply(XMLHttp,[XMLHttp.status])
<span class='line'>190</span> onStateChange:function(){},
<span class='line'>191</span> }
<span class='line'>192</span>
<span class='line'>193</span>
<span class='line'>194</span> dealFunction:
<span class='line'>195</span> 自行處理 typeof dealFunction=='function':
<span class='line'>196</span> function dealFunction(error){..}
<span class='line'>197</span> 代為處理 dealFunction=[d_func,0: responseText,1: responseXML]:
<span class='line'>198</span> responseXML: http://msdn2.microsoft.com/en-us/library/ms757878.aspx
<span class='line'>199</span> function d_func(content,head[,XMLHttp,URL]){
<span class='line'>200</span> if(head){
<span class='line'>201</span> // content,head各為XMLHttp.responseText內容及XMLHttp.getAllResponseHeaders()其他皆可由XMLHttp取得。
<span class='line'>202</span> }else{
<span class='line'>203</span> // content為error
<span class='line'>204</span> }
<span class='line'>205</span> }
<span class='line'>206</span> e.g., the simplest: [function(c,h){h&&alert(c);}]
<span class='line'>207</span>
<span class='line'>208</span> )
<span class='line'>209</span> */</span><span class="WHIT">
<span class='line'>210</span> </span><span class="NAME">getURL</span><span class="PUNC">[</span><span class="NAME">generateCode.dLK</span><span class="PUNC">]</span><span class="PUNC">=</span><span class="STRN">'newXMLHttp'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>211</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">getURL</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">// (URL,fn) or flag URL,dealFunction,method,sendDoc,asyncFlag,userName,password</span><span class="WHIT">
<span class='line'>212</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'>213</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">_f.XMLHttp</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT"> </span><span class="COMM">//try{_f.XMLHttp.abort();}catch(e){}</span><span class="WHIT">
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="NAME">_f.XMLHttp</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// 此時可能衝突或lose?!</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="COMM">// 處理 arguments</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="NAME">f</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="NAME">a</span><span class="PUNC">=</span><span class="NAME">arguments</span><span class="PUNC">,</span><span class="NAME">f</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">URL</span><span class="PUNC">:</span><span class="NAME">f</span><span class="PUNC">,</span><span class="NAME">fn</span><span class="PUNC">:</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">method</span><span class="PUNC">:</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">sendDoc</span><span class="PUNC">:</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">3</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>219</span>
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">f.URL</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="NAME">_f.XMLHttp</span><span class="PUNC">=</span><span class="NAME">newXMLHttp</span><span class="PUNC">(</span><span class="NAME">f.enc</span><span class="PUNC">,</span><span class="PUNC">!</span><span class="REGX">/\.x(ht)?ml$/i</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">f.URL</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="COMM">//throw</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="COMM">//try{_f.XMLHttp.overrideMimeType('text/xml');}catch(e){}</span><span class="WHIT">
<span class='line'>222</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">f.async</span><span class="PUNC">!=</span><span class="STRN">'boolean'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT"> </span><span class="COMM">// 設定f.async</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="NAME">f.async</span><span class="PUNC">=</span><span class="NAME">f.fn</span><span class="PUNC">?</span><span class="KEYW">true</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>225</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="PUNC">!</span><span class="NAME">f.async</span><span class="PUNC">)</span><span class="NAME">f.fn</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>226</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="PUNC">!</span><span class="NAME">f.fn</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>227</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">_f.HandleStateChange</span><span class="PUNC">!=</span><span class="STRN">'function'</span><span class="PUNC">||</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">_f.HandleContent</span><span class="PUNC">!=</span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="COMM">// 沒有能處理的function</span><span class="WHIT">
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="COMM">//throw</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="NAME">f.fn</span><span class="PUNC">=</span><span class="NAME">_f.HandleContent</span><span class="PUNC">;</span><span class="COMM">//null;</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="COMM">/*typeof _f.multi_request!='undefined'&&*/</span><span class="NAME">_f.multi_request</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">_f.q</span><span class="PUNC">)</span><span class="NAME">_f.i</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">_f.q</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// queue</span><span class="WHIT">
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="NAME">_f.i</span><span class="PUNC">[</span><span class="NAME">f.URL</span><span class="PUNC">]</span><span class="PUNC">=</span><span class="NAME">_f.q.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// ** 沒有考慮到 POST 時 URL 相同的情況!</span><span class="WHIT">
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="NAME">_f.q.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">uri</span><span class="PUNC">:</span><span class="NAME">f.URL</span><span class="PUNC">,</span><span class="NAME">XMLHttp</span><span class="PUNC">:</span><span class="NAME">_f.XMLHttp</span><span class="PUNC">,</span><span class="NAME">func</span><span class="PUNC">:</span><span class="NAME">f.fn</span><span class="PUNC">,</span><span class="NAME">start</span><span class="PUNC">:</span><span class="NAME">_f.startTime</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>236</span> </span><span class="WHIT"> </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="NAME">_f.q</span><span class="PUNC">&&</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">_f.clean</span><span class="PUNC">==</span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="NAME">_f.clean</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>237</span>
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="COMM">// for Gecko Error: uncaught exception: Permission denied to call method XMLHttpRequest.open</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="NAME">f.URL.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="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">netscape</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">_f.asked</span><span class="PUNC">></span><span class="NUMB">2</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">_f.clean</span><span class="PUNC">(</span><span class="NAME">f.URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</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">else</span><span class="WHIT"> </span><span class="KEYW">try</span><span class="PUNC">{</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="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">_f.asked</span><span class="PUNC">==</span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>243</span> </span><span class="WHIT"> </span><span class="NAME">_f.asked</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">alert</span><span class="PUNC">(</span><span class="STRN">'我們需要一點權限來使用 XMLHttpRequest.open。\n* 請勾選記住這項設定的方格。'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>244</span> </span><span class="WHIT"> </span><span class="NAME">netscape.security.PrivilegeManager.enablePrivilege</span><span class="PUNC">(</span><span class="STRN">'UniversalXPConnect'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT"> </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">_f.asked</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="NAME">_f.clean</span><span class="PUNC">(</span><span class="NAME">f.URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="COMM">//UniversalBrowserAccess</span><span class="WHIT">
<span class='line'>246</span>
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="COMM">//if(isNaN(_f.timeout))_f.timeout=300000;//5*60*1000;</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="KEYW">with</span><span class="PUNC">(</span><span class="NAME">_f.XMLHttp</span><span class="PUNC">)</span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// IE:404會throw error, timeout除了throw error, 還會readystatechange; Gecko亦會throw error</span><span class="WHIT">
<span class='line'>249</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="NAME">setRequestHeader</span><span class="PUNC">(</span><span class="STRN">"Accept-Encoding"</span><span class="PUNC">,</span><span class="STRN">"gzip,deflate"</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="PUNC">}</span><span class="WHIT">
<span class='line'>250</span> </span><span class="WHIT"> </span><span class="COMM">// Set header so the called script knows that it's an XMLHttpRequest</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT"> </span><span class="COMM">//setRequestHeader("X-Requested-With","XMLHttpRequest");</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT"> </span><span class="COMM">// Set the If-Modified-Since header, if ifModified mode.</span><span class="WHIT">
<span class='line'>253</span> </span><span class="WHIT"> </span><span class="COMM">//setRequestHeader("If-Modified-Since","Thu, 01 Jan 1970 00:00:00 GMT");</span><span class="WHIT">
<span class='line'>254</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">f.method</span><span class="PUNC">==</span><span class="STRN">'POST'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="COMM">//&&_f.XMLHttp.setRequestHeader</span><span class="WHIT">
<span class='line'>255</span> </span><span class="WHIT"> </span><span class="COMM">//setRequestHeader("Content-Length",f.sendDoc.length); // use .getAttribute('method') to get 長度不一定如此</span><span class="WHIT">
<span class='line'>256</span> </span><span class="WHIT"> </span><span class="COMM">// 有些CGI會用Content-Type測試是XMLHttp或是regular form</span><span class="WHIT">
<span class='line'>257</span> </span><span class="WHIT"> </span><span class="COMM">// It may be necessary to specify "application/x-www-form-urlencoded" or "multipart/form-data" for posted XML data to be interpreted on the server.</span><span class="WHIT">
<span class='line'>258</span> </span><span class="WHIT"> </span><span class="NAME">setRequestHeader</span><span class="PUNC">(</span><span class="STRN">'Content-Type'</span><span class="PUNC">,</span><span class="NAME">f.fn</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">&&</span><span class="NAME">f.fn</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">?</span><span class="STRN">'text/xml'</span><span class="PUNC">:</span><span class="STRN">'application/x-www-form-urlencoded'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// application/x-www-form-urlencoded;charset=utf-8</span><span class="WHIT">
<span class='line'>259</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>260</span> </span><span class="WHIT"> </span><span class="NAME">abort</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>261</span> </span><span class="WHIT"> </span><span class="NAME">open</span><span class="PUNC">(</span><span class="NAME">f.method</span><span class="PUNC">||</span><span class="STRN">'GET'</span><span class="PUNC">,</span><span class="NAME">f.URL</span><span class="PUNC">,</span><span class="NAME">f.async</span><span class="PUNC">,</span><span class="NAME">f.user</span><span class="PUNC">||</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">f.passwd</span><span class="PUNC">||</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT"> </span><span class="COMM">//alert((f.method||'GET')+','+f.URL+','+f.async);</span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT"> </span><span class="COMM">// 根據 W3C的 XMLHttpRequest 規格書上說,①在呼叫 open 時如果readyState是4(Loaded) ②呼叫abort之後 ③發生其他錯誤如網路問題無窮迴圈等等則會重設所有的值。使用全域的情況就只有第一次可以執行因為之後的readyState是4所以onreadystatechange 放在open之前會被清空因此onreadystatechange 必須放在open之後就可以避免這個問題。 http://www.javaworld.com.tw/jute/post/view?bid=49&id=170177&sty=3&age=0&tpg=1&ppg=1</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT"> </span><span class="COMM">// 每使用一次XMLHttpRequest不管成功或失敗都要重設onreadystatechange一次。onreadystatechange 的初始值是 null</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT"> </span><span class="COMM">// After the initial response, all event listeners will be cleared. Call open() before setting new event listeners. http://www.xulplanet.com/references/objref/XMLHttpRequest.html</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">f.async</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT"> </span><span class="NAME">_f.doing</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">_f.doing</span><span class="PUNC">||</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>268</span> </span><span class="WHIT"> </span><span class="NAME">onreadystatechange</span><span class="PUNC">=</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">f.fn</span><span class="PUNC">==</span><span class="STRN">'function'</span><span class="PUNC">?</span><span class="NAME">f.fn</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">_f.HandleStateChange</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">f.URL</span><span class="PUNC">,</span><span class="NAME">f.fn</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="COMM">//||null</span><span class="WHIT">
<span class='line'>269</span> </span><span class="WHIT"> </span><span class="COMM">// 應加 clearTimeout( )</span><span class="WHIT">
<span class='line'>270</span> </span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="STRN">'try{getURL.'</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">_f.multi_request</span><span class="PUNC">?</span><span class="STRN">'q['</span><span class="PUNC">+</span><span class="NAME">_f.i</span><span class="PUNC">[</span><span class="NAME">f.URL</span><span class="PUNC">]</span><span class="PUNC">+</span><span class="STRN">']'</span><span class="PUNC">:</span><span class="STRN">'XMLHttp'</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'.onreadystatechange();}catch(e){}'</span><span class="PUNC">,</span><span class="NAME">_f.timeout</span><span class="PUNC">||</span><span class="NUMB">3</span><span class="NAME">e5</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="COMM">//5*60*1000;</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT"> </span><span class="NAME">send</span><span class="PUNC">(</span><span class="NAME">f.sendDoc</span><span class="PUNC">||</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>272</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">f.fn</span><span class="PUNC">)</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">responseText</span><span class="PUNC">;</span><span class="COMM">//responseXML: responseXML.loadXML(text) // 非async(異步的)能在此就得到response。Safari and Konqueror cannot understand the encoding of text files! http://www.kawa.net/works/js/jkl/parsexml.html</span><span class="WHIT">
<span class='line'>273</span> </span><span class="WHIT"> </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="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">f.fn</span><span class="PUNC">==</span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="NAME">f.fn</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</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">window</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="NAME">window.status</span><span class="PUNC">=</span><span class="NAME">e.message</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>274</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>275</span> </span><span class="NAME">getURL.timeoutCode</span><span class="PUNC">=</span><span class="PUNC">-</span><span class="NUMB">7732147</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>276</span>
<span class='line'>277</span> </span><span class="COMM">// agent handle function</span><span class="WHIT">
<span class='line'>278</span> </span><span class="NAME">getURL.HandleStateChange</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">URL</span><span class="PUNC">,</span><span class="NAME">dealFunction</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// e: object Error, dealFunction: function(return text, heads, XMLHttpRequest object, URL) | [ function, (default|NULL:responseText, others:responseXML) ]</span><span class="WHIT">
<span class='line'>279</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="NUMB">0</span><span class="PUNC">,</span><span class="NAME">isOKc</span><span class="PUNC">,</span><span class="NAME">m</span><span class="PUNC">=</span><span class="NAME">getURL.multi_request</span><span class="PUNC">,</span><span class="NAME">_oXMLH</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>280</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</span><span class="PUNC">=</span><span class="NAME">getURL.q</span><span class="PUNC">[</span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">URL</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">getURL.i</span><span class="PUNC">[</span><span class="NAME">URL</span><span class="PUNC">]</span><span class="PUNC">:</span><span class="NAME">URL</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">_oXMLH</span><span class="PUNC">=</span><span class="NAME">m.XMLHttp</span><span class="PUNC">,</span><span class="NAME">dealFunction</span><span class="PUNC">=</span><span class="NAME">m.func</span><span class="PUNC">,</span><span class="NAME">URL</span><span class="PUNC">=</span><span class="NAME">m.uri</span><span class="PUNC">;</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="NAME">_oXMLH</span><span class="PUNC">=</span><span class="NAME">getURL.XMLHttp</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>281</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">dealFunction</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">)</span><span class="NAME">_t</span><span class="PUNC">=</span><span class="NAME">dealFunction</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">dealFunction</span><span class="PUNC">=</span><span class="NAME">dealFunction</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>282</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">dealFunction</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">dealFunction</span><span class="PUNC">!=</span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">getURL.doing</span><span class="PUNC">--</span><span class="PUNC">;</span><span class="NAME">getURL.clean</span><span class="PUNC">(</span><span class="NAME">URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>283</span> </span><span class="WHIT"> </span><span class="COMM">// http://big5.chinaz.com:88/book.chinaz.com/others/web/web/xml/index1/21.htm</span><span class="WHIT">
<span class='line'>284</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>285</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">_oXMLH</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">&&</span><span class="NAME">_oXMLH</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>286</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">_oXMLH.parseError</span><span class="PUNC">&&</span><span class="NAME">_oXMLH</span><span class="COMM">/*.responseXML*/</span><span class="PUNC">.</span><span class="NAME">parseError.errorCode</span><span class="PUNC">!=</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">=</span><span class="NAME">_oXMLH.parseError</span><span class="PUNC">,</span><span class="NAME">e</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="NAME">e.errorCode</span><span class="PUNC">,</span><span class="NAME">e.reason</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>288</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">_oXMLH.readyState</span><span class="PUNC">==</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// only if XMLHttp shows "loaded"</span><span class="WHIT">
<span class='line'>289</span> </span><span class="WHIT"> </span><span class="NAME">isOKc</span><span class="PUNC">=</span><span class="NAME">_oXMLH.status</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// condition is OK?</span><span class="WHIT">
<span class='line'>290</span> </span><span class="WHIT"> </span><span class="NAME">isOKc</span><span class="PUNC">=</span><span class="NAME">isOKc</span><span class="PUNC">>=</span><span class="NUMB">200</span><span class="PUNC">&&</span><span class="NAME">isOKc</span><span class="PUNC">&lt;</span><span class="NUMB">300</span><span class="PUNC">||</span><span class="NAME">isOKc</span><span class="PUNC">==</span><span class="NUMB">304</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">isOKc</span><span class="PUNC">&&</span><span class="PUNC">(</span><span class="NAME">location.protocol</span><span class="PUNC">==</span><span class="STRN">"file:"</span><span class="PUNC">||</span><span class="NAME">location.protocol</span><span class="PUNC">==</span><span class="STRN">"chrome:"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>291</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">dealFunction</span><span class="PUNC">==</span><span class="NAME">getURL.HandleContent</span><span class="PUNC">)</span><span class="NAME">dealFunction</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">isOKc</span><span class="PUNC">,</span><span class="NAME">_oXMLH</span><span class="PUNC">,</span><span class="NAME">URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="COMM">//dealFunction.apply()</span><span class="WHIT">
<span class='line'>292</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="NAME">dealFunction</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>293</span> </span><span class="WHIT"> </span><span class="NAME">isOKc</span><span class="PUNC">?</span><span class="NAME">_t</span><span class="PUNC">?</span><span class="NAME">_oXMLH.responseXML</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>294</span> </span><span class="WHIT"> </span><span class="COMM">// JKL.ParseXML: Safari and Konqueror cannot understand the encoding of text files.</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">&&</span><span class="NAME">window.navigator.appVersion.indexOf</span><span class="PUNC">(</span><span class="STRN">"KHTML"</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">e</span><span class="PUNC">=</span><span class="NAME">escape</span><span class="PUNC">(</span><span class="NAME">_oXMLH.responseText</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">"%u"</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">e</span><span class="PUNC">:</span><span class="NAME">_oXMLH.responseText</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="NUMB">0</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT"> </span><span class="PUNC">,</span><span class="NAME">isOKc</span><span class="PUNC">?</span><span class="NAME">_oXMLH.getAllResponseHeaders</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">_oXMLH</span><span class="PUNC">,</span><span class="NAME">URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="COMM">//dealFunction.apply()</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT"> </span><span class="COMM">// URL之protocol==file: 可能需要重新.loadXML((.responseText+'').replace(/&lt;\?xml[^?]*\?>/,""))</span><span class="WHIT">
<span class='line'>299</span> </span><span class="WHIT"> </span><span class="COMM">// 用 .responseXML.documentElement 可調用</span><span class="WHIT">
<span class='line'>300</span> </span><span class="WHIT"> </span><span class="NAME">getURL.doing</span><span class="PUNC">--</span><span class="PUNC">;</span><span class="NAME">getURL.clean</span><span class="PUNC">(</span><span class="NAME">URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>301</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT"> </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">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">-</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">?</span><span class="NAME">m.start</span><span class="PUNC">:</span><span class="NAME">getURL.startTime</span><span class="PUNC">)</span><span class="PUNC">></span><span class="NAME">getURL.timeout</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>304</span> </span><span class="WHIT"> </span><span class="COMM">// timeout & timeout function http://www.stylusstudio.com/xmldev/199912/post40380.html</span><span class="WHIT">
<span class='line'>305</span> </span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="NAME">getURL.timeoutCode</span><span class="PUNC">,</span><span class="STRN">'Timeout!'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="COMM">//_oXMLH.abort();</span><span class="WHIT">
<span class='line'>306</span> </span><span class="WHIT"> </span><span class="COMM">//alert(URL+'\n'+_t+'\n'+e+'\n'+_oXMLH.readyState+'\n'+dealFunction);</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">dealFunction</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">_oXMLH</span><span class="PUNC">,</span><span class="NAME">URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">getURL.doing</span><span class="PUNC">--</span><span class="PUNC">;</span><span class="NAME">getURL.clean</span><span class="PUNC">(</span><span class="NAME">URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="COMM">//dealFunction.apply(e,URL);</span><span class="WHIT">
<span class='line'>308</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>309</span>
<span class='line'>310</span> </span><span class="COMM">/* agent content handle function
<span class='line'>311</span> 有head時content包含回應否則content表error
<span class='line'>312</span> */</span><span class="WHIT">
<span class='line'>313</span> </span><span class="NAME">getURL.HandleContent</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">,</span><span class="NAME">head</span><span class="PUNC">,</span><span class="NAME">_oXMLHttp</span><span class="PUNC">,</span><span class="NAME">URL</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>314</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">head</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT"> </span><span class="COMM">// _oXMLHttp.getResponseHeader("Content-Length")</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT"> </span><span class="NAME">alert</span><span class="PUNC">(</span><span class="STRN">"URL: "</span><span class="PUNC">+</span><span class="NAME">URL</span><span class="PUNC">+</span><span class="STRN">"\nHead:\n"</span><span class="PUNC">+</span><span class="NAME">_oXMLHttp.getAllResponseHeaders</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">"\n------------------------\nLastModified: "</span><span class="PUNC">+</span><span class="NAME">_oXMLHttp.getResponseHeader</span><span class="PUNC">(</span><span class="STRN">"Last-Modified"</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">"\nResult:\n"</span><span class="PUNC">+</span><span class="NAME">_oXMLHttp.responseText.slice</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NUMB">200</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="COMM">//_oXMLHttp.responseXML.xml</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="COMM">// error test時可用getURL.XMLHttp.open("HEAD","_URL_",true);getURL(url,dealResult,'HEAD',true)。</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">content</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="NAME">alert</span><span class="PUNC">(</span><span class="STRN">'Error occured!\n'</span><span class="PUNC">+</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="STRN">'object'</span><span class="PUNC">&&</span><span class="NAME">e.number</span><span class="PUNC">?</span><span class="NAME">e.number</span><span class="PUNC">+</span><span class="STRN">':'</span><span class="PUNC">+</span><span class="NAME">e.message</span><span class="PUNC">:</span><span class="NAME">e</span><span class="PUNC">||</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>320</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="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">_oXMLHttp</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">&&</span><span class="NAME">_oXMLHttp</span><span class="PUNC">)</span><span class="NAME">alert</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">_oXMLHttp.status</span><span class="PUNC">==</span><span class="NUMB">404</span><span class="PUNC">?</span><span class="STRN">"URL doesn't exist!"</span><span class="PUNC">:</span><span class="STRN">'Error occured!'</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'\n\nStatus: '</span><span class="PUNC">+</span><span class="NAME">_oXMLHttp.status</span><span class="PUNC">+</span><span class="STRN">'\n'</span><span class="PUNC">+</span><span class="NAME">_oXMLHttp.statusText</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>321</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>322</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>323</span>
<span class='line'>324</span> </span><span class="COMM">// 在MP模式下清乾淨queue</span><span class="WHIT">
<span class='line'>325</span> </span><span class="NAME">getURL.clean</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="NAME">force</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">force</span><span class="PUNC">||</span><span class="NAME">getURL.multi_request</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>327</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">isNaN</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'>328</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">getURL.q</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>329</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">getURL.i</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT"> </span><span class="NAME">getURL.q</span><span class="PUNC">[</span><span class="NAME">getURL.i</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">XMLHttp.abort</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT"> </span><span class="COMM">//getURL.q[getURL.i[i]].XMLHttp=null;</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT"> </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="PUNC">}</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT"> </span><span class="NAME">getURL.q</span><span class="PUNC">=</span><span class="NAME">getURL.i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="COMM">//null</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT"> </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="PUNC">!</span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NAME">getURL.i</span><span class="PUNC">[</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">==</span><span class="STRN">'object'</span><span class="PUNC">?</span><span class="NAME">i.uri</span><span class="PUNC">:</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="NAME">getURL.q</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">XMLHttp.abort</span><span class="PUNC">(</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="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT"> </span><span class="COMM">//getURL.q[i].XMLHttp=0;</span><span class="WHIT">
<span class='line'>338</span> </span><span class="WHIT"> </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">getURL.i</span><span class="PUNC">[</span><span class="NAME">getURL.q</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">uri</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">getURL.q</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>339</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>340</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>341</span>
<span class='line'>342</span> </span><span class="COMM">// ↑XMLHttp set ==================</span><span class="WHIT">
<span class='line'>343</span>
<span class='line'>344</span>
<span class='line'>345</span>
<span class='line'>346</span>
<span class='line'>347</span>
<span class='line'>348</span>
<span class='line'>349</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT"> </span><span class="NAME">CeL.net.Ajax</span><span class="WHIT">
<span class='line'>351</span> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>352</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>353</span>
<span class='line'>354</span> </span><span class="COMM">//===================================================</span><span class="WHIT">
<span class='line'>355</span>
<span class='line'>356</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'>357</span>
<span class='line'>358</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>359</span> </span></pre></body></html>