舊文件

此處文件僅供參考,請自行考量時效性與適用程度,其他庫藏文件請參考文件頁面
我們亟需您的協助,進行共筆系統搬移、及文件整理工作,詳情請查閱參與我們

「使用者:Wade.fs/MOOzillaC/files js」修訂間的差異

出自 MozTW Wiki

節次重排
行 1: 行 1:
* utils.js
+
= utils.js =
*# 來源為 JSIRC Library
+
# 來源為 JSIRC Library
*# 定義變數:  
+
# 定義變數:  
 
var singleTags = new Array(
 
var singleTags = new Array(
 
   "br", "img", "hr", "li", "dt", "dd", "meta", "link", "base","isindex",
 
   "br", "img", "hr", "li", "dt", "dd", "meta", "link", "base","isindex",
 
   "p", "nextid", "wbr", "option", "input", "area", "xmz_menu", "embed");  
 
   "p", "nextid", "wbr", "option", "input", "area", "xmz_menu", "embed");  
  
*# 提供物件: 像 dd, jsenv 物件等
+
# 提供物件: 像 dd, jsenv 物件等
*# 函式:
+
# 函式:
*#* dumpObject (o, pfx, sep);  
+
#* dumpObject (o, pfx, sep);  
*#* dumpObjectTree (o, recurse, compress, level), 用法 dumpObjectTree (o, 1);
+
#* dumpObjectTree (o, recurse, compress, level), 用法 dumpObjectTree (o, 1);
*#* Clone (obj)  複製已存在的物件,用法: var c = Clone(obj); 或 var c = new  Clone(obj);
+
#* Clone (obj)  複製已存在的物件,用法: var c = Clone(obj); 或 var c = new  Clone(obj);
*#* matchObject (o, pattern, negate);  
+
#* matchObject (o, pattern, negate);  
*#* matchEntry (partialName, list)  
+
#* matchEntry (partialName, list)  
*#* getCommonPfx (list)  
+
#* getCommonPfx (list)  
*#* renameProperty (obj, oldname, newname)  
+
#* renameProperty (obj, oldname, newname)  
*#* newObject(contractID, iface)  
+
#* newObject(contractID, iface)  
*#* getPriv (priv)  
+
#* getPriv (priv)  
*#* keys (o)
+
#* keys (o)
*#* stringTrim (s)  
+
#* stringTrim (s)  
*#* formatDateOffset (seconds, format)  
+
#* formatDateOffset (seconds, format)  
*#* arrayContains (ary, elem)  
+
#* arrayContains (ary, elem)  
*#* arrayIndexOf (ary, elem)  
+
#* arrayIndexOf (ary, elem)  
*#* arrayInsertAt (ary, i, o)  
+
#* arrayInsertAt (ary, i, o)  
*#* arrayRemoveAt (ary, i)  
+
#* arrayRemoveAt (ary, i)  
*#* abbreviateWord (str, length)  
+
#* abbreviateWord (str, length)  
*#* hyphenateWord (str, pos, hyphen)  
+
#* hyphenateWord (str, pos, hyphen)  
*#* splitLongWord (str, pos)  
+
#* splitLongWord (str, pos)  
*#* getRandomElement (ary)  
+
#* getRandomElement (ary)  
*#* roundTo (num, prec)  
+
#* roundTo (num, prec)  
*#* randomRange (min, max)  
+
#* randomRange (min, max)  
*#* getStackTrace ()  
+
#* getStackTrace ()  
*#* getInterfaces (cls)  
+
#* getInterfaces (cls)  
*#* mapObjFunc(ary, func_name, data)  
+
#* mapObjFunc(ary, func_name, data)  
*#* map(func, ary)
+
#* map(func, ary)
*#* lmth(str) : Inputs a string and parses it for any unclosed HTML tags.  
+
#* lmth(str) : Inputs a string and parses it for any unclosed HTML tags.  
  
