舊文件

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

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

出自 MozTW Wiki

< 使用者:Wade.fs‎ | MOOzillaC
於 2005年7月13日 (三) 12:17 由 Wade.fs對話 | 貢獻 所做的修訂 JavaScript 摘要初稿
(比較) ←上一修訂 | 查看目前修訂 (比較) | 下一修訂→ (比較)
  • 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 物件等
 *# 函式:
   *#* 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
 *# 來源為 JSIRC Library 
 *# 需 utils.js
 *# 定義系統訊息代碼,如 NS_ERROR_, NS_NET_STATUS_ ...
 *# 函式:
   *#* 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
 *# 將 HTML 的 entity 映射成 unicode 字元,例如:

htmlEntities.nbsp = "\u00a0";

 *# 定義函式: 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);

 *# 定義函式:
   *#* 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
 *# 用來控制主視窗
 *# 定義「每步時間」 var STEP_TIMEOUT = 500; 
 *# 定義函式: 
   *#* 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
 *# 將 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(); 
 *# 定義函式:
   *#* 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
 *# 給「連線」視窗用的函式
 *# 定義函式:
   *#* onWindowKeyPress(e) 
   *#* onLoad() 
   *#* greyout() 用於讓 user name, passwd 欄位變灰色
   *#* onSelect() 
   *#* saveData() 將對話框所選的內容存到 client 物件
   *#* onNewConnection() 
   *#* onDeleteConnection() 
   *#* onOK() 
   *#* onCancel()
個人工具