舊文件

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

使用者:Wade.fs/MOOzillaC/files js

出自 MozTW Wiki

< 使用者:Wade.fs‎ | MOOzillaC
於 2005年7月29日 (五) 11:20 由 Wade.fs對話 | 貢獻 所做的修訂 connection-xpcom.js

utils.js

  • 來源為 JSIRC Library
  • 定義變數:
 var singleTags = new Array(
  "br", "img", "hr", "li", "dt", "dd", "meta", "link", "base","isindex",
  "p", "nextid", "wbr", "option", "input", "area", "xmz_menu", "embed"); 
 
  • 提供物件: 像 dd, jsenv 物件等
  • 函式:
    1. dumpObject (o, pfx, sep);
    2. dumpObjectTree (o, recurse, compress, level), 用法 dumpObjectTree (o, 1);
    3. Clone (obj) 複製已存在的物件,用法: var c = Clone(obj); 或 var c = new Clone(obj);
    4. matchObject (o, pattern, negate);
    5. matchEntry (partialName, list)
    6. getCommonPfx (list)
    7. renameProperty (obj, oldname, newname)
    8. newObject(contractID, iface)
    9. getPriv (priv)
    10. keys (o)
    11. stringTrim (s)
    12. formatDateOffset (seconds, format)
    13. arrayContains (ary, elem)
    14. arrayIndexOf (ary, elem)
    15. arrayInsertAt (ary, i, o)
    16. arrayRemoveAt (ary, i)
    17. abbreviateWord (str, length)
    18. hyphenateWord (str, pos, hyphen)
    19. splitLongWord (str, pos)
    20. getRandomElement (ary)
    21. roundTo (num, prec)
    22. randomRange (min, max)
    23. getStackTrace ()
    24. getInterfaces (cls)
    25. mapObjFunc(ary, func_name, data)
    26. map(func, ary)
    27. lmth(str) : Inputs a string and parses it for any unclosed HTML tags.

connection-xpcom.js

  • 源自 JSIRC Library,此為本擴充的 socket 核心
  • 需 utils.js
  • 定義系統訊息代碼,如 NS_ERROR_, NS_NET_STATUS_ ...
  • 局部函式: toScriptableInputStream (i)
  • 定義物件:CBSConnection StreamProvider StreamListener

entity.js

  1. 將 HTML 的 entity 映射成 unicode 字元,例如: htmlEntities.nbsp = "\u00a0";
  2. 定義函式: getEntity(str)

htmlRender.js

  • 定義所有用來分析、顯示內容的函式
  • 取得 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)
    2. createMsgElement(str, optionObject)
    3. wrapInTable(element, optionObject)
    4. styleElementByClass(element, includePrefix, optionObject)
    5. doRecursiveHTMLMunge(str, parent, optionObject)
    6. recursiveTagEnder(right, tagName)
    7. 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()
個人工具