* connection-xpcom.js
+
= connection-xpcom.js =
*# 來源為 JSIRC Library  
+
# 來源為 JSIRC Library  
*# 需 utils.js
+
# 需 utils.js
*# 定義系統訊息代碼,如 NS_ERROR_, NS_NET_STATUS_ ...
+
# 定義系統訊息代碼,如 NS_ERROR_, NS_NET_STATUS_ ...
*# 函式:
+
# 函式:
*#* toScriptableInputStream (i)  
+
#* toScriptableInputStream (i)  
*#* CBSConnection ()  
+
#* CBSConnection ()  
*#* CBSConnection.prototype.connect = bc_connect(host, port, bind, tcp_flag, observer)
+
#* CBSConnection.prototype.connect = bc_connect(host, port, bind, tcp_flag, observer)
*#* CBSConnection.prototype.disconnect = bc_disconnect()  
+
#* CBSConnection.prototype.disconnect = bc_disconnect()  
*#* CBSConnection.prototype.sendData = bc_senddata(str)  
+
#* CBSConnection.prototype.sendData = bc_senddata(str)  
*#* CBSConnection.prototype.readData = bc_readdata(timeout, count)  
+
#* CBSConnection.prototype.readData = bc_readdata(timeout, count)  
*#* CBSConnection.prototype.startAsyncRead = bc_saread (observer)  
+
#* CBSConnection.prototype.startAsyncRead = bc_saread (observer)  
*#* CBSConnection.prototype.asyncWrite = bc_awrite (str)  
+
#* CBSConnection.prototype.asyncWrite = bc_awrite (str)  
*#* CBSConnection.prototype.hasPendingWrite = bc_haspwrite ()  
+
#* CBSConnection.prototype.hasPendingWrite = bc_haspwrite ()  
*#* CBSConnection.prototype.sendDataNow = bc_senddatanow(str)  
+
#* CBSConnection.prototype.sendDataNow = bc_senddatanow(str)  
*#* StreamProvider(observer)  
+
#* StreamProvider(observer)  
*#* StreamListener(observer)  
+
#* StreamListener(observer)  
*#* StreamProvider.prototype.onDataWritable = sp_datawrite (request, ctxt, ostream, offset, count)  
+
#* StreamProvider.prototype.onDataWritable = sp_datawrite (request, ctxt, ostream, offset, count)  
*#* StreamListener.prototype.onDataAvailable = sl_dataavail (request, ctxt, inStr, sourceOffset, count)  
+
#* StreamListener.prototype.onDataAvailable = sl_dataavail (request, ctxt, inStr, sourceOffset, count)  
  
* entity.js
+
= entity.js =
*# 將 HTML 的 entity 映射成 unicode 字元,例如:
+
# 將 HTML 的 entity 映射成 unicode 字元,例如:
 
htmlEntities.nbsp = "\u00a0";  
 
htmlEntities.nbsp = "\u00a0";  
*# 定義函式: getEntity(str)
+
# 定義函式: getEntity(str)
  
* htmlRender.js
+
= htmlRender.js =
*# 定義所有用來分析、顯示內容的函式
+
# 定義所有用來分析、顯示內容的函式
*# 取得 prefs
+
# 取得 prefs
 
const PREF_CTRID = "@mozilla.org/preferences-service;1";
 
const PREF_CTRID = "@mozilla.org/preferences-service;1";
 
const nsIPrefBranch = Components.interfaces.nsIPrefBranch
 
const nsIPrefBranch = Components.interfaces.nsIPrefBranch
 
var pref = Components.classes[PREF_CTRID].getService(nsIPrefBranch);  
 
var pref = Components.classes[PREF_CTRID].getService(nsIPrefBranch);  
*# 定義函式:
+
# 定義函式:
*#* createTextElement(str, literalText, returnEvenWithBlankStr)  
+
#* createTextElement(str, literalText, returnEvenWithBlankStr)  
*#* createMsgElement(str, optionObject)  
+
#* createMsgElement(str, optionObject)  
*#* wrapInTable(element, optionObject)  
+
#* wrapInTable(element, optionObject)  
*#* styleElementByClass(element, includePrefix, optionObject)  
+
#* styleElementByClass(element, includePrefix, optionObject)  
*#* doRecursiveHTMLMunge(str, parent, optionObject)  
+
#* doRecursiveHTMLMunge(str, parent, optionObject)  
*#* recursiveTagEnder(right, tagName)  
+
#* recursiveTagEnder(right, tagName)  
*#* mungeByAutohyperlink(str, parent, optionObject)  
+
#* mungeByAutohyperlink(str, parent, optionObject)  
  
* moozilla.js
+
= moozilla.js =
*# 用來控制主視窗
+
# 用來控制主視窗
*# 定義「每步時間」 var STEP_TIMEOUT = 500;  
+
# 定義「每步時間」 var STEP_TIMEOUT = 500;  
*# 定義函式:  
+
# 定義函式:  
*#* onLoad()
+
#* onLoad()
*#* onHTMLKey()  
+
#* onHTMLKey()  
*#* onHTMLClick()  
+
#* onHTMLClick()  
*#* onUnLoad()  
+
#* onUnLoad()  
*#* onNextCmd()  
+
#* onNextCmd()  
*#* onPrevCmd()  
+
#* onPrevCmd()  
*#* onWindowKeyPress(e)  
+
#* onWindowKeyPress(e)  
*#* onPageDown()  
+
#* onPageDown()  
*#* onPageUp()  
+
#* onPageUp()  
*#* toggleMultiline()  
+
#* toggleMultiline()  
*#* multilineInputMode(state)  
+
#* multilineInputMode(state)  
*#* onMultilineInputKeyPress(e)  
+
#* onMultilineInputKeyPress(e)  
*#* completeInput(e)  
+
#* completeInput(e)  
*#* onInputKeyPress(e)  
+
#* onInputKeyPress(e)  
*#* displayLine(str, dataclass)  
+
#* displayLine(str, dataclass)  
*#* mainStep()  
+
#* mainStep()  
*#* onClose(status, errStr)  
+
#* onClose(status, errStr)  
*#* onRead(str)  
+
#* onRead(str)  
*#* onConnect()  
+
#* onConnect()  
*#* connectionTerminated()  
+
#* connectionTerminated()  
*#* onDisconnect()  
+
#* onDisconnect()  
*#* onSendtoinput()  
+
#* onSendtoinput()  
*#* reverseString(str)  
+
#* reverseString(str)  
*#* commandLink(command)  
+
#* commandLink(command)  
*#* onSaveScrollback(continueLogging)  
+
#* onSaveScrollback(continueLogging)  
*#* onStartLogging()  
+
#* onStartLogging()  
*#* onStopLogging()  
+
#* onStopLogging()  
*#* onClearScrollback()  
+
#* onClearScrollback()  
  
* network.js
+
= network.js =
*# 將 connection-xpcom.js 重新包裝成較易用易讀的版本
+
# 將 connection-xpcom.js 重新包裝成較易用易讀的版本
 +
<pre>
 
   var c = new CConnection('moo.ca', 7777);
 
   var c = new CConnection('moo.ca', 7777);
  
行 118: 行 119:
 
   c.write("Hello!");
 
   c.write("Hello!");
 
   c.close();  
 
   c.close();  
 +
</pre>
 +
# 定義函式:
 +
#* CConnection(host, port)
 +
#* CConnection.prototype.onStreamClose = connection_osr(status)
 +
#* CConnection.prototype.onStreamDataAvailable = connection_sda(request, inStream, sourceOffset, count)
 +
#* CConnection.prototype.connect = CConnection.prototype.open = connection_open()
 +
#* CConnection.prototype.write = connection_write(str)
 +
#* CConnection.prototype.close = CConnection.prototype.disconnect = connection_close()
  
*# 定義函式:
+
= newconn.js =
*#* CConnection(host, port)
+
# 給「連線」視窗用的函式
*#* CConnection.prototype.onStreamClose = connection_osr(status)
+
# 定義函式:
*#* CConnection.prototype.onStreamDataAvailable = connection_sda(request, inStream, sourceOffset, count)
+
#* onWindowKeyPress(e)  
*#* CConnection.prototype.connect = CConnection.prototype.open = connection_open()
+
#* onLoad()  
*#* CConnection.prototype.write = connection_write(str)
+
#* greyout() 用於讓 user name, passwd 欄位變灰色
*#* CConnection.prototype.close = CConnection.prototype.disconnect = connection_close()
+
#* onSelect()  
 
+
#* saveData() 將對話框所選的內容存到 client 物件
* newconn.js
+
#* onNewConnection()  
*# 給「連線」視窗用的函式
+
#* onDeleteConnection()  
*# 定義函式:
+
#* onOK()  
*#* onWindowKeyPress(e)  
+
#* onCancel()
*#* onLoad()  
 
*#* greyout() 用於讓 user name, passwd 欄位變灰色
 
*#* onSelect()  
 
*#* saveData() 將對話框所選的內容存到 client 物件
 
*#* onNewConnection()  
 
*#* onDeleteConnection()  
 
*#* onOK()  
 
*#* onCancel()
 

於 2005年7月29日 (五) 10:58 的修訂

utils.js

  1. 來源為 JSIRC Library
  2. 定義變數:

var singleTags = new Array(

 "br", "img", "hr", "li", "dt", "dd", "meta", "link", "base","isindex",
 "p", "nextid", "wbr", "option", "input", "area", "xmz_menu", "embed"); 
  1. 提供物件: 像 dd, jsenv 物件等
  2. 函式:
    • dumpObject (o, pfx, sep);
    • dumpObjectTree (o, recurse, compress, level), 用法 dumpObjectTree (o, 1);
    • Clone (obj) 複製已存在的物件,用法: var c = Clone(obj); 或 var c = new Clone(obj);
    • matchObject (o, pattern, negate);
    • matchEntry (partialName, list)
    • getCommonPfx (list)
    • renameProperty (obj, oldname, newname)
    • newObject(contractID, iface)
    • getPriv (priv)
    • keys (o)
    • stringTrim (s)
    • formatDateOffset (seconds, format)
    • arrayContains (ary, elem)
    • arrayIndexOf (ary, elem)
    • arrayInsertAt (ary, i, o)
    • arrayRemoveAt (ary, i)
    • abbreviateWord (str, length)
    • hyphenateWord (str, pos, hyphen)
    • splitLongWord (str, pos)
    • getRandomElement (ary)
    • roundTo (num, prec)
    • randomRange (min, max)
    • getStackTrace ()
    • getInterfaces (cls)
    • mapObjFunc(ary, func_name, data)
    • map(func, ary)
    • lmth(str) : Inputs a string and parses it for any unclosed HTML tags.

connection-xpcom.js

  1. 來源為 JSIRC Library
  2. 需 utils.js
  3. 定義系統訊息代碼,如 NS_ERROR_, NS_NET_STATUS_ ...
  4. 函式:
    • toScriptableInputStream (i)
    • CBSConnection ()
    • CBSConnection.prototype.connect = bc_connect(host, port, bind, tcp_flag, observer)
    • CBSConnection.prototype.disconnect = bc_disconnect()
    • CBSConnection.prototype.sendData = bc_senddata(str)
    • CBSConnection.prototype.readData = bc_readdata(timeout, count)
    • CBSConnection.prototype.startAsyncRead = bc_saread (observer)
    • CBSConnection.prototype.asyncWrite = bc_awrite (str)
    • CBSConnection.prototype.hasPendingWrite = bc_haspwrite ()
    • CBSConnection.prototype.sendDataNow = bc_senddatanow(str)
    • StreamProvider(observer)
    • StreamListener(observer)
    • StreamProvider.prototype.onDataWritable = sp_datawrite (request, ctxt, ostream, offset, count)
    • StreamListener.prototype.onDataAvailable = sl_dataavail (request, ctxt, inStr, sourceOffset, count)

entity.js

  1. 將 HTML 的 entity 映射成 unicode 字元,例如:

htmlEntities.nbsp = "\u00a0";

  1. 定義函式: getEntity(str)

htmlRender.js

  1. 定義所有用來分析、顯示內容的函式
  2. 取得 prefs

const PREF_CTRID = "@mozilla.org/preferences-service;1"; const nsIPrefBranch = Components.interfaces.nsIPrefBranch var pref = Components.classes[PREF_CTRID].getService(nsIPrefBranch);

  1. 定義函式:
    • createTextElement(str, literalText, returnEvenWithBlankStr)
    • createMsgElement(str, optionObject)
    • wrapInTable(element, optionObject)
    • styleElementByClass(element, includePrefix, optionObject)
    • doRecursiveHTMLMunge(str, parent, optionObject)
    • recursiveTagEnder(right, tagName)
    • mungeByAutohyperlink(str, parent, optionObject)

moozilla.js

  1. 用來控制主視窗
  2. 定義「每步時間」 var STEP_TIMEOUT = 500;
  3. 定義函式:
    • onLoad()
    • onHTMLKey()
    • onHTMLClick()
    • onUnLoad()
    • onNextCmd()
    • onPrevCmd()
    • onWindowKeyPress(e)
    • onPageDown()
    • onPageUp()
    • toggleMultiline()
    • multilineInputMode(state)
    • onMultilineInputKeyPress(e)
    • completeInput(e)
    • onInputKeyPress(e)
    • displayLine(str, dataclass)
    • mainStep()
    • onClose(status, errStr)
    • onRead(str)
    • onConnect()
    • connectionTerminated()
    • onDisconnect()
    • onSendtoinput()
    • reverseString(str)
    • commandLink(command)
    • onSaveScrollback(continueLogging)
    • onStartLogging()
    • onStopLogging()
    • onClearScrollback()

network.js

  1. 將 connection-xpcom.js 重新包裝成較易用易讀的版本
  var c = new CConnection('moo.ca', 7777);

  c.onRead = function(str) { alert("connection sent us " + str); }

  c.open();
  c.write("Hello!");
  c.close(); 
  1. 定義函式:
    • CConnection(host, port)
    • CConnection.prototype.onStreamClose = connection_osr(status)
    • CConnection.prototype.onStreamDataAvailable = connection_sda(request, inStream, sourceOffset, count)
    • CConnection.prototype.connect = CConnection.prototype.open = connection_open()
    • CConnection.prototype.write = connection_write(str)
    • CConnection.prototype.close = CConnection.prototype.disconnect = connection_close()

newconn.js

  1. 給「連線」視窗用的函式
  2. 定義函式:
    • onWindowKeyPress(e)
    • onLoad()
    • greyout() 用於讓 user name, passwd 欄位變灰色
    • onSelect()
    • saveData() 將對話框所選的內容存到 client 物件
    • onNewConnection()
    • onDeleteConnection()
    • onOK()
    • onCancel()
個人工具