slashhack-cvs Mailing List for SlashHack
Brought to you by:
fletch
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(57) |
Nov
|
Dec
|
|---|
|
From: Dave F. <fl...@us...> - 2004-10-21 04:57:05
|
Update of /cvsroot/slashhack/slashhack/resources/xul/menus In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17990/resources/xul/menus Modified Files: index.xul Log Message: Added #slashhack IRC channel. Index: index.xul =================================================================== RCS file: /cvsroot/slashhack/slashhack/resources/xul/menus/index.xul,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.xul 20 Oct 2004 03:59:12 -0000 1.2 --- index.xul 21 Oct 2004 04:56:55 -0000 1.3 *************** *** 52,55 **** --- 52,59 ---- image='chrome://slashhack/content/resources/images/slashicon.gif' oncommand='window.open("irc://us.slashnet.org/slashdot").close();'/> + <menuitem + label='Slashhack IRC' + class='menuitem-iconic' + oncommand='window.open("irc://us.slashnet.org/slashhack").close();'/> <menuseparator/> <template> |
|
From: Dave F. <fl...@us...> - 2004-10-21 04:33:04
|
Update of /cvsroot/slashhack/slashhack-site/about In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13606/about Modified Files: index.html Log Message: Finished about page Index: index.html =================================================================== RCS file: /cvsroot/slashhack/slashhack-site/about/index.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** index.html 21 Oct 2004 04:28:55 -0000 1.4 --- index.html 21 Oct 2004 04:32:54 -0000 1.5 *************** *** 36,39 **** --- 36,44 ---- License</a> (MPL)</p> + <p>Visit the <a + href='http://sourceforge.net/projects/slashhack/'>project + page</a> on <a + href='http://sourceforge.net'>sourceforge</a>.</p> + </td> </tr> |
|
From: Dave F. <fl...@us...> - 2004-10-21 04:29:06
|
Update of /cvsroot/slashhack/slashhack-site/about In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12825/about Modified Files: index.html Added Files: topicslashdot.gif Log Message: Finished about page --- NEW FILE: topicslashdot.gif --- (This appears to be a binary file; contents omitted.) Index: index.html =================================================================== RCS file: /cvsroot/slashhack/slashhack-site/about/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.html 20 Oct 2004 03:17:39 -0000 1.3 --- index.html 21 Oct 2004 04:28:55 -0000 1.4 *************** *** 1,23 **** <html> <head> ! <title>About SlashHack</title> </head> <body bgcolor='#000000'> ! <table cellspacing='0' cellpadding='8' border='0' bgcolor='#eeeeee'> <tr><td> - - <table cellspacing='0' cellpadding='0' border='0' width='100%'><tr bgcolor='#006666'><td valign='top'><img src='http://slashhack.sf.net/images/slc.gif'/></td><td width='100%' style='color:#ffffff;font-family:arial,geneva,sans-serif;font-weight:bolder;font-size:32px;'>about:SlashHack</td><td valign='bottom' style='color:#ffffff;font-family:arial,geneva,sans-serif;font-size:10pt;font-weight:bold;'>Updated: 10/19/04</td></tr></table> - - <p><i><b>Note:</b> This page and the SlashHack software are - currently under heavy construction.</i></p> ! <p>A cross-platform reader for <a href="http://slashdot.org">Slashdot</a>. Slashhack is written on top ! of Mozilla, and should run without modification on any platform ! which Mozilla supports.</p> ! <p><i>More detail to come...</i></p> </td></td></table> ! </body> </html> --- 1,45 ---- <html> + <head> ! <title>about:SlashHack</title> </head> + <body bgcolor='#000000'> ! <br/><br/><br/> ! ! <table align='center' cellspacing='0' cellpadding='12' border='0' bgcolor='#eeeeee' width='80%'> <tr><td> ! <table cellspacing='0' cellpadding='0' border='0'><tr bgcolor='#006666'><td valign='top'><img src='http://slashhack.sf.net/images/slc.gif'/></td><td width='100%' style='color:#ffffff;font-family:arial,geneva,sans-serif;font-weight:bolder;font-size:32px;'>about:SlashHack</td></tr></table> ! <table cellspacing='12'> ! <tr> ! <td valign='top' align='center'> ! <a href="http://slashdot.org"><img width='100' height='34' src='topicslashdot.gif' border="0"/></a> ! <br/><br/> ! <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=121780&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a> ! </td> ! <td> ! <p>A cross-platform reader for Slashdot.</p> ! ! <p>Special thanks to Rob "CmdrTaco" Malda and the rest ! of the Slashdot crew for bringing us such an inspirational ! site.</p> ! ! <p>Author: <a ! href='mailto:fl...@us...'>Dave ! Fletcher</a></p> ! ! <p>Slashhack is distributable under the <a ! href='http://www.mozilla.org/MPL/'>Mozilla Public ! License</a> (MPL)</p> ! ! </td> ! </tr> ! </table> </td></td></table> ! </body> ! </html> |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:51:20
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/icons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5407/icons Added Files: jslib-icon.png Log Message: Task #106454 - include jslib. --- NEW FILE: jslib-icon.png --- (This appears to be a binary file; contents omitted.) |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:51:20
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/jslib/skin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5407/jslib/skin Added Files: aboutDialog.css Log Message: Task #106454 - include jslib. --- NEW FILE: aboutDialog.css --- /* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is the jslib team. Original Author: Brian King <br...@mo...> Contributor(s): */ #aboutDialog { background-color: #FFFFFF; width: 33em; padding-left: 20px; padding-right: 20px; padding-top: 15px; } .linklabel { color: blue; text-decoration: underline; cursor: pointer; } #jslibVersionNum { font-weight: bold; } |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:51:20
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5407/install Added Files: install.html uninstall.css Log Message: Task #106454 - include jslib. --- NEW FILE: install.html --- <!-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): --> <html><head><title>startInstall</title> <script language="JavaScript" src="install.js"></script> <script> <!-- function launch() { var xpi = new Object(); if (isWindows()) { xpi["Java"] = "ftp://ftp.netscape.com/pub/netscape6/english/6.0/windows/win32/xpi/jre.xpi"; startInstall(xpi, 1); } else if (isLinux()) { xpi["Java"] = "ftp://ftp.netscape.com/pub/netscape6/english/6.0/unix/linux22/xpi/jre.xpi"; startInstall(xpi, 1); } else badPlatform(); } //--> </script> </head><body> <form name="installForm"> <input type=button onClick="launch();" onCommand="launch();" value="Install Java"> </form> </body></html><!--$Date: 2004/10/21 03:51:05 $ --> --- NEW FILE: uninstall.css --- /* uninstall css style sheet */ .text { font-size: larger; } |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:51:20
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/xul/locale/en-US In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5407/xul/locale/en-US Added Files: cdialog.dtd Log Message: Task #106454 - include jslib. --- NEW FILE: cdialog.dtd --- <!-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Urban Rage Software code. The Initial Developer of the Original Code is Eric Plaster. Portions created by Urban Rage Software are Copyright (C) 2001 Urban Rage Software. All Rights Reserved. Contributor(s): Eric Plaster <pl...@ur...)> (original author) $Author: fletch $ $Date: 2004/10/21 03:51:06 $ $Revision: 1.1 $ $Source: /cvsroot/slashhack/slashhack/resources/js/jslib/xul/locale/en-US/cdialog.dtd,v $ --> <!ENTITY defaultTitle.label "A Message"> |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:51:20
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/jslib/locale/en-US In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5407/jslib/locale/en-US Added Files: aboutDialog.dtd Log Message: Task #106454 - include jslib. --- NEW FILE: aboutDialog.dtd --- <!-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is the jslib team. Original Author: Brian King <br...@mo...> Contributor(s): --> <!ENTITY about.dialog.title "jsLib Mozilla JavaScript Library"> <!ENTITY about.version.label "Version number:"> <!ENTITY about.jslib.label "written by Pete Collins and the jsLib Team"> <!ENTITY about.mozdev.label1 "Hosted by"> <!ENTITY about.mozdev.label2 "mozdev.org"> |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:51:20
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/xul/skin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5407/xul/skin Added Files: cdialog.css Log Message: Task #106454 - include jslib. --- NEW FILE: cdialog.css --- /* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Urban Rage Software code. The Initial Developer of the Original Code is Eric Plaster. Portions created by Urban Rage Software are Copyright (C) 2001 Urban Rage Software. All Rights Reserved. Contributor(s): Eric Plaster <pl...@ur...)> (original author) */ @import url(chrome://global/skin/); vbox.cdialog { margin : 15px; } @namespace url(http://www.w3.org/1999/xhtml); html { font-size : 12pt; } |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:27
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/xul In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/xul Added Files: RDFTree.js appRoutines.js commonDialog.js commonFilePicker.js commonWindow.js Log Message: Task #106454 - include jslib. --- NEW FILE: commonWindow.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Mozdev Group, Inc. code. The Initial Developer of the Original Code is Pete Collins. Portions created by Mozdev Group, Inc. are Copyright (C) 2003 Mozdev Group, Inc. All Rights Reserved. Contributor(s): Pete Collins <pe...@mo...)> (original author) Henrik Gemal <http://gemal.dk> ***/ /****************** Globals **********************/ if(typeof(JS_LIB_LOADED)=='boolean') { const JS_COMMONWINDOW_FILE = "commonWindow.js"; const JS_COMMONWINDOW_LOADED = true; const JS_TOP_LEFT = 0; const JS_TOP_CENTER = 1; const JS_TOP_RIGHT = 2; const JS_MIDDLE_LEFT = 3; const JS_MIDDLE_CENTER = 4; const JS_MIDDLE_RIGHT = 5; const JS_BOTTOM_LEFT = 6; const JS_BOTTOM_CENTER = 7; const JS_BOTTOM_RIGHT = 8; const JS_UNINSTALL_URL = JS_LIB_PATH + "install/uninstall.xul"; /****************** Common Dialog Object Class *********************/ function CommonWindow(aURL, aWidth, aHeight) { if (typeof(aWidth)=="number") this.mWidth=aWidth; if (typeof(aHeight)=="number") this.mHeight=aHeight; if (typeof(aURL)=="string") this.mURL=aURL; return; } // constructor CommonWindow.prototype = { mWidth : 0, mHeight : 0, mURL : null, mPosition : JS_TOP_LEFT, mX : 0, mY : 0, set width (aWidth) { this.mWidth = aWidth; }, get width () { return this.mWidth; }, set height (aHeight) { this.mHeight = aHeight; }, get height () { return this.mHeight; }, set position (aPos) { var x,y; switch (aPos) { case JS_MIDDLE_CENTER: this.mPosition=aPos; x = Math.round(this.mWidth/2); y = Math.round(this.mHeight/2); var sY = window.screen.height/2; var sX = window.screen.width/2; jslibPrint("width: "+this.mWidth); jslibPrint("height: "+this.mHeight); jslibPrint("x: "+x+"y: "+y); jslibPrint("sX: "+sX+"sY: "+sY); this.mY = sY-y; this.mX = sX-x; jslibPrint("mX: "+this.mX); jslibPrint("mY: "+this.mY); break; default: this.mPosition=JS_TOP_LEFT; jslibDebug("not implemented yet setting to JS_TOP_LEFT for now"); } }, get position () { var rv=""; switch (this.mPosition) { case JS_TOP_LEFT: rv="JS_TOP_LEFT"; break; case JS_TOP_CENTER: rv="JS_TOP_CENTER"; break; case JS_TOP_RIGHT: rv="JS_TOP_RIGHT"; break; case JS_MIDDLE_LEFT: rv="JS_MIDDLE_LEFT"; break; case JS_MIDDLE_CENTER: rv="JS_MIDDLE_CENTER"; break; case JS_MIDDLE_RIGHT: rv="JS_MIDDLE_RIGHT"; break; case JS_BOTTOM_LEFT: rv="JS_BOTTOM_LEFT"; break; case JS_BOTTOM_CENTER: rv="JS_BOTTOM_CENTER"; break; case JS_BOTTOM_RIGHT: rv="JS_BOTTOM_RIGHT"; break; } return rv; }, set url (aURL) { this.mURL = aURL; }, get url () { return this.mURL; }, openFullScreen : function () { if (!this.mURL) return; var h = window.screen.height; var w = window.screen.width; var win_prefs = "chrome,dialog=no,width="+w+ ",height="+h+",screenX=0,screenY=0"; window.openDialog(this.mURL, "_blank", win_prefs); }, openWebTop : function () { if (!this.mURL) return; var h = window.screen.height; var w = window.screen.width; var win_prefs = "chrome,popup,scrollbars=yes,width="+w+ ",height="+h+",screenX=0,screenY=0"; jslibDebug(this.mURL+"_blank"+win_prefs); window.openDialog(this.mURL, "_blank", win_prefs); }, openUninstallWindow : function (aPackage, aCallback) { if (!aPackage) { jslibDebug("Please provide a package name to uninstall") return; } var win_prefs = "chrome,dialog,dependent=no,resize=yes,screenX="+this.mX+ ",screenY="+this.mY+ ",width="+this.mWidth+",height="+this.mHeight; window.openDialog(JS_UNINSTALL_URL, "_blank", win_prefs, aPackage, aCallback); }, openAbout : function () { if (!this.mURL) return; var h = this.mHeight; var w = this.mWidth; var win_prefs = "chrome,dialog,modal,dependent=no,resize=no,width="+w+ ",height="+h+",screenX="+this.mX+",screenY="+this.mY; window.openDialog(this.mURL, "_blank", win_prefs); }, openSplash : function () { jslibPrint("open splash . . . "); if (!this.mURL) return; var h = this.mHeight; var w = this.mWidth; var popup="popup,"; if (/Mac/g.test(window.navigator.platform)) popup=""; var win_prefs = "chrome,dialog=no,titlebar=no,"+popup+"width="+w+ ",height="+h+",screenX="+this.mX+",screenY="+this.mY; window.openDialog(this.mURL, "_blank", win_prefs); }, open : function () { if (!this.mURL) return; var win_prefs = "chrome,dialog=no,dependent=no,resize=yes,screenX="+this.mX+",screenY="+this.mY+ ",width="+this.mWidth+",height="+this.mHeight; window.openDialog(this.mURL, "_blank", win_prefs); }, openDialog : function () { if (!this.mURL) return; var win_prefs = "chrome,dialog,dependent=yes,resize=yes,screenX="+this.mX+",screenY="+this.mY+ ",width="+this.mWidth+",height="+this.mHeight; window.openDialog(this.mURL, "_blank", win_prefs); }, openModalDialog : function () { if (!this.mURL) return; var win_prefs = "chrome,dialog,dependent=no,modal,resize=yes,screenX="+this.mX+",screenY="+this.mY+ ",width="+this.mWidth+",height="+this.mHeight; window.openDialog(this.mURL, "_blank", win_prefs); }, get openWindows () { var wm = jslibGetService("@mozilla.org/appshell/window-mediator;1", "nsIWindowMediator"); jslibDebug(wm); var enumerator = wm.getEnumerator(null); var winArray = new Array(); while (enumerator.hasMoreElements()) { var domWindow = enumerator.getNext(); winArray.push(domWindow); } return winArray; }, /********************* help ***************************** * void getter help * * Returns the methods in this object * * return values on success and failure * aStr The methods in this object * * useage: * <string> = obj.help; ****************************************************/ get help() { const help = "\n\nFunction and Attribute List:\n" + "\n"; return help; } } jslibDebug('*** load: '+JS_COMMONWINDOW_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include('chrome://slashhack/content/resources/js/jslib/xul/commonWindow.js');\n\n"); }; // END FileSystem Class --- NEW FILE: RDFTree.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Urban Rage Software. The Initial Developer of the Original Code is Urban Rage Software. Portions created by Urban Rage Software are Copyright (C) 2000-2001 Urban Rage Software. All Rights Reserved. Contributor(s): Eric Plaster, Becki Sanford RDFTree API RDFTree.js Restrictions: This class is intended to make it easier to control a tree that has rdf datasources. To use this class, you will need to follow a few simple rules: (1) Your tree must have an 'id'. This is needed to find the tree and change it's attributes. (2) You must supply an 'id' for your 'treecol'. (3) Your 'treecell' under your 'treehead' must have the same 'id' as your 'treecol'+"Header". (i.e. your treecol has an id="linksColumn" and your treehead->treerow->treecell has an id="linksColumnHeader") (4) Must be an rdf tree. (5) Only supports single selection trees at this time. Function List // Constructor RDFTree(aID) // creates the Tree object and gets the tree from the ID (get) tree // tree object addDataSource(aRDF_URL_Path) // adds a datasource to the tree. Must be a valid url path (i.e. file:///tmp/bob.rdf) rebuild() // Rebuilds the tree (resets it. You need to do this when you delete an entry in an rdf file) (get) selected // returns the currently selected index. (set) selected(which) // set the selected index. (get) count // returns the number of items in the tree (get) treeitems // returns an array of treeitem elements (get) selectedID // returns the 'id' of the selected item (get) selection // returns an array of selected treeitems (get) selectCount // returns the number of selected treeitems clearSelection(which) // clears item selections; if which = null, all selections are cleared getRowIndexOf(which) // gets the index of the given treeitem 'id' doSort(column) // sorts the given column (see Notes) refreshSort() // sorts to the previous settings (see Notes) sortColumn(column, sortKey[, direction]) // sorts the given column 'id' either 'ascending' or 'descending' sortToPreviousSettings() // sorts to the previous settings. // internal members. sort(column, Key, direction) // sorts the given column 'id' either 'ascending' or 'descending' updateSortIndicator(column, direction) // Updates the sort indicator Instructions: Warning: these API's are not for religious types Notes: (1) The doSort() and refreshSort() functions require the <treecell> to contain an observes attribute that points to the <treecol> that defines the resource attribute. The following is a skeleton code snippet: <tree> <template/> <treecolgroup> <treecol id="fooName" resource="http://home.netscape.com/NC-rdf#fooName"/> </treecolgroup> <treehead> <treerow> <treecell value="Name" observes="fooName" class="sortDirectionIndicator" onclick="gShell.treeUtils.doSort('fooName')"/> </treerow> </treehead> </tree> ************/ /****************** Globals **********************/ const JSLIB_TREE = "tree.js"; const JSTREE_OK = true; const JSLIB_TREE_SORT_PROGID = '@mozilla.org/xul/xul-sort-service;1'; /****************** Globals **********************/ /****************** File Object Class *********************/ function RDFTree(aID) { if(aID) this.mID= aID; } // constructor RDFTree.prototype = { mID : null, mTree : null, get tree() { if (this.mTree) return this.mTree; var tree = document.getElementById(this.mID); if(!tree) { throw("Unable to get tree. ID: "+this.mID); } this.mTree = tree; return tree; }, addDataSource : function(aRDF_URL_Path) { var tree = this.tree; var ds = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService().QueryInterface(Components.interfaces.nsIRDFService).GetDataSource(aRDF_URL_Path); tree.database.AddDataSource(ds); tree.builder.rebuild(); }, removeDataSource : function(aRDF_URL_Path) { var tree = this.tree; var ds = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService().QueryInterface(Components.interfaces.nsIRDFService).GetDataSource(aRDF_URL_Path); tree.database.RemoveDataSource(ds); tree.builder.rebuild(); }, focus : function() { this.tree.focus(); }, blur : function() { this.tree.blur(); }, rebuild : function() { this.tree.builder.rebuild(); }, get selected() { if (this.tree.treeBoxObject.selection == null) return -1; return (this.tree.treeBoxObject.selection.currentIndex); }, get selectCount() { if (this.tree.treeBoxObject.selection == null) return 0; return (this.tree.treeBoxObject.selection.count); }, set selected(index) { // Don't attempt to make any selections on an empty tree if (this.tree.treeBoxObject.view == null) return; this.tree.treeBoxObject.selection.select(index); // Give the tree focus (this will also allow the user to immediately // use the up/dopwn arrows -- bonus points!) this.tree.focus(); }, get count() { if (this.tree.treeBoxObject.view == null) return 0; return (this.tree.treeBoxObject.view.rowCount); }, get treeitems() { return (this.tree.treeBoxObject.view); }, get selectedID() { // dump("--[ selectedID ]-- selectCount="+ this.selectCount +" selected="+ this.selected +"\n"); if (this.selectCount == 0 || this.selected == -1) return null; var element = this.tree.contentView.getItemAtIndex( this.selected ); return element.getAttribute('id'); }, get selection() { // NOTES: // (1) This returns an nsITreeSelection element. Use getSelectedIDs() // to get a list of IDs. return this.tree.treeBoxObject.selection; }, get getSelectedIDs() { var selectionArray = new Array(); // Get the current selection var selection = this.selection; var rangeCount = selection.getRangeCount(); // The rangeCount represents the number of different groups of selections // (i.e. there may be gaps in the selection) for (var range = 0; range < rangeCount; ++range) { var min = {}, max = {}; selection.getRangeAt(range, min, max); for (var index = min.value; index <= max.value; ++index) { var item = this.tree.contentView.getItemAtIndex(index); selectionArray.push( item.getAttribute('id') ); } } return selectionArray; }, clearSelection : function(index) { if (index != null) { this.tree.treeBoxObject.selection.clearRange( index,index ); } else { this.tree.treeBoxObject.selection.clearSelection(); } }, getRowIndexOf : function(which) { var element = document.getElementById(which); var index = this.tree.contentView.getIndexOfItem( element ); return index; }, //------------------------------------------------------------------------ // Column sort utilities //------------------------------------------------------------------------ doSort : function(column) { var tree = this.tree; var node = document.getElementById(column); if (!node) return false; var sortKey = node.getAttribute('resource'); if (!sortKey) return false; var sortDirection = "ascending"; if ( node.getAttribute('sortDirection') == "ascending" ) sortDirection = "descending"; else sortDirection = "ascending"; this.updateSortIndicator(column, sortDirection); this.sort(column, sortKey, sortDirection); // Save the current sort settings for use by SortToPreviousSettings() tree.setAttribute('sortColumn',column); tree.setAttribute('sortKey',sortKey); tree.setAttribute('sortDirection',sortDirection); node.setAttribute('sortDirection',sortDirection); return true; }, //------------------------------------------------------------------------ refreshSort : function() { // Retrieve the last sorted state from the tree element var tree = this.tree; var column = tree.getAttribute('sortColumn'); var node = document.getElementById(column); var sortKey = node.getAttribute('resource'); var sortDirection = node.getAttribute('sortDirection'); this.sort(column, sortKey, sortDirection); // Force the button states to be updated by giving the tree focus // (this will also allow the user to immediately use the up/down // arrows --- bonus points!) tree.focus(); }, //------------------------------------------------------------------------ sortColumn : function(column, sortKey, direction) { var tree = this.tree; var node = document.getElementById(column); if (!node) return false; // If a specific direction passed in as a parameter, use it; otherwise // get the last sort direction from the tree node (defaulting to // "ascending" if none available) var sortDirection; if (direction != null) { sortDirection = direction; } else { sortDirection = "ascending"; if ( node.getAttribute('sortDirection') == "ascending" ) sortDirection = "descending"; else sortDirection = "ascending"; } this.updateSortIndicator(column, sortDirection); this.sort(column, sortKey, sortDirection); // Save the current sort settings for use by SortToPreviousSettings() tree.setAttribute('sortColumn',column); tree.setAttribute('sortKey',sortKey); tree.setAttribute('sortDirection',sortDirection); node.setAttribute('sortDirection',sortDirection); this.rebuild(); return true; }, //------------------------------------------------------------------------ sort : function(column, key, direction) { var xulSortService = Components.classes[JSLIB_TREE_SORT_PROGID].getService(); xulSortService = xulSortService.QueryInterface(Components.interfaces.nsIXULSortService); if (!xulSortService) return (false); var node = document.getElementById(column); if ( node ) { try { xulSortService.Sort(node, key, direction); } catch (ex) {} } }, //------------------------------------------------------------------------ sortToPreviousSettings : function() { var tree = this.tree; // Retrieve the last sorted state from the tree element var column = tree.getAttribute('sortColumn'); var sortKey = tree.getAttribute('sortKey'); var sortDirection = tree.getAttribute('sortDirection'); // Provide default sort data if none was d if ( !column || !sortKey ) { return; } if ( !sortDirection ) sortDirection = 'ascending'; this.updateSortIndicator(column,sortDirection); this.sort(column, sortKey, sortDirection); }, //------------------------------------------------------------------------ // Sets the column header sort icon based on the requested // column and direction. // // Notes: // (1) This function relies on the first part of the // <treecell id> matching the <treecol id>. The treecell // id must have a "Header" suffix. // (2) By changing the "sortDirection" attribute, a different // CSS style will be used, thus changing the icon based on // the "sortDirection" parameter. //------------------------------------------------------------------------ updateSortIndicator : function(column,sortDirection) { // set the sort indicator on the column we are sorted by if (column) { var sortedColumn = document.getElementById(column); if (sortedColumn) { sortedColumn.setAttribute("sortDirection",sortDirection); // remove the sort indicator from all the columns // except the one we are sorted by var currCol = sortedColumn.parentNode.firstChild; while (currCol) { if (currCol != sortedColumn && currCol.localName == "treecol") { currCol.removeAttribute("sortDirection"); } currCol = currCol.nextSibling; } } } } }; --- NEW FILE: appRoutines.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Mozdev Group, Inc. code. The Initial Developer of the Original Code is Pete Collins. Portions created by Mozdev Group, Inc. are Copyright (C) 2003 Mozdev Group, Inc. All Rights Reserved. Contributor(s): Pete Collins <pe...@mo...)> (original author) ***/ /****************** Globals **********************/ if(typeof(JS_LIB_LOADED)=='boolean') { const JS_APPROUTINES_FILE = "appRoutines.js"; const JS_APPROUTINES_LOADED = true; /****************** Common Application Routines *********************/ /**************************** QUIT **********************************/ function quit() { try { var windowManager = C.classes['@mozilla.org/appshell/window-mediator;1'] .getService(C.interfaces.nsIWindowMediator); var enumerator = windowManager.getEnumerator(null); // we are only closing dom windows for now // var appShell = C.classes['@mozilla.org/appshell/appShellService;1'].getService(); // appShell = appShell.QueryInterface(C.interfaces.nsIAppShellService); while (enumerator.hasMoreElements()) { var domWindow = enumerator.getNext(); if (("tryToClose" in domWindow) && !domWindow.tryToClose()) return false; domWindow.close(); } // we are only closing dom windows for now // appShell.quit(C.interfaces.nsIAppShellService.eAttemptQuit); } catch (e) { jslibPrint(e); } return true; } /**************************** QUIT **********************************/ jslibDebug('*** load: '+JS_APPROUTINES_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include('chrome://slashhack/content/resources/js/jslib/xul/appRoutines.js');\n\n"); }; // END FileSystem Class --- NEW FILE: commonDialog.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Urban Rage Software code. The Initial Developer of the Original Code is Eric Plaster. Portions created by Urban Rage Software are Copyright (C) 2000 Urban Rage Software. All Rights Reserved. Contributor(s): Eric Plaster <pl...@ur...)> (original author) ***/ // // The idea behind these globals, is that it's easier to catch a spelling mistake // from a javascript error, rather then just a silent bug. For example if you typed 'bob' // for the type, everything would work, except the dialog wouldn't have an image. // /****************** Globals **********************/ /**** User defines (to make it easier for the user) ****/ const JS_CD_MESSAGE = "message"; const JS_CD_ALERT = "alert"; const JS_CD_ERROR = "error"; const JS_CD_QUESTION = "question"; const JS_CD_YESNO = "yesno"; const JS_CD_YES = "yes"; const JS_CD_NO = "no"; const JS_CD_OKCANCEL = "okcancel"; const JS_CD_OK = "ok"; const JS_CD_CANCEL = "cancel"; const JS_CD_RIGHT = "right"; const JS_CD_LEFT = "left"; const JS_CD_CENTER = "center"; /**** Internal consts ****/ const JS_CD_BTN_OK = "OK"; const JS_CD_BTN_CANCEL = "Cancel"; const JS_CD_BTN_YES = "Yes"; const JS_CD_BTN_NO = "No"; const JS_CD_FILE = "commonDialog.js"; /****************** Globals **********************/ if(typeof(JS_LIB_LOADED)=='boolean') { /****************** Common Dialog Object Class *********************/ function CommonDialog(aType, aButtontype, aButtonAlign) { return this.initDialog(aType, aButtontype, aButtonAlign); } // constructor CommonDialog.prototype = { mDialogArgs : null, mDone : false, /********************* INIT Dialog ************************ * void initDialog * * INTERNAL MEMBER FUNCTION * This initializes the object and sets the type, buttonType * and buttonAlign for the object (if passed in). * * param name and discription * aType A dialog type. * aButtonType A "pre-built" set of buttons * aButtonAlign A button alignment * * return values on success and failure * NA * * useage: * this.initDialog(type, buttontype, buttonalign); ****************************************************/ initDialog : function(aType, aButtonType, aButtonAlign) { this.mDialogArgs = new Object; if(aType) { this.type = aType; } if(aButtonType) { this.buttonType = aButtonType; } if(aButtonAlign) { this.mDialogArgs.buttonalign = aButtonAlign; } // set the left most button as the default button. this.buttonDefault = 0; }, /********************* Type ************************ * void getter Type * * Returns a valid dialog type (if set), null otherwise. * Types can be: JS_CD_MESSAGE, JS_CD_ALERT, JS_CD_ERROR * or JS_CD_QUESTION * * return values on success and failure * A valid type or null if unset. * * useage: * <type> = obj.type; * ****************************************************/ get type() { return this.mDialogArgs.type; }, /********************* Type ************************ * void setter Type * * Sets the type of dialog. Types can be: * JS_CD_MESSAGE, JS_CD_ALERT, JS_CD_ERROR or JS_CD_QUESTION * * This really only changes the icon, but may change other attributes * in the future. * * param name and discription * aType A dialog type. * * return values on success and failure * NA * useage: * obj.type = <type> ****************************************************/ set type(aType) { if(!aType) { jslibError(null, "Missing argument\n", "NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_CD_FILE+": set type"); throw Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } this.mDialogArgs.type = aType; }, /********************* buttonType ************************ * void setter buttonType * * Sets the buttons to one of the "pre-built" buttons: * JS_CD_MESSAGE, JS_CD_ALERT, JS_CD_ERROR or JS_CD_QUESTION. * * param name and discription * aType A "pre-built" set of buttons * * return values on success and failure * NA * useage: * obj.buttonType = <type> ****************************************************/ set buttonType(aType) { if(!aType) { jslibError(null, "Missing argument\n", "NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_CD_FILE+": set buttonType"); throw Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } this.mDialogArgs.buttonList = new Array; if(aType == JS_CD_OKCANCEL) { this.mDialogArgs.buttonList[0] = JS_CD_BTN_OK; this.mDialogArgs.buttonList[1] = JS_CD_BTN_CANCEL; } else if(aType == JS_CD_OK) { this.mDialogArgs.buttonList[0] = JS_CD_BTN_OK; } else if(aType == JS_CD_CANCEL) { this.mDialogArgs.buttonList[0] = JS_CD_BTN_CANCEL; } else if(aType == JS_CD_YESNO) { this.mDialogArgs.buttonList[0] = JS_CD_BTN_YES; this.mDialogArgs.buttonList[1] = JS_CD_BTN_NO; } else if(aType == JS_CD_YES) { this.mDialogArgs.buttonList[0] = JS_CD_BTN_YES; } else if(aType == JS_CD_NO) { this.mDialogArgs.buttonList[0] = JS_CD_BTN_NO; } }, /********************* defaultButton ************************ * void getter defaultButton * * Returns the number coresponding to the default button. * Buttons are numbered from left to right starting with zero. * * return values on success and failure * aNumber The number coresponding to the default button * * useage: * <number> = obj.defaultButton; ****************************************************/ get defaultButton() { return this.mDialogArgs.defaultButton; }, /********************* defaultButton ************************ * void setter defaultButton * * Sets he number coresponding to the default button. Buttons * are numbered from left to right starting with zero. * * param name and discription * aNum A number coresponding to the default button. * * return values on success and failure * NA * * useage: * obj.buttonType = <type> ****************************************************/ set defaultButton(aNum) { if(!aNum) { jslibError(null, "Missing argument\n", "NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_CD_FILE+": set defaultButton"); throw Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } this.mDialogArgs.defaultButton = aNum; }, /********************* message ************************ * void getter message * * Returns the current message that is displayed to the user. * * return values on success and failure * aMessage The current message. * * useage: * <string> = obj.message; ****************************************************/ get message() { return this.mDialogArgs.message; }, /********************* message ************************ * void setter message * * Sets the current message. * * param name and discription * aMessage A string to set the message to. * * return values on success and failure * NA * * useage: * obj.message = <string> ****************************************************/ set message(aMessage) { if(!aMessage) { jslibError(null, "Missing argument\n", "NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_CD_FILE+": set message"); throw Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } this.mDialogArgs.message = aMessage; }, /********************* buttonAlign ************************ * void getter buttonAlign * * Returns the current alignment: JS_CD_LEFT, JS_CD_CENTER, * JS_CD_RIGHT. * * return values on success and failure * aAlign Current button alignment * * useage: * <alignment> = obj.buttonAlign; ****************************************************/ get buttonAlign() { return this.mDialogArgs.buttonalign; }, /********************* buttonAlign ************************ * void setter buttonAlign * * Sets the current alignment: JS_CD_LEFT, JS_CD_CENTER, * JS_CD_RIGHT. * * param name and discription * aAlign A button alignment * * return values on success and failure * NA * * useage: * obj.buttonAlign = <alignment> ****************************************************/ set buttonAlign(aAlignment) { if(!aAlignment) { jslibError(null, "Missing argument\n", "NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_CD_FILE+": set buttonAlign"); throw Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } this.mDialogArgs.buttonalign = aAlignment; }, /********************* appendButton ************************ * void setter appendButton * * Creates a button and appends it to the right side of the * existing buttons. * * param name and discription * aLabel The label for the button * aDefault (optional) set to "true" if it is the default * button. * * return values on success and failure * NA * * useage: * obj.appendButton(label, true); ****************************************************/ appendButton : function (aLabel, aDefault) { if(!aLabel) { jslibError(null, "Missing argument\n", "NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_CD_FILE+": set appendButton"); throw Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } if(!this.mDialogArgs.buttonList) { this.mDialogArgs.buttonList = new Array; } this.mDialogArgs.buttonList.push(aLabel); if(aDefault) { this.defaultButton = this.mDialogArgs.buttonList.length -1; } }, /********************* title ************************ * void getter title * * Returns the current dialog title. * * return values on success and failure * aTitle Current dialog title. * * useage: * <string> = obj.title; ****************************************************/ get title() { return this.mDialogArgs.title; }, /********************* title ************************ * void setter buttonAlign * * Sets the current dialog title. * * param name and discription * aTitle Sets the current dialog title. * * return values on success and failure * NA * * useage: * obj.title = <string> ****************************************************/ set title(aTitle) { if(!aTitle) { jslibError(null, "Missing argument\n", "NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_CD_FILE+": set appendButton"); throw Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } this.mDialogArgs.title = aTitle; }, /********************* show ************************ * void show * * Creates the dialog and waits for a button push. * * param name and discription * NA * * return values on success and failure * aNumber Returns the button that was clicked. * * useage: * <number> = obj.show(); ****************************************************/ show : function () { window.openDialog("chrome://slashhack/content/resources/js/jslib/xul/content/cdialog.xul", "_blank","chrome,resizeable=no,modal,titlebar,close", this.mDialogArgs); this.mDone = true; return this.mDialogArgs.buttonHit; }, /********************* result ***************************** * void getter result * * Returns an object with two members: object.id and * object.text. "id" is the number ot the button that * was pushed and "label" was the buttons label. * * return values on success and failure * aObj An object with the button that was pushed and * the label of that button. * * useage: * var rv = obj.result; * var which = rv.id; * var text = rv.text; ****************************************************/ get result() { if (this.mDone) { var rv = new Object; rv.id = this.mDialogArgs.buttonHit; rv.text = this.mDialogArgs.buttonHitText; return rv; } else { return null; } }, /********************* help ***************************** * void getter help * * Returns the methods in this object * * return values on success and failure * aStr The methods in this object * * useage: * <string> = obj.help(); ****************************************************/ help : function() { const help = "\n\nFunction and Attribute List:\n" + "\n" + " initDialog(aType, aButtonType, aButtonAlign);\n" + " type = aType;\n" + " buttonType = aButtonType;\n" + " defaultButton = aNum;\n" + " message = aMessage;\n" + " buttonAlign = aAlignment;\n" + " appendButton(aLabel, aDefault);\n" + " title = aTitle;\n" + " show();\n" + " result;\n" return help; } } } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include('chrome://slashhack/content/resources/js/jslib/xul/commonDialog.js');\n\n"); }; // END FileSystem Class --- NEW FILE: commonFilePicker.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Mozdev Group, Inc. code. The Initial Developer of the Original Code is Pete Collins. Portions created by Mozdev Group, Inc. are Copyright (C) 2003 Mozdev Group, Inc. All Rights Reserved. Contributor(s): Pete Collins <pe...@mo...> (original author) ***/ /****************** Globals **********************/ if (typeof(JS_LIB_LOADED)=='boolean') { /************* INCLUDE DIR *****************/ if (typeof(JS_DIR_LOADED)!='boolean') include(jslib_dir); /************* INCLUDE DIR *****************/ const JS_COMMONFILEPICKER_FILE = "commonFilePicker.js"; const JS_COMMONFILEPICKER_LOADED = true; const JS_CFP_CID = "@mozilla.org/filepicker;1"; const JS_I_CFP = "nsIFilePicker"; /****************** Common File Picker Functions *********************/ function getFilePicker () { return jslibCreateInstance(JS_CFP_CID, JS_I_CFP); } /********************************************** * * * Both arguments are optional * * * * aDir * * can be either directory path string * * eg: "/tmp" * * or and nsIFile object * * * * aNewFileName * * a new file name string * * eg: "myfile.xul" * * * **********************************************/ function saveAsXUL (aDir, aNewFileName) { var fp = getFilePicker(); fp.init(window, "SaveAsXULFile", 1); fp.appendFilters(C.interfaces.nsIFilePicker.filterXUL); fp.defaultString= aNewFileName ? aNewFileName : "new_file.xul"; if (aDir) { if (typeof(aDir)=="object" && aDir.toString().match("nsIFile")) { if (!aDir.exists()) { jslibDebug("Dir: "+aDir.path+" doesn't exist"); return null; } if (!aDir.isDirectory()) { jslibDebug("Dir: "+aDir.path+" is not a directory"); return null; } fp.displayDirectory = aDir; } if (typeof(aDir)=="string") { jslibPrint("here"); var d = new Dir(aDir); if (!d.exists()) { jslibDebug("Dir: "+d.path+" doesn't exist"); return null; } fp.displayDirectory = d.nsIFile; } } fp.show(); return (fp.file.path.length > 0 ? fp.file.path : null); } jslibDebug('*** load: '+JS_COMMONFILEPICKER_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_filepicker);\n\n"); }; // END FileSystem Class |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:27
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/zip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/zip Added Files: zip.js Log Message: Task #106454 - include jslib. --- NEW FILE: zip.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): ***/ if (typeof(JS_LIB_LOADED)=='boolean') { /****************** Globals **********************/ const JS_ZIP_LOADED = true; const JS_ZIP_FILE = "zip.js"; const JS_ZIP_CID = "@mozilla.org/libjar/zip-reader;1"; const JS_ZIP_I_ZIP_READER = "nsIZipReader"; const JS_ZIP_FILE_CID = "@mozilla.org/file/local;1"; const JS_ZIP_I_LOCAL_FILE = "nsILocalFile"; const JS_ZIP_FILE_INIT = "initWithPath"; function Zip (aZipFile) { if (!aZipFile) return jslibErrorMsg("NS_ERROR_XPC_NOT_ENOUGH_ARGS"); // sanity check for nsIFile obj, File obj, or string path arg if (jslibTypeIsObj(aZipFile)) { // see if it is a jslib obj or nsIFile if (!jslibTypeIsUndef(aZipFile.nsIFile)) this.mZipFile = aZipFile.nsIFile; else this.mZipFile = aZipFile; } else if (jslibTypeIsStr(aZipFile)) { this.mZipFile = new this.ZipPath(aZipFile); } if (!this.mZipFile.exists()) return jslibErrorMsg("NS_ERROR_FILE_NOT_FOUND", this.mZipFile.path); this.init(); } Zip.prototype = { ZipReader : new C.Constructor(JS_ZIP_CID, JS_ZIP_I_ZIP_READER), ZipPath : new C.Constructor(JS_ZIP_FILE_CID, JS_ZIP_I_LOCAL_FILE, JS_ZIP_FILE_INIT), DIRECTORY : 0x01, // 1 mPerm : 0755, FINISHED : "*** FINISHED . . . .", mInit : false, mZipFile : null, mZip : null, mIsOpen : false, // initialize the zip reader // ********************************* init : function () { try { this.mZip = new this.ZipReader(); this.mZip.init(this.mZipFile); this.mInit = true; this.open(); } catch (e) { return jslibError(e); } }, // ********************************* // open zip file // ********************************* open : function () { if (!this.mInit) this.init(); if (this.mIsOpen) return; try { this.mZip.open(); } catch (e) { return jslibError(e); } this.mIsOpen = true; }, // ********************************* // close zip file // ********************************* close : function () { if (!this.mInit) return jslibErrorMsg("NS_ERROR_NOT_INITIALIZED"); if (!this.mIsOpen) return; try { this.mZip.close(); } catch (e) { return jslibError(e); } this.mInit = false; this.mIsOpen = false; }, // ********************************* // extract zip archive // ********************************* extract : function (aDest, aDomEl) { if (!this.mInit) return jslibErrorMsg("NS_ERROR_NOT_INITIALIZED"); if (arguments.length < 1) return jslibErrorMsg("NS_ERROR_INVALID_ARG"); else if (!aDest) return jslibErrorMsg("NS_ERROR_FILE_TARGET_DOES_NOT_EXIST"); var rv = JS_LIB_OK; var dest; // sanity check for nsIFile objects string path args if (jslibTypeIsObj(aDest)) dest = aDest; else if (jslibTypeIsStr(aDest)) dest = new this.ZipPath(aDest); var entry; var newDir; try { if (!dest.exists() || !dest.isDirectory()) dest.create( this.DIRECTORY, this.mPerm); jslibDebug("\nExtracting:\t"+this.mZipFile.path+"\nTo:\t\t"+dest.path+" . . . \n\n"); var entries = this.findEntries("*"); var destbase = new this.ZipPath(dest.path); while (entries.hasMoreElements()) { entry = jslibQI(entries.getNext(), "nsIZipEntry"); dest = new this.ZipPath(dest.path); dest.setRelativeDescriptor(destbase, entry.name); // create if entry is a dir if (!dest.exists() && entry.name.length - 1 == entry.name.lastIndexOf("/")) { dest.create(this.DIRECTORY, this.mPerm); continue; } else if (!dest.parent.exists()) { dest.parent.create(this.DIRECTORY, this.mPerm); } else if (dest.exists()) { continue; } if (aDomEl) aDomEl.value = "extracting: "+dest.leafName; jslibDebug("extracting: ["+entry.name+"] To: ["+dest.path+"]"); this.mZip.extract(entry.name, dest); } } catch (e) { rv = jslibError(e); } jslibDebug("\n\n"+this.FINISHED+"\n\n"); if (aDomEl) aDomEl.value = this.FINISHED; return rv; }, // ********************************* // returns simple enumerator whose elements are of type nsIZipEntry // ********************************* findEntries : function (aPattern) { if (!aPattern) return jslibErrorMsg("NS_ERROR_INVALID_ARG"); if (!this.mInit) return jslibErrorMsg("NS_ERROR_NOT_INITIALIZED"); var rv = null; try { rv = this.mZip.findEntries(aPattern); } catch (e) { rv = jslibError(e); } return rv; }, // ********************************* // returns array of entries found w/ aPattern // ********************************* getEntries : function (aPattern) { if (!aPattern) return jslibErrorMsg("NS_ERROR_INVALID_ARG"); if (!this.mInit) return jslibErrorMsg("NS_ERROR_NOT_INITIALIZED"); var rv = new Array(); try { var entries = this.findEntries(aPattern); while (entries.hasMoreElements()) { var entry = jslibQI(entries.getNext(), "nsIZipEntry"); rv.push(entry.name); } } catch (e) { jslibError(e); } return rv; }, // ********************************* // returns nsIFile object of initialized zip file // ********************************* get file () { if (!this.mInit) return jslibErrorMsg("NS_ERROR_NOT_INITIALIZED"); return this.mZip.file; }, // ********************************* // reads a zip entry // ********************************* readEntry : function (aZipEntry) { if (!aZipEntry) return jslibErrorMsg("NS_ERROR_INVALID_ARG"); if (!this.mInit) return jslibErrorMsg("NS_ERROR_NOT_INITIALIZED"); var rv; try { var sis = jslibCreateInstance("@mozilla.org/scriptableinputstream;1", "nsIScriptableInputStream"); sis.init(this.getInputStream(aZipEntry)); rv = sis.read(sis.available()); sis.close(); } catch (e) { rv = jslibError(e); } return rv; }, // ********************************* // returns input stream containing contents of specified zip entry // ********************************* getInputStream : function (aZipEntry) { if (!aZipEntry) return jslibErrorMsg("NS_ERROR_INVALID_ARG"); if (!this.mInit) return jslibErrorMsg("NS_ERROR_NOT_INITIALIZED"); var rv; try { rv = this.mZip.getInputStream(aZipEntry); } catch (e) { rv = jslibError(e); } return rv; } // ********************************* } // END Zip CLASS jslibDebug('*** load: '+JS_ZIP_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, jslibDebug this error. else { dump("JS_FILE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_zip);\n\n"); } |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:27
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/xul/content In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/xul/content Added Files: cdialog.js cdialog.xul Log Message: Task #106454 - include jslib. --- NEW FILE: cdialog.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Urban Rage Software code. The Initial Developer of the Original Code is Eric Plaster. Portions created by Urban Rage Software are Copyright (C) 2001 Urban Rage Software. All Rights Reserved. Contributor(s): Eric Plaster <pl...@ur...)> (original author) */ var gOptions = null; var gButtonList = null; function onStartupLoad() { if (window.arguments && window.arguments[0]) { gOptions = window.arguments[0]; setupImage(); setupMessage(); setupButtons(); if (gOptions.title) setTimeout("setupTitle();", 10); } } //---------------------------------------------------------------------------------- function setupImage() { // setup the image... if (gOptions.type) { var imagebox = document.getElementById("imageBox"); var image = document.createElement("image"); if (gOptions.type == "message") { image.setAttribute("class", "message-icon"); } else if (gOptions.type == "alert") { image.setAttribute("class", "alert-icon"); } else if (gOptions.type == "error") { image.setAttribute("class", "error-icon"); } else if (gOptions.type == "question") { image.setAttribute("class", "question-icon"); } imagebox.appendChild(image); } } function setupMessage() { // setup up the text... if (gOptions.message) { try { var el = document.getElementById("messageText"); el.firstChild.data = gOptions.message; } catch (e) { dump(e); } } } function setupButtons() { var align = "center"; var bbox = document.getElementById("buttonBox"); gButtonList = new Array; // set up the buttons. if (gOptions.buttontype) { if (gOptions.buttontype == "okcancel") { gButtonList[0] = "OK"; gButtonList[1] = "Cancel"; } else if (gOptions.buttontype == "ok") { gButtonList[0] = "OK"; } else if (gOptions.buttontype == "cancel") { gButtonList[0] = "Cancel"; } else if (gOptions.buttontype == "yesno") { gButtonList[0] = "Yes"; gButtonList[1] = "No"; } else if (gOptions.buttontype == "yes") { gButtonList[0] = "Yes"; } else if (gOptions.buttontype == "no") { gButtonList[0] = "No"; } } else { gButtonList = gOptions.buttonList; } if (!gOptions.defaultButton) { gOptions.defaultButton = gButtonList.length -1; } if (gOptions.buttonalign) { align = gOptions.buttonalign; } // left spring var lspring = document.createElement("spacer"); if (align == "left") { lspring.setAttribute("style", "width: 10px;"); } else { lspring.setAttribute("flex", "1"); } bbox.appendChild(lspring); // buttons... for(i=0; i<gButtonList.length; i++) { var button = document.createElement("button"); button.setAttribute("label", gButtonList[i]); button.setAttribute("style", "left-margin: 5px; right-margin:5px;"); button.setAttribute("oncommand", "doButton("+i+");"); button.setAttribute("bnum", i); button.setAttribute("id", "bID"+i); if (i == gOptions.defaultButton) { button.setAttribute("default", "true"); } bbox.appendChild(button); } // right spring var rspring = document.createElement("spacer"); if (align == "right") { rspring.setAttribute("style", "width: 10px;"); } else { rspring.setAttribute("flex", "1"); } bbox.appendChild(rspring); button = document.getElementById("bID"+gOptions.defaultButton); if (button) { button.focus(); } } //---------------------------------------------------------------------------------- function setupTitle() { window.title = gOptions.title; } function doButton(which) { var button = document.getElementById("bID"+which); if (button) { gOptions.buttonHitText = button.getAttribute("label"); gOptions.buttonHit = button.getAttribute("bnum"); window.close(); } } function doEnter() { var button = document.getElementById("bID"+gOptions.defaultButton); gOptions.buttonHitText = button.getAttribute("label"); gOptions.buttonHit = button.getAttribute("bnum"); window.close(); } function doEsc() { gOptions.buttonHit = "_none_"; window.close(); } --- NEW FILE: cdialog.xul --- <?xml version="1.0"?> <!-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Urban Rage Software code. The Initial Developer of the Original Code is Eric Plaster. Portions created by Urban Rage Software are Copyright (C) 2001 Urban Rage Software. All Rights Reserved. Contributor(s): Eric Plaster <pl...@ur...)> (original author) $Author: fletch $ $Date: 2004/10/21 03:49:16 $ $Revision: 1.1 $ $Source: /cvsroot/slashhack/slashhack/resources/js/jslib/xul/content/cdialog.xul,v $ --> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://slashhack/content/resources/js/jslib/xul/skin/cdialog.css" type="text/css"?> <!DOCTYPE window [ <!ENTITY % cdialogDTD SYSTEM "chrome://slashhack/content/resources/js/jslib/xul/locale/en-US/cdialog.dtd" > %cdialogDTD; ]> <window id="cdialog" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="&defaultTitle.label;" onload="onStartupLoad();" width="400" height="150" class="dialog" orient="vertical" persist="screenX screenY" screenX="24" screenY="24"> <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/xul/content/cdialog.js"/> <keyset> <key keycode="VK_ENTER" oncommand="doEnter();"/> <key keycode="VK_RETURN" oncommand="doEnter();"/> <key keycode="VK_ESCAPE" oncommand="doEsc();"/> </keyset> <hbox> <vbox class="cdialog" id="imageBox"/> <separator orient="vertical" class="thin"/> <vbox class="cdialog" id="messageBox" flex="1"> <description id="messageText">Message Here</description> </vbox> </hbox> <spacer flex="1"/> <separator class="groove"/> <hbox id="buttonBox"/> </window> |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:26
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/samples Added Files: file.xul remotefile.xul socket.xul test.xul webtop.xul webtop_sample.xul Log Message: Task #106454 - include jslib. --- NEW FILE: socket.xul --- <?xml version="1.0"?> <!DOCTYPE window> <window id="jslib-socket-test" title="jslib Socket Test" style="background-color: #cccccc; width: 500px;" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="initialize();" > <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/jslib.js" /> <script type="application/x-javascript"> try { // enablePrivilege is required if not running chrome'd // (other tweaks might apply, check out public.mozdev.jslib) netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); include(jslib_socket); } catch( e ) { alert( e ); } var gSocket = new Socket; var hostElement; var portElement; var sendMsg; var socketResults; var statusMsg; function initialize() { hostElement = document.getElementById( "host" ); portElement = document.getElementById( "port" ); sendMsg = document.getElementById( "sendMsg" ); socketResults = document.getElementById( "socketResults" ); statusMsg = document.getElementById( "statusMsg" ); } function closeSocket( theSocket ) { theSocket.close(); statusMsg.value = "socket was closed"; } function openSocket( theSocket ) { if( theSocket.isConnected ) return; var host = hostElement.value; var port = portElement.value; if( theSocket.open( host, port, true ) ) statusMsg.value = "socket was opened...maybe"; else statusMsg.value = "surprise! socket was NOT opened"; } function receiveSocket( theSocket ) { socketData = theSocket.read( theSocket.available() ); socketResults.value = "[" + socketData + "]\nLength: " + socketData.length; } function sendSocket( theSocket ) { theMsg = sendMsg.value; theSocket.write( theMsg ); statusMsg.value = "sent [" + theMsg + "]"; } function testSocket( theSocket ) { availableBytes = theSocket.available(); statusMsg.value = "socket has " + availableBytes + " bytes waiting"; return availableBytes; } </script> <hbox> <vbox flex="1"> <hbox> <label control="host" value="Host:"/> <textbox id="host" value="127.0.0.1" /> </hbox> <hbox> <label control="port" value="Port:"/> <textbox id="port" value="80" /> </hbox> <hbox> <label control="statusMsg" value="Status:"/> <textbox id="statusMsg" value="" flex="1" /> </hbox> <hbox> <label control="sendMsg" value="Send:"/> <textbox id="sendMsg" value="" flex="1" /> </hbox> <hbox> <label control="socketResults" value="Response:"/> <textbox id="socketResults" value="" flex="1" /> </hbox> </vbox> <vbox flex="0" > <spacer flex="1" /> <button label="Open" oncommand="openSocket( gSocket );" /> <button label="Send" oncommand="sendSocket( gSocket );" /> <button label="Receive" oncommand="receiveSocket( gSocket );" /> <button label="Test" oncommand="testSocket( gSocket );" /> <button label="Close" oncommand="closeSocket( gSocket );" /> <spacer flex="1" /> </vbox> </hbox> </window> --- NEW FILE: test.xul --- <?xml version="1.0"?> <!DOCTYPE window> <window id="jslib-test" style="background-color: #cccccc; width: 100px; height: 100px;" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/jslib.js" />; <script type="application/x-javascript"> <![CDATA[ /******************************** include (jslib_dir); include (jslib_dirutils); var du = (new DirUtils()).getTmpDir(); var t = new Dir(du); jslibPrint(t.path) var x = t; var y = x.append("test"); jslibPrint(t.path) ****************************/ function test () { /******************************** // a test for windows var d = new Dir("C:\\"); var dirList = d.readDir(); jslibPrint(d.path); jslibPrint(d.exists()); var dirs = new Array(); var files = new Array(); for (var i=0;i<dirList.length;i++) dirList[i].isDir() ? dirs.push(dirList[i]) : files.push(dirList[i]); dirs.sort(); files.sort(); dirList = new Array(); for (i=0;i<dirs.length;i++) dirList.push(dirs[i]); for (i=0;i<files.length;i++) dirList.push(files[i]); for (i=0;i<dirList.length;i++) jslibPrint(dirList[i].path); ********************************/ } ]]> </script> <vbox flex="1" pack="center"> <spacer flex="1" /> <button label="Dir Read" oncommand="alert(window.arguments);" /> <spacer flex="1" /> </vbox> </window> --- NEW FILE: remotefile.xul --- <?xml version="1.0"?> <!DOCTYPE window> <window id="jslib-remotefile-test" style="background-color: #cccccc; width: 200px; height: 100px;" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/jslib.js" />; <script type="application/x-javascript"> <![CDATA[ jslibTurnDumpOn(); include (jslib_remotefile); function test () { jslibTurnDumpOn(); var rf = new XMLHttpRequest(); jslibPrint(rf); rf.open("GET", "http://www.mozillazine.org", true); rf.overrideMimeType("text/xml"); function loaded () { jslibPrint("Poll"); if (rf.readyState != 4) return; jslibPrint(rf.responseText); } rf.onreadystatechange = loaded; rf.send(null); /*************** // var url = "http://www.mozilla.org"; var url = "http://downloads.us-east3.mozdev.org/jslib/xpi/jslib_current.xpi"; var rf = new RemoteFile (url); jslibPrint(url+" exists: ["+rf.exists()+"]"); jslibPrint("rf.contentType: ["+rf.contentType+"]"); jslibPrint("rf.nsIURI: ["+rf.nsIURI+"]"); rf.open(); var contents = rf.read(); jslibPrint("********** START CONTENT ************"); jslibPrint(contents); jslibPrint("********** END CONTENT ************"); jslibPrint("["+rf.lastModified+"]"); ****************/ } // jslibTurnDumpOff(); ]]> </script> <vbox flex="1" pack="center"> <spacer flex="1" /> <button label="Test Remote File" oncommand="test();" /> <spacer flex="1" /> <button label="Test GUI" /> <spacer flex="1" /> </vbox> </window> --- NEW FILE: webtop_sample.xul --- <?xml version="1.0"?> <!-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Mozdev Group, Inc. code. The Initial Developer of the Original Code is Mozdev Group, Inc. Portions created by Mozdev Group, Inc. are Copyright (C) 2003 Mozdev Group, Inc. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): --> <!-- ***************** STYLE SHEET ****************** --> <!-- <?xml-stylesheet href="chrome://xptk/content/xptk.css" type="text/css"?> --> <!-- ***************** STYLE SHEET ****************** --> <!DOCTYPE window> <window id="webtop-sample" style="background-color: #ffffff;" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/jslib.js" /> <script> include (jslib_routines); </script> <toolbox> <toolbar grippyhidden="true"> <label color="black" value="JSLib Web Top" style="margin-left: 10px;" /> <spacer flex="1" /> <button color="black" label="yahoo" oncommand="window.frames[0].location='http://www.yahoo.com';" /> <button color="black" label="google" oncommand="window.frames[0].location='http://www.google.com';" /> <button color="black" label="close" oncommand="close();" /> <button color="black" label="quit" oncommand="quit();" /> </toolbar> </toolbox> <browser id="content" type="content-primary" src="http://jslib.mozdev.org/" flex="1" /> </window> --- NEW FILE: webtop.xul --- <?xml version="1.0"?> <!-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Mozdev Group, Inc. code. The Initial Developer of the Original Code is Mozdev Group, Inc. Portions created by Mozdev Group, Inc. are Copyright (C) 2003 Mozdev Group, Inc. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): --> <!-- ***************** STYLE SHEET ****************** --> <!-- <?xml-stylesheet href="chrome://xptk/content/xptk.css" type="text/css"?> --> <!-- ***************** STYLE SHEET ****************** --> <!DOCTYPE window> <window id="webtop mode" style="visibility: collapsed;" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/jslib.js" /> <script> include (jslib_window); const URL = 'chrome://slashhack/content/resources/js/jslib/samples/webtop_sample.xul'; var win = new CommonWindow(URL, 640, 480); win.openWebTop(); close(); </script> </window> --- NEW FILE: file.xul --- <?xml version="1.0"?> <!-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Mozdev Group, Inc. code. The Initial Developer of the Original Code is Mozdev Group, Inc. Portions created by Mozdev Group, Inc. are Copyright (C) 2003 Mozdev Group, Inc. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): --> <!DOCTYPE window> <window id="file" style="background-color: #cccccc; width: 100px; height: 100px;" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/jslib.js" /> <script type="application/x-javascript"> include (jslib_file); // a local file path var localFile = "/tmp/fubar.dat"; var f = new File(localFile); </script> <vbox flex="1" pack="center"> <spacer flex="1" /> <button label="Function List" oncommand="alert(f.help);" /> <button label="exists" oncommand="alert(f.exists());" /> <button label="create file" oncommand="if (!f.exists()) f.create();" /> <spacer flex="1" /> </vbox> </window> |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:26
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/network/parts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/network/parts Added Files: bodyParametersPart.js filePart.js textPart.js urlParametersPart.js Log Message: Task #106454 - include jslib. --- NEW FILE: filePart.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ if (typeof(JS_LIB_LOADED)=='boolean') { const JS_FILEPART_FILE = "filePart.js"; const JS_FILEPART_LOADED = true; function FilePart() { } FilePart.prototype = { _name: null, _file: null, _cnttype: null, setFile: function( name, jsFile, contenttype ) { this._name = name; this._cnttype = contenttype; this._file = jsFile.nsIFile; }, //not applicable _getRequestUriParams: function() { return null; }, _getRequestHeaders: function() { var list = new Dictionary(); list.put("Content-type",_cnttype); if( _name != null ) list.put("Content-disposition","form-data; name=\""+_name+"\";"); return list; }, _getBody: function() { var nsIFileInStrm = Components.interfaces.nsIFileInputStream; var nsIBufInStrm = Components.interfaces.nsIBufferedInputStream; var finstrm = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance( nsIFileInStrm ); finstrm.init(_file, 1, 1, finstrm.CLOSE_ON_EOF); this.instrm = Components.classes["@mozilla.org/network/buffered-input-stream;1"]. createInstance( nsIBufInStrm ); this.instrm.init(finstrm, 4096); return fstrm; } } jslibDebug('*** load: '+JS_FILEPART_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_filepart);\n\n"); }; --- NEW FILE: textPart.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ if (typeof(JS_LIB_LOADED)=='boolean') { const JS_TEXTPART_FILE = "textPart.js"; const JS_TEXTPART_LOADED = true; function TextPart() { } TextPart.prototype = { _name: null, _txt: null, _cnttype: null, setText: function( name, text, contenttype ) { this._name = name; this._cnttype = contenttype; this._txt = text; }, //not applicable _getRequestUriParams: function() { return null; }, _getRequestHeaders: function() { var list = new Dictionary(); list.put("Content-type",_cnttype); if( _name != null ) list.put("Content-disposition","form-data; name=\""+_name+"\";"); return list; }, _getBody: function() { var body = Components.classes["@mozilla.org/io/string-input-stream;1"]. createInstance( Components.interfaces.nsIStringInputStream ); body.setData(_txt,-1); return body; } } jslibDebug('*** load: '+JS_TEXTPART_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_textpart);\n\n"); }; --- NEW FILE: urlParametersPart.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ //this Part also accepts headers for the main multipart request if (typeof(JS_LIB_LOADED)=='boolean') { const JS_URLPARAMETERSPART_FILE = "urlParametersPart.js"; const JS_URLPARAMETERSPART_LOADED = true; if (typeof(JS_DICTIONARY_LOADED)!='boolean') include(jslib_dictionary); function URLParametersPart() { this._params = new Dictionary(); this._headers = new Dictionary(); } URLParametersPart.prototype = { _params: null, _headers: null, put: function( key, value, isHeader ) { if( isHeader == null ) isHeader = false; if( typeof(key) != "string" && typeof(value) !="string" ) return this; if(isHeader) this._params.put(key,value); else this._headers.put(key,value); }, _getRequestUriParams: function() { return this._params; }, //not applicable _getRequestHeaders: function() { return this._headers; }, //not applicable _getBody: function() { return null; } } jslibDebug('*** load: '+JS_URLPARAMETERSPART_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_urlparameterspart);\n\n"); }; --- NEW FILE: bodyParametersPart.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ if (typeof(JS_LIB_LOADED)=='boolean') { const JS_BODYPARAMETERSPART_FILE = "bodyParametersPart.js"; const JS_BODYPARAMETERSPART_LOADED = true; if (typeof(JS_DICTIONARY_LOADED)!='boolean') include(jslib_dictionary); function BodyParametersPart() { this._params = new Dictionary(); } BodyParametersPart.prototype = { _params: null, _name: null, setName: function( name ) { _name = name; }, put: function( key, value ) { if( typeof(key) != "string" && typeof(value) !="string" ) return this; this._params.put(key,value); }, //not applicable _getRequestUriParams: function() { return null; }, _getRequestHeaders: function() { var list = new Dictionary(); list.put("Content-type","application/x-www-form-urlencoded"); if( _name != null ) list.put("Content-disposition","form-data; name=\""+_name+"\";"); return list; }, _getBody: function() { var uri = ""; this.params.resetIterator(); while( this.params.hasMoreElements() ) { var param = this.params.getNext(); if( this.params.hasMoreElements() ) uri+= escape(param.key)+"="+escape(param.value)+"&"; else uri+= escape(param.key)+"="+escape(param.value); } var body = Components.classes["@mozilla.org/io/string-input-stream;1"]. createInstance( Components.interfaces.nsIStringInputStream ); body.setData(uri,-1); return body; } } jslibDebug('*** load: '+JS_BODYPARAMETERSPART_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_bodyparameterspart);\n\n"); }; |
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/network Added Files: filePostRequest.js getRequest.js http.js multipartRequest.js postRequest.js remoteFile.js socket.js Log Message: Task #106454 - include jslib. --- NEW FILE: http.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ if (typeof(JS_LIB_LOADED)=='boolean') { const JS_HTTP_FILE = "http.js"; const JS_HTTP_LOADED = true; function HTTP() { } HTTP.prototype = { response:null, status:null, doOperation: function (req) { p = new XMLHttpRequest(); p.onload = null; p.open(req.getRequestMethod(), req.getRequestUri(), false); var s = req.getBody(p); req.setRequestHeaders(p); p.send(s); // since this is sync request, we get results after send() this.status = p.status; if ( this.status != "200" ) { return false; } else { this.response = p.responseText; return true; } } } jslibDebug('*** load: '+JS_HTTP_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_http);\n\n"); }; --- NEW FILE: remoteFile.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Mozdev Group, Inc. code. The Initial Developer of the Original Code is Pete Collins. Portions created by Mozdev Group, Inc. are Copyright (C) 2003 Mozdev Group, Inc. All Rights Reserved. Contributor(s): Pete Collins <pe...@mo...)> (original author) ***/ /****************** Globals **********************/ if (typeof(JS_LIB_LOADED)=='boolean') { const JS_REMOTEFILE_FILE = "remoteFile.js"; const JS_REMOTEFILE_LOADED = true; const JS_REMOTEFILE_URI_CID = "@mozilla.org/network/simple-uri;1"; const JS_REMOTEFILE_URI_I_ID = C.interfaces.nsIURI; const JS_REMOTEFILE_IOSERVICE_CID = "@mozilla.org/network/io-service;1"; const JS_REMOTEFILE_I_IOSERVICE = C.interfaces.nsIIOService; const JS_REMOTEFILE_IOSERVICE = C.classes[JS_REMOTEFILE_IOSERVICE_CID]. getService(JS_REMOTEFILE_I_IOSERVICE); /****************** Remote File Object Class *********************/ function RemoteFile(aURL) { if (!aURL) { jslibError (null, "Remote File constructor", "NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_REMOTEFILE_FILE); return; } var url = C.classes[JS_REMOTEFILE_URI_CID].createInstance(JS_REMOTEFILE_URI_I_ID); url.spec = aURL; var protocol = url.scheme; if (protocol != "http") { jslibPrint("RemoteFile URL: "+aURL); jslibPrint("RemoteFile: Sorry, only http is implemented! not ["+protocol+"]"); return; } this.mURI = aURL; return; } // constructor RemoteFile.prototype = { mURI : null, mInputStream : null, mOutputStream : null, mContent : null, mContentType : null, open : function () { var rf = new XMLHttpRequest(); rf.open("GET", this.mURI, false); // to prevent leaks see Mozilla bug #206947 rf.overrideMimeType("text/xml"); rf.send(null); if (rf.status!=200) jslibPrint("Status Code: "+rf.status); this.mContent = rf.responseText; this.mContentType = rf.getResponseHeader("Content-type"); return true; }, read : function () { if (!this.mContent) throw "No remote file instance available you must use open first"; return this.mContent; }, get nsIURI () { if (!this.mURI) return ""; return (JS_REMOTEFILE_IOSERVICE.newURI(this.mURI, null, null)); }, get contentType () { if (!this.mURI) return ""; if (this.mContentType) return this.mContentType; var xml = new XMLHttpRequest(); xml.open("HEAD", this.mURI, false); xml.overrideMimeType("text/xml"); xml.send(null); return xml.getResponseHeader("Content-type"); }, exists : function () { if (!this.mURI) return false;; var rv = false; var xml = new XMLHttpRequest(); xml.open("HEAD", this.mURI, false); xml.overrideMimeType("text/xml"); xml.send(null); if (xml.status != 404) rv = true; return rv; }, /** * returns a javascript Date object * for the Last-Modified timestamp of the * remote url */ get lastModified () { if (!this.mURI) return null; var rv = null; var xml = new XMLHttpRequest(); xml.open("HEAD", this.mURI, false); xml.overrideMimeType("text/xml"); xml.send(null); rv = xml.getAllResponseHeaders(); rv = rv.match(/Last-Modified: .*/); if (!rv) return null; rv = rv[0]; return (new Date(rv.substring(15, rv.length))); }, /********************* help ***************************** * void getter help * * Returns the methods in this object * * return values on success and failure * aStr The methods in this object * * useage: * <string> = obj.help; ****************************************************/ get help() { const help = "\n\nFunction and Attribute List:\n" + "nsIURI\n" + "open()\n" + "read()\n" + "contentType\n" + "exists()\n" + "\n"; return help; } } jslibDebug('*** load: '+JS_REMOTEFILE_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_remotefile);\n\n"); }; // END FileSystem Class --- NEW FILE: socket.js --- /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is JSIRC Library * * The Initial Developer of the Original Code is New Dimensions Consulting, * Inc. Portions created by New Dimensions Consulting, Inc. are * Copyright (C) 1999 New Dimenstions Consulting, Inc. All * Rights Reserved. * * Contributor(s): * Robert Ginda, rg...@nd..., original author * Peter Van der Beken, pet...@pa..., necko-only version * Jeremie Miller, je...@je..., generalized into js socket lib (for Jabber) * Modified: Sep-2003 sdk updated to working (more) state. using: chatzilla/connection-xpcom.js Attributes: nsISocketTransport.openInputStream arguments: socket.openInputFlags = 0; open flags socket.openInputSegmentSize = 0; segmentSize socket.openInputSegmentCount = 0; segmentCount nsISocketTransport.openOutputStream arguments: socket.openOutputFlags = 0; open flags socket.openOutputSegmentSize = 0; segmentSize socket.openOutputSegmentCount = 0; segmentCount */ if (typeof(JS_LIB_LOADED)=='boolean') { var jsenv = new Object(); jsenv.HAS_STREAM_PROVIDER = ('nsIStreamProvider' in C.interfaces); /* function: Socket purpose: Constructor for an instance of Socket interface: socket( [ classID ] ) arguments: classID : classesByID class-identifier returns: not applicable Note: by default, Socket uses the local socket-transport-service, however callers looking for a specific implementation can pass in the class identifier as an alternative. */ function Socket () { this.openInputFlags = 0; this.openInputSegmentSize = 0; this.openInputSegmentCount = 0; this.openOutputFlags = 0; this.openOutputSegmentSize = 0; this.openOutputSegmentCount = 0; var defaultContractID = "@mozilla.org/network/socket-transport-service;1"; // var defaultClassID = "{c07e81e0-ef12-11d2-92b6-00105a1b0d64}" var socketServiceClass; switch( arguments.length ) { case 0: socketServiceClass = C.classes[ defaultContractID ]; break; case 1: socketServiceClass = C.classesByID[ arguments[ 1 ] ]; break; default: throw( "Socket: unexpected arguments for constructor" ); break; } if ( arguments.length == 1 ) if (!socketServiceClass) throw ("Socket constructor: Couldn't get socket service class."); var socketService = socketServiceClass.getService(); if (!socketService) throw ("Socket constructor: Couldn't get socket service."); this._socketService = jslibQI(socketService, "nsISocketTransportService"); // to preserve ourselves within necko/async this.wrappedJSObject = this; } /* function: open purpose: opens the socket interface: open( host, port [ binary ] ) Arguments: host : String, host to connect to port : int, port number to use binary : optional, use binary input support, defaults false returns: true. */ Socket.prototype.open = function (host, port) { this.host = host.toLowerCase(); this.port = port; this.binary = ( arguments.length > 2 ) ? arguments[ 2 ] : false; // in theory, we'd look up proxy information here. but we're being // a bare socket so.... // create the transport: // socketTypes = null // typeCount = 0 // host // port // proxy-info = null this._transport = this._socketService.createTransport ( null, 0, host, port, null ); if (!this._transport) throw ("Socket.open: Error opening transport."); var openFlags = ( this.blocking ) && ( typeof document == "object" ) ? 0 : C.interfaces.nsITransport.OPEN_BLOCKING; this._inputStream = this._transport.openInputStream( this.openInputFlags, this.openInputSegmentSize, this.openInputSegmentCount ); if (!this._inputStream) throw ("Socket.open: Error getting input stream."); if ( this.binary ) this._inputInterface = this.toBinaryInputStream( this._inputStream ); else this._inputInterface = this.toScriptableInputStream( this._inputStream ); this._outputStream = this._transport.openOutputStream( this.openOutputFlags, this.openOutputSegmentSize, this.openOutputSegmentCount ); if (!this._outputStream) throw ("Socket.open: Error getting output stream."); // we really should call _transport.isAlive (?) but that always // returns false. attempts to use "available()" don't fail (but will // later if a connection isn't open). this.isConnected = true; return this.isConnected; } /* function: close purpose: closes the socket connection interface: close() returns: nothing. */ Socket.prototype.close = function () { this.isConnected = false; // calls to _inputStream.close() and _outputStream.close() didn't // function. this._transport.close( 0 ); } /* function: write purpose: writes the given string to the socket. interface: write( str ) arguments: str : string to be written. returns: true if no exception is thrown. */ Socket.prototype.write = function (str) { if (!this.isConnected) throw "Socket.write: Not Connected."; var rv = false; try { this._outputStream.write(str, str.length); rv = true; } catch (ex) { if (typeof ex != "undefined") { this.isConnected = false; throw (ex); } else rv = false; } return rv; } /* function: read purpose: reads data from a socket. interface: read( bytes ) arguments: bytes : integer, number of bytes to read in returns: string Note: will only return the smaller of specified vs available bytes. */ Socket.prototype.read = function ( bytes ) { if (!this.isConnected) throw "Socket.read: Not Connected."; var returnValue = new String; try { // attempts to read more bytes than available will throw // an exception. bytes = Math.min( this._inputInterface.available(), bytes ); if ( bytes ) if ( this.binary ) // despite the documentation, this call works returnValue = this._inputInterface.readBytes( bytes ); else returnValue = this._inputInterface.read( bytes ); else returnValue = ""; } catch (ex) { // the assumption is that we lost the connection... if (typeof ex != "undefined") { this.isConnected = false; throw (ex); } else { returnValue = ""; } } return returnValue; } /* function: available purpose: number of bytes waiting to be read interface: available() returns: integer */ Socket.prototype.available = function () { if ( !this.isConnected ) throw "Socket.available: Not Connected."; return this._inputInterface.available(); } /* function: toBinaryInputStream purpose: creates an nsIBinaryInputStream wrapper around the given inputStream. interface: toBinaryInputStream( inputStream ) arguments: inputStream : result of openInputStream returns: nsIBinaryInputStream */ Socket.prototype.toBinaryInputStream = function( inputStream ) { var si = jslibCreateInstance("@mozilla.org/binaryinputstream;1", "nsIBinaryInputStream"); si.setInputStream( inputStream ); return si; } /* function: toScriptableInputStream purpose: creates an nsIScriptableInputStream wrapper around the given inputStream. interface: toScriptableInputStream( inputStream ) arguments: inputStream : result of openInputStream returns: nsIScriptableInputStream */ Socket.prototype.toScriptableInputStream = function( inputStream ) { var si = jslibCreateInstance("@mozilla.org/scriptableinputstream;1", "nsIScriptableInputStream"); si.init( inputStream ); return si; } // sdk/16-Sep-2003: async is non-functional /* function: async purpose: interface: returns: usage: var aSocket = new Socket(); var observer = { streamStarted: function(socketContext){ }, //onstart action streamStopped: function(socketContext, status){ }, //onstop action receiveData: function(data){alert(data)} } aSocket.open("ftp.mozilla.org", 21); aSocket.async(observer ); */ Socket.prototype.async = function (observer) { this._pump = jslibCreateInstance("@mozilla.org/network/input-stream-pump;1", "nsIInputStreamPump"); this._pump.init(this._inputStream, -1, -1, 0, 0, false); this._pump.asyncRead(new SocketListener(observer), this); } // async callbacks function SocketListener( observer ) { this._observer = observer; } SocketListener.prototype.onStartRequest = function (channel, socketContext) { socketContext = socketContext.wrappedJSObject; this._observer.streamStarted( socketContext ); } SocketListener.prototype.onStopRequest = function (channel, socketContext, status, errorMsg) { socketContext = socketContext.wrappedJSObject; this._observer.streamStopped( socketContext, status ); } SocketListener.prototype.onDataAvailable = function (channel, socketContext, inStr, sourceOffset, count) { socketContext = socketContext.wrappedJSObject; this._observer.receiveData( socketContext.read( count ) ); } }; // END socket.js --- NEW FILE: multipartRequest.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) MultipartRequest This object is used to represent the MultipartRequest Create any (any number, any combination, any order) of the Parts that you would like to use. Add them to MultipartRequest using mpr.put(part) Pass the MultipartRequest to the HTTP object just like other Request objects FilePart This Part is used to pass a file through the body of the request filepart.setFile(<a name>, <a jslib File obj>, <content type>); TextPart This Part is used to pass a long text through the body of the request. content-type can be used to provide an interpretation of text like text/plain, text/xml, text/html textpart.setPart(<a name>, <a string>, <content type>); URLParametersPart This Part is used to pass urlencoded parameters through the request url of the request urlparampart.put(<parameter key>, <parameter value>); BodyParametersPart This Part is used to pass urlencoded parameters through the body of the request. bodyparampart.put(<parameter key>, <parameter value>); You can also set a name for the part using bodyparampart.setName(<namestring>); *************************************/ if (typeof(JS_LIB_LOADED)=='boolean') { const JS_MULTIPARTREQUEST_FILE = "multipartRequest.js"; const JS_MULTIPARTREQUEST_LOADED = true; const boundary = "--i-N-5-4-N-3-k-4-n-3-------------314159265358979323846"; const delimiter = "\r\n--"+boundary+"\r\n" ; const close_delim = "\r\n--"+boundary+"--" ; //accepts several parameters, which are placed in the body //of the request function Parts() { this._array = new Array(); } Parts.prototype = { _iterind: 0, put: function(part) { this._array.push(part); }, find: function(type) { var list = new Parts(); this.resetIterator(); while( this.hasMoreElements() ) { var param = this.getNext(); if( param.type == type ) list.put(param); } return list; }, //iterator resetIterator: function() { this._iterind = 0; }, hasMoreElements: function() { if( this._iterind < this._array.length - 1 ) return true; else return false; }, next: function() { return this._array[_iterind++]; } } function MultipartRequest(baseuri) { this.baseu = baseuri; this.parts = new Parts(); } MultipartRequest.prototype = { baseu: null, method: "POST", parts: null, put: function(part) { this.parts.put(part); return this; }, getRequestUri: function() { var uri = this.baseu; uri +="?"; while( this.parts.hasMoreElements() ) { var part = this.parts.getNext(); var params = part._getRequestUriParams(); if( params == null ) continue; params.resetIterator(); while(params.hasMoreElements()) { var head = params.getNext(); uri += head.key +"="+head.value+"&"; } } } uri = uri.slice(0,-1); //remove the last & or last ? return uri; }, getRequestMethod: function() { return this.method; }, setRequestHeaders: function(xhr) { while( this.parts.hasMoreElements() ) { var part = this.parts.getNext(); if( typeof(part) == "URLParameterPart" ) { var phead = part._getRequestHeaders(); if( params == null ) continue; phead.resetIterator(); while(phead.hasMoreElements()) { var head = phead.getNext(); xhr.setRequestHeader(head.key,head.value); } } } xhr.setRequestHeader("Content-type","multipart/form-data; boundary="+boundary); }, getBody: function() { var strinsC = Components.classes["@mozilla.org/io/string-input-stream;1"]. var multiplexstrmC = Components.classes["@mozilla.org/io/multiplex-input-stream;1"]; var mimestrmC = Components.classes["@mozilla.org/network/mime-input-stream;1"]. var delimstrm = strinsC.createInstance( Components.interfaces.nsIStringInputStream ); delimstrm.setData(delimiter,-1); var multiplexstrm = multiplexstrmC.createInstance( Components.interfaces.nsIMultiplexInputStream ); multiplexstrm.appendStream(delimstrm); this.parts.resetIterator(); //for each part while( this.parts.hasMoreElements() ) { var part = this.parts.getNext(); var mimestrm = mimestrmC.createInstance( Components.interfaces.nsIMIMEInputStream ); mimestrm.addContentLength = true; var body = part._getBody(); if( body == null ) continue; var phead = part._getRequestHeaders(); phead.resetIterator(); while(phead.hasMoreElements()) { var head = phead.getNext(); mimestrm.addHeader(head.key,head.value); } mimestrm.setData(body); multiplexstrm.appendStream(mimestrm); //is it necessary to create a new stream ? //leave it in anyway delimstrm = strinsC.createInstance( Components.interfaces.nsIStringInputStream ); delimstrm.setData(delimiter,-1); multiplexstrm.appendStream(delimstrm); } var cdelimstrm = strinsC.createInstance( Components.interfaces.nsIStringInputStream ); cdelimstrm.setData(close_delim,-1); multiplexstrm.appendStream(cdelimstrm); return multiplexstrm; } } jslibDebug('*** load: '+JS_MULTIPARTREQUEST_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_multipartrequest);\n\n"); }; --- NEW FILE: filePostRequest.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ //sends a file as the body. does not accept other parameters if (typeof(JS_LIB_LOADED)=='boolean') { const JS_FILEPOSTREQUEST_FILE = "filePostRequest.js"; const JS_FILEPOSTREQUEST_LOADED = true; function FilePostRequest(baseuri){ this.baseu = baseuri; } FilePostRequest.prototype = { baseu: null, method: "POST", cnttype: null, cntenc: null, filen: null, instrm: null, setFile: function(filename, stream, contenttype) { this.filen = filename; this.instrm = stream; this.cnttype = contenttype; }, setFile: function(filename, jslibFile, contenttype) { this.filen = filename; var nsIFileInStrm = Components.interfaces.nsIFileInputStream; var nsIBufInStrm = Components.interfaces.nsIBufferedInputStream; var finstrm = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance( nsIFileInStrm ); finstrm.init(jslibFile.nsIFile, 1, 1, finstrm.CLOSE_ON_EOF); this.instrm = Components.classes["@mozilla.org/network/buffered-input-stream;1"]. createInstance( nsIBufInStrm ); this.instrm.init(finstrm, 4096); this.cnttype = contenttype; }, getRequestUri: function() { var uri = ""; uri += this.baseu; return uri; }, getRequestMethod: function() { return this.method; }, setRequestHeaders: function(p) { return null; }, getBody: function(p) { var boundary = "--i-N-5-4-N-3-k-4-n-3-------------314159265358979323846"; var delimiter = "\r\n--"+boundary+"\r\n" ; var close_delim = "\r\n--"+boundary+"--" ; var cont_dispos_tag = "Content-disposition"; var cont_dispos_val1 = "form-data; name=\""; var cont_dispos_val2 = "\"; filename=\""; var cont_dispos_val3 = "\""; var cont_type_tag = "Content-type"; var cont_type_val = this.cnttype; //set up the multipart stream var delimstrm = Components.classes["@mozilla.org/io/string-input-stream;1"]. createInstance( Components.interfaces.nsIStringInputStream ); delimstrm.setData(delimiter,-1); //the part in a multipart stream var mimestrm = Components.classes["@mozilla.org/network/mime-input-stream;1"]. createInstance( Components.interfaces.nsIMIMEInputStream ); mimestrm.addContentLength = false; mimestrm.addHeader(cont_dispos_tag,cont_dispos_val1+this.filen+cont_dispos_val2+this.filen+cont_dispos_val3); mimestrm.addHeader(cont_type_tag,cont_type_val); mimestrm.setData(this.instrm); var cdelimstrm = Components.classes["@mozilla.org/io/string-input-stream;1"]. createInstance( Components.interfaces.nsIStringInputStream ); cdelimstrm.setData(close_delim,-1); var multiplexstrm = Components.classes["@mozilla.org/io/multiplex-input-stream;1"]. createInstance( Components.interfaces.nsIMultiplexInputStream ); multiplexstrm.appendStream(delimstrm); multiplexstrm.appendStream(mimestrm); multiplexstrm.appendStream(cdelimstrm); p.setRequestHeader("Content-length",multiplexstrm.available()); p.setRequestHeader("Content-type","multipart/form-data; boundary="+boundary); return multiplexstrm; } } jslibDebug('*** load: '+JS_FILEPOSTREQUEST_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_filepostrequest);\n\n"); }; --- NEW FILE: postRequest.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ //accepts several parameters, which are placed in the body //of the request if (typeof(JS_LIB_LOADED)=='boolean') { const JS_POSTREQUEST_FILE = "postRequest.js"; const JS_POSTREQUEST_LOADED = true; if (typeof(JS_DICTIONARY_LOADED)!='boolean') include(jslib_dictionary); function PostRequest(baseuri){ this.baseu = baseuri; this.parameters = new Dictionary(); } PostRequest.prototype = { baseu: null, method: "POST", parameters: null, cnttype: null, cntenc: null, put: function(key,value) { this.parameters.put(key,value); return this; }, getRequestUri: function() { var uri = ""; uri += this.baseu; return uri; }, getRequestMethod: function() { return this.method; }, setRequestHeaders: function(p) { p.setRequestHeader("Content-type","application/x-www-form-urlencoded"); }, getBody: function() { var uri = ""; this.parameters.resetIterator(); while( this.parameters.hasMoreElements() ) { var param = this.parameters.next(); if( this.parameters.hasMoreElements() ) uri+= escape(param.key)+"="+escape(param.value)+"&"; else { uri+= escape(param.key)+"="+escape(param.value); break; } } return uri; } } jslibDebug('*** load: '+JS_POSTREQUEST_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_postrequest);\n\n"); }; --- NEW FILE: getRequest.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ //accepts several parameters, which are placed in the url //of the request if (typeof(JS_LIB_LOADED)=='boolean') { const JS_GETREQUEST_FILE = "getRequest.js"; const JS_GETREQUEST_LOADED = true; if (typeof(JS_DICTIONARY_LOADED)!='boolean') include(jslib_dictionary); function GetRequest(baseuri){ this.baseu = baseuri; this.parameters = new Dictionary(); } GetRequest.prototype = { baseu: null, method: "GET", parameters: null, cnttype: null, cntenc: null, put: function(key,value) { this.parameters.put(key,value); return this; }, getRequestUri: function() { var uri = ""; uri += this.baseu + "?"; this.parameters.resetIterator(); while( this.parameters.hasMoreElements() ) { var param = this.parameters.next(); uri+= escape(param.key)+"="+escape(param.value)+"&"; } uri = uri.slice(0,-1) //discard & or ? return uri; }, getRequestMethod: function() { return this.method; }, setRequestHeaders: function(p) { return null; }, getBody: function() { return null; } } jslibDebug('*** load: '+JS_GETREQUEST_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_getrequest);\n\n"); }; |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:26
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/sound In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/sound Added Files: sound.js Log Message: Task #106454 - include jslib. --- NEW FILE: sound.js --- /* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): */ if (typeof(JS_LIB_LOADED)=='boolean') { const JS_SOUND_LOADED = true; const JS_SOUND_FILE = "sound.js"; function Sound (aURL) { this.init(aURL); } Sound.prototype = { mFile : null, mURL : null, mSND : null, mLocalURL : false, init : function (aURL) { if (!this.mSND) { try { const SND_I_SOUND = "nsISound"; const SND_CID = "@mozilla.org/sound;1"; var Sound = new C.Constructor(SND_CID, SND_I_SOUND); this.mSND = new Sound(); jslib_debug("initializing nsISound component . . . \n"); } catch (e) { jslibError(e, "(sound initialization error)", "NS_ERROR_UNEXPECTED", JS_SOUND_FILE+":init"); } } if (aURL) { try { jslib_debug("URL in: ["+aURL+"]\n"); const SND_NETWORK_STD_CID = "@mozilla.org/network/standard-url;1"; const SND_I_URL = "nsIURL"; const SND_URL = new C.Constructor(SND_NETWORK_STD_CID, SND_I_URL); this.mURL = new SND_URL(); this.mURL.spec = aURL; if (this.mURL.scheme == 'resource' || this.mURL.scheme == 'file') { jslib_debug("Play Local\n"); this.mLocalURL = true; } else { this.mLocalURL = false; } } catch (e) { jslibError(e, "(sound url initialization error)", "NS_ERROR_UNEXPECTED", JS_SOUND_FILE+":init"); } } }, play : function () { if (!this.mURL) jslib_debug("Please initialize with a file or url\n"); try { if (this.mLocalURL) { jslib_debug("Playing Local Sound File: ["+this.mURL.spec+"]\n"); this.mSND.play(this.mURL); } else { jslib_debug("Playing ["+this.mURL.scheme+"] Sound File: ["+this.mURL.spec+"]\n"); this.mSND.play(this.mURL); } } catch (e) { jslibError(e, "(sound play error)", "NS_ERROR_UNEXPECTED", JS_SOUND_FILE+":play"); } }, beep : function() { try { this.mSND.beep(); } catch (e) { jslibError(e, "(sound beep error)", "NS_ERROR_UNEXPECTED", JS_SOUND_FILE+":beep"); } } } jslibDebug('*** load: '+JS_SOUND_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK else { dump("JS_FILE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include('chrome://slashhack/content/resources/js/jslib/io/filesystem.js');\n\n"); } |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:26
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/rdf/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/rdf/test Added Files: test.js Log Message: Task #106454 - include jslib. --- NEW FILE: test.js --- function walk_rdf(file) { var rdf = new RDFFile(file); dump("Source: " + rdf.getSource() + "\n"); var conts = rdf.getAllContainers(); for(var i=0; i<conts.length; i++) { walk_container(conts[i]); } } function walk_container(res) { var list; dump("Container: " + res.getSubject() + "\n"); // walk_attributes(res); list = res.getSubContainers(); for(var i=0; i<list.length; i++) { walk_container(list[i]); } list = res.getSubNodes(); for(var i=0; i<list.length; i++) { dump("\tnode: " + list[i].getSubject() + "\n"); walk_attributes(list[i]); } } function walk_attributes(node) { list = node.getAllAttributes(); for(var i=0; i<list.length; i++) { dump("\t\tattr: [name=" + list[i].name + "][value=" + list[i].value + "]\n"); } } |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:24
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/debug Added Files: debug.js Log Message: Task #106454 - include jslib. --- NEW FILE: debug.js --- /* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): Henrik Gemal <http://gemal.dk> */ /************** DUBUG ******************/ if (typeof(JS_LIB_LOADED) == "boolean") { const JS_DEBUG_LOADED = true; const JS_DEBUG_FILE = "debug.js"; /**************************************************************** * void jslibDebug(aOutString) * * aOutString is an argument of string debug message * * returns void * * eg: * * var msg="Testing function"; * * jslibDebug(msg); * * * * outputs: Testing function * ****************************************************************/ function jslibDebug(aMsg) { if (!JS_LIB_DEBUG) return; if (JS_LIB_DEBUG_ALERT) alert(aMsg); jslibDumpInternal(aMsg+'\n'); } // DEPRECATED function jslib_debug(aMsg) { return jslibDebug(aMsg); } // print to stdout function jslibPrint(aMsg) { jslibDumpInternal(aMsg+'\n'); } // print to stdout function jslibPrintDebug(aMsg, aOutString) { if (!aMsg) aMsg = "JSLIB_DEBUG: "; jslibDumpInternal(aMsg+" "+aOutString+'\n'); } // same as above function jslibDebugMsg (aMsg, aOutString) { jslibPrintDebug(aMsg, aOutString); } // dump w/ bracket function jslibDebugMsgBracket (aMsg, aOutString) { jslibPrintDebug(aMsg, "["+aOutString+"]"); } // print w/ bracket function jslibPrintBracket(aOutString) { jslibDumpInternal("["+aOutString+']\n'); } // print message function jslibPrintMsg(aOutStr1, aOutStr2) { jslibDumpInternal(aOutStr1+": "+aOutStr2+"\n"); } /**************************************************************** * void jslibError(e) * * e - argument of results exception * * returns e.result * * Ex: * * jslibError(e) * * * * outputs: * * -----======[ ERROR ]=====----- * * Error in jslib.js: include: Missing file path argument * * * * NS_ERROR_NUMBER: NS_ERROR_XPC_NOT_ENOUGH_ARGS * * ------------------------------ * * * ****************************************************************/ function jslibError(e) { var rv = null; var errMsg=""; if (typeof(e) == 'object') { var m, n, r, l, ln, fn = ""; try { rv = e.result; m = e.message; fn = e.filename; l = e.location; ln = l.lineNumber; } catch (e) {} errMsg+="FileName: "+fn+"\n" + "Result: "+rv+"\n" + "Message: "+m+"\n" + "LineNumber: "+ln+"\n"; } errMsg = "\n-----======[ jsLib ERROR ]=====-----\n" + errMsg; errMsg += "-------------------------------------\n"; jslibDebug(errMsg); return rv; } function jslibErrorWarn (e) { jslibDebug("jsLib warn: "+e); return null; } function jslibErrorMsg (e, comment) { typeof(comment) == "string" ? jslibDebugMsgBracket(e, comment) : jslibDebug(e); return jslibRes[e]; } function jslibPrintProperties (aObj) { for (var list in aObj) jslibPrint(list); } function jslibPrintType (aObj) { jslibPrint(typeof(aObj)); } function jslibPrintTypeWName (aName, aObj) { jslibPrint("Name: "+aName+" JSType: "+typeof(aObj)); } function jslibTypeIsObj (aType) { return (aType && typeof(aType) == "object"); } function jslibTypeIsFunc (aType) { return (aType && typeof(aType) == "function"); } function jslibTypeIsStr (aType) { return (aType && typeof(aType) == "string"); } function jslibTypeIsNum (aType) { return (aType && typeof(aType) == "number"); } function jslibTypeIsUndef (aType) { return (typeof(aType) == "undefined"); } function jslibDumpInternal (aMsg) { dump(aMsg); jslibGetService("@mozilla.org/consoleservice;1", "nsIConsoleService").logStringMessage(aMsg); } // Welcome message jslibDebug('*** load: '+JS_DEBUG_FILE+' OK'); jslibDebug(JS_LIB_HELP); jslibDebug("\n\n*********************\nJS_LIB DEBUG IS ON\n*********************\n\n"); } |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:24
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/jslib/content/js In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/jslib/content/js Added Files: aboutDialog.js Log Message: Task #106454 - include jslib. --- NEW FILE: aboutDialog.js --- /* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is the jslib team. Original Author: Brian King <br...@mo...> Contributor(s): */ function onloadAbout() { //window.sizeToContent(); } // Firefox only function toOpenWindowByType(inType, uri, features, urlToLoad) { var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(); var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator); var topWindow = windowManagerInterface.getMostRecentWindow(inType); if (topWindow) { topWindow.focus(); var theBrowser = topWindow.document.getElementById("content"); var tabAdded = theBrowser.addTab(urlToLoad); theBrowser.selectedTab = tabAdded; } else { window.openDialog(uri, "", features, urlToLoad); } } function goLink(evt) { var href = evt.target.getAttribute("href"); if (href){ toOpenWindowByType("navigator:browser", "chrome://browser/content/browser.xul", "all,dialog=no", href) self.close(); } } |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:24
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/jslib/content In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/jslib/content Added Files: aboutDialog.xul Log Message: Task #106454 - include jslib. --- NEW FILE: aboutDialog.xul --- <?xml version="1.0"?> <!-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is the jslib team. Original Author: Brian King <br...@mo...> Contributor(s): --> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://slashhack/content/resources/js/jslib/jslib/skin/aboutDialog.css" type="text/css"?> <!DOCTYPE dialog SYSTEM "chrome://slashhack/content/resources/js/jslib/jslib/locale/en-US/aboutDialog.dtd"> <dialog title="&about.dialog.title;" id="aboutDialog" onload="onloadAbout();" buttons="accept" xmlns:html="http://www.w3.org/199/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/jslib.js"/> <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/jslib/content/js/aboutDialog.js" /> <vbox id="mainbox"> <hbox pack="start"> <image src="chrome://slashhack/content/resources/js/jslib/icons/jslib-icon.png" /> </hbox> <separator/> <vbox align="center" style="padding-bottom: 20px;"> <hbox> <label id="jslibVersion" value="&about.version.label;"/> <label id="jslibVersionNum" value="0.1.205"/> </hbox> </vbox> <separator class="groove" /> <vbox align="right" style="padding-top: 20px;"> <hbox> <label class="linklabel" value="jsLib" href="http://jslib.mozdev.org" onclick="goLink(event);"/> <label value="&about.jslib.label;" /> </hbox> <hbox style="padding-top: 20px;"> <label value="&about.mozdev.label1;"/> <label class="linklabel" value="&about.mozdev.label2;" href="http://www.mozdev.org" onclick="goLink(event);"/> </hbox> <separator/> <image src="http://www.mozdev.org/sharedimages/mozdev37.png" /> </vbox> </vbox> <separator/> </dialog> |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:24
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/ds In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/ds Added Files: chainDictionary.js dictionary.js Log Message: Task #106454 - include jslib. --- NEW FILE: dictionary.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ if (typeof(JS_LIB_LOADED)=='boolean') { const JS_DICTIONARY_FILE = "dictionary.js"; const JS_DICTIONARY_LOADED = true; function Parameter(k, v) { this.key = k; this.value = v; } Parameter.prototype = { key:null, value:null } //stores a set of keys and associated values function Dictionary() { this._array = new Array(); } Dictionary.prototype = { _array: null, _iterind: 0, //if key exists, will replace current value with value arg put: function(key,value) { if( key ==null || value == null ) return this; var ind = -1; for(var i = 0; i < this._array.length; i++ ) if( this._array[i].key == key ) { ind = i; break; } if( ind == -1 ) { var p = new Parameter(key,value); this._array.push(p); } else { this._array[ind].value = value; } return this; }, get: function(key) { for(var i = 0; i < this._array.length; i++ ) if( this._array[i].key == key ) return this._array[i].value; return null; }, remove: function(key) { for(var i = 0; i < this._array.length; i++ ) if( this._array[i].key == key ) { this._array.splice(i,1); } }, keys: function() { var list = new Array(); for(var i = 0; i < this._array.length; i++ ) list.push(this._array[i].key); return list; }, //checks if dict has a key, and if it does, sets value to //the value in dict hasKey: function(key, value) { value = null; for(var i = 0; i < this._array.length; i++ ) if( this._array[i].key == key ) { value = this._array[i].value; return true; } return false; }, get size() { return _array.length; }, //object related toString: function() { return "Array :" + _array.length; }, //iterator related //iterates over each Parameter resetIterator: function() { this._iterind = 0; }, hasMoreElements: function() { if( this._iterind < this._array.length ) return true; else return false; }, next: function(key, value) { return this._array[this._iterind++]; } } jslibDebug('*** load: '+JS_DICTIONARY_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_dictionary);\n\n"); }; --- NEW FILE: chainDictionary.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Contributor(s): Rajeev J Sebastian <raj...@ya...)> (original author) *************************************/ //string keys and values if (typeof(JS_LIB_LOADED)=='boolean') { if (typeof(JS_DICTIONARY_LOADED)!='boolean') include(jslib_ds_dictionary); const JS_CHAINDICTIONARY_FILE = "chainDictionary.js"; const JS_CHAINDICTIONARY_LOADED = true; function ChainDictionary() { this._default = new Dictionary(); this._chained = new Array(); this.put(_default); //add the default to the chain as well } ChainDictionary.prototype = { _default: null, _chained: null, //iterator related _chainind: null, //if key exists, will replace current value with value arg put: function(key,value) { if( key == null || value == null) return this; for( var i = 0; i < this._chained.size(); i++ ) { if( this._chained.hasKey(key) ) { this._chained[i].put(key, value); dictind = i; break; } } if( dictind == -1 ) { this._default.put(key, value); } return this; }, put: function(dictionary) { if( dictionary == null ) return this; this._chained.push(dictionary); return this; } get: function(key) { for( var i = 0; i < this._chained.size(); i++ ) { var value = this._chained[i].get(key); if( value ) return value; } return null; }, remove: function(key) { for(var i = 0; i < this._chained.size(); i++ ) remove(key); }, keys: function() { var list = new Array(); for(var i = 0; i < this._chained.length; i++ ) list.concat(this._chained.keys()); return list; }, toString: function() { var size; for(var i = 0; i < this._chained.length; i++ ) size += this._chained.size(); return "Array :" + size; }, get size() { var size; for(var i = 0; i < this._chained.length; i++ ) size += this._chained.size(); return size; }, //iterator //iterates over each Parameter resetIterator: function() { this._chainind = 0; for(var i = 0; i < this._chained.length; i++ ) this._chained[i].resetIterator(); }, hasMoreElements: function() { //if there are more dicts after the current in the chain if ( this._chainind < this._chained.length -1 ) return true; //if there are more elements in the current dict else return this._chained[_chainind].hasMoreElements(); }, next: function() { if( !this._chained[_chainind].hasMoreElements() ) this._chainind++; return this._chained[_chainin].getNext(); } } jslibDebug('*** load: '+JS_CHAINDICTIONARY_FILE+' OK'); } // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_BASE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_chaindictionary);\n\n"); }; |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:49:23
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4907/install Added Files: autoupdate.js install.js uninstall.js uninstall.xul Log Message: Task #106454 - include jslib. --- NEW FILE: autoupdate.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): ***/ if (typeof(JS_LIB_LOADED)=='boolean') { const JS_AUTOUPDATE_LOADED = true; const JS_AUTOUPDATE_FILE = 'autoupdate.js'; // Constructor function AutoUpdate (aRemoteFile, aPackageName, aContent, aCallback) { // jslibTurnDumpOn(); // pull in dependent libs include (jslib_remotefile); include (jslib_dir); include (jslib_file); include (jslib_dirutils); include (jslib_prefs); if (!(aRemoteFile && aPackageName)) throw "Missing: aRemoteFile or aPackageName"; var ext = aRemoteFile.substring(aRemoteFile.lastIndexOf(".")+1, aRemoteFile.length); switch (ext) { case "xpi": case "jar": case "rdf": break; default: jslibDebug("Bad Remote File"); throw "Invalid Mozilla package file"; } this.mPackageExt = ext; this.mRemoteFile = aRemoteFile; this.mPackageName = aPackageName; this.mContent = aContent; this.mCallback = aCallback; } AutoUpdate.prototype = { mRemoteFile:null, mPackageName:null, mPackageExt:null, mRemoteVersion:null, mLocalVersion:null, mRemoteURL:null, mContent:null, mDataSource:null, mCallback:null, CHROME_NS:"http://www.mozilla.org/rdf/chrome#", // main API use to check for updates checkForUpdate : function () { var rv; switch (this.mPackageExt) { case "xpi": rv = this.checkByTimeStamp(); break; case "rdf": rv = this.checkByRDF(); break; } return rv; }, // checking by time stamp is one way to do it // not necessarily the best checkByTimeStamp : function () { var rf = new RemoteFile (this.mRemoteFile); if (!rf.exists()) throw this.mRemoteFile + " wasn't found"; // get the remote xpi time stamp var lastModified = new Date(rf.lastModified); // check and see what and where the package file is var pkgTS = this.packageTimeStamp(); var remoteTS = lastModified.getTime(); var localTS = pkgTS.getTime() + 200000; // fuzz add two hours // local and server clocks // are never exact so we ballpark jslibDebug("Remote Package Time Stamp: "+remoteTS); jslibDebug("Local Package Time Stamp: "+localTS); var rv = (remoteTS > localTS); return rv; }, packageTimeStamp : function () { var du = new DirUtils(); var fTest = du.getChromeDir()+"/"+this.mPackageName; var d = new Dir(fTest); var dateModified; // check global chrome first if (d.isDir()) { dateModified = d.dateModified; } else { fTest += ".jar"; var f = new File(fTest); if (f.exists()) dateModified = f.dateModified; } // check user chrome if (!dateModified) { fTest = du.getUserChromeDir()+"/"+this.mPackageName+".jar"; f = new File(fTest); if (f.exists()) dateModified = f.dateModified; jslibDebug(dateModified); jslibDebug(f.path); } return dateModified; }, checkByRDF : function () { var RDF = this.RDF; var observer = { onBeginLoad : function (sink) {}, onInterrupt : function (sink) {}, onResume : function (sink) {}, onError : function (sink,status,msg) {}, onEndLoad : function (sink) { var RDF = this.o.RDF; var packres = RDF.GetResource("urn:mozilla:package:" + this.o.mPackageName); var packageVersionPred = RDF.GetResource(this.o.CHROME_NS + "packageVersion") var version = this.o.mDataSource.GetTarget(packres, packageVersionPred, true); var packageURLPred = RDF.GetResource(this.o.CHROME_NS + "packageURL") var url = this.o.mDataSource.GetTarget(packres, packageURLPred, true); if (version instanceof jslibI.nsIRDFLiteral) var packageVersion = version.Value; this.o.mRemoteVersion = packageVersion; if (url instanceof jslibI.nsIRDFLiteral) var packageURL = url.Value; this.o.mRemoteURL = packageURL; // callback function if (typeof(this.o.mCallback)=="function") this.o.mCallback(); this.o.verifyVersions(); sink.removeXMLSinkObserver(this); jslibQI(sink, "nsIRDFDataSource"); } }; var ds = RDF.GetDataSource(this.mRemoteFile); this.mDataSource = ds; jslibQI(ds, "nsIRDFXMLSink"); ds.addXMLSinkObserver(observer); // add autoupdate object as property to observer observer.o = this; }, verifyVersions : function () { this.mLocalVersion = this.getLocalVersion(); // strip out any version dots. // rv = remote version, lv = local version var rv = parseInt(this.mRemoteVersion.replace(/\./g, ""), 10); var lv = parseInt(this.mLocalVersion.replace(/\./g, ""), 10); if (rv > lv) { var message = this.mPackageName + " version: " + this.mRemoteVersion + " is now available for download" + "\nWould you like to update now?"; var ps = jslibGetService("@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService"); // check to see if Ignore Updates is set var prefs = new Prefs(); const pref = "jslib.autoupdate.checkForUpdates"; var prefValue; if (prefs.getType(pref) == 0) prefValue = true; else prefValue = prefs.getBool(pref); jslibPrint("type: "+prefValue); jslibPrint("check: "+prefs.getBool(pref)); // if no pref value we bolt if (!prefValue) return; var checkValue = { value:prefValue }; try { // XXX yes, I know these strings need localizaton // Brian, you are good at that! :) var conf = ps.confirmCheck(this.mContent, "AutoUpdate", message, "Always Check for New Updates", checkValue); } catch(e) { jslibDebug(e); } jslibPrint("checkValue: "+checkValue.value); // XXX if checkbox is set let's set the pref prefs.setBool(pref, checkValue.value); prefs.save(); jslibPrint("confirm: "+conf); if (checkValue.value && conf) this.autoupdate(); else jslibDebug("No Update Made"); } else { jslibDebug("Local Version: "+this.mLocalVersion); jslibDebug("Remote Version: "+this.mRemoteVersion); jslibDebug("No Update Necessary"); } }, // returns the installed local package version from chrome/chrome.rdf getLocalVersion : function () { var rv; var du = new DirUtils(); var f = "file://"+du.getChromeDir()+"/chrome.rdf"; var RDF = this.RDF; var ds = RDF.GetDataSourceBlocking(f); var packres = RDF.GetResource("urn:mozilla:package:" + this.mPackageName); var packageVersionPred = RDF.GetResource(this.CHROME_NS + "packageVersion") var version = ds.GetTarget(packres, packageVersionPred, true); if (version instanceof jslibI.nsIRDFLiteral) rv = version.Value; return rv; }, get RDF () { return jslibGetService("@mozilla.org/rdf/rdf-service;1", "nsIRDFService"); }, get datasource () { return this.mDataSource; }, autoupdate : function () { this.mContent.location = this.mRemoteURL; } } } // END BLOCK JS_LOADED CHECK // If jslib base library is not loaded, dump this error. else { dump("JS_AUTOUPDATE library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include (jslib_autoupdate);\n\n"); } --- NEW FILE: uninstall.xul --- <?xml version="1.0"?> <!-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Mozdev Group, Inc. code. The Initial Developer of the Original Code is Mozdev Group, Inc. Portions created by Mozdev Group, Inc. are Copyright (C) 2003 Mozdev Group, Inc. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): --> <!-- ***************** STYLE SHEET ****************** --> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://slashhack/content/resources/js/jslib/install/uninstall.css" type="text/css"?> <!-- ***************** STYLE SHEET ****************** --> <!DOCTYPE wizard> <wizard id="uninstallWizard" title="Uninstall Wizard" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onwizardcancel="// return onCancel();" onwizardfinish="finish();" onload="initWizard();"> <script type="application/x-javascript" src="chrome://slashhack/content/resources/js/jslib/jslib.js" /> <script> <![CDATA[ include (jslib_routines); include (jslib_uninstall); var gPackageName = window.arguments[0]; var gInstallCallback = window.arguments[1]; var gUninstall = new Uninstall(gPackageName, gInstallCallback); function initWizard() { document.documentElement.pageIndex = 0; gUninstall.generateUninstallInfo(); const msg1 = "The package "; const msg2 = " will be removed."; var text = document.createTextNode(msg1 + gUninstall.packageDisplayName + msg2); document.getElementById("uninstallText").appendChild(text); } function uninstallPackage () { jslibDebug("uninstallPackage"); gUninstall.closeOpenWindows(); var wizard = document.getElementById("uninstallWizard"); wizard.canRewind = false; wizard.canAdvance = false; var pmeter = document.getElementById("uninstallProgress"); gUninstall.uninstallPackage(); } function finish () { gUninstall.finish(); } function displayFilesToDelete() { document.getElementById("showFilesButton").hidden = true; document.getElementById("filesBlock").hidden = false; var listbox = document.getElementById("filesList"); var files = gUninstall.filesToDelete; for (var t=0; t<files.length; t++){ try { var filename = files[t].leafName; listbox.appendItem(filename,filename); } catch (ex){ jslibDebug(ex); } } } ]]> </script> <wizardpage pageid="page1" next="page2" label="Uninstall"> <description id="uninstallText" class="text"/> <separator/> <description id="uninstallText2" class="text"> All open windows will be closed before the package is removed. </description> <separator/> <hbox> <button id="showFilesButton" label="Show files to be deleted" oncommand="displayFilesToDelete();" /> </hbox> <vbox id="filesBlock" hidden="true" flex="1"> <label value="Files to be deleted:"/> <listbox id="filesList" flex="1"/> </vbox> </wizardpage> <wizardpage pageid="page2" label="Uninstall" onpageshow="uninstallPackage();"> <label id="progressText" class="text" value="Uninstalling general data" /> <progressmeter id="uninstallProgress" value="0" /> </wizardpage> </wizard> --- NEW FILE: uninstall.js --- /*** -*- Mode: Javascript; tab-width: 2; The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2003 jslib team. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): Neil Deakin <ne...@mo...> ***/ // STATUS: WORK IN PROGRESS // Make sure jslib.js is loaded if (typeof(JS_LIB_LOADED) == 'boolean') { // Ensure we are in a DOM window environment if (typeof(window) == 'undefined') { jslibDebug("Error: This library can only be used in a dom window environment"); } else { // Load dependency lib files include(jslib_file); include(jslib_dirutils); include(jslib_dir); include(jslib_fileutils); include(jslib_window); // GLOBALS const JS_LIB_UNINSTALL_LOADED = true; const JS_LIB_UNINSTALL_FILE = 'uninstall.js'; // CONSTRUCTOR function Uninstall(aPackageName, installCallback) { if (!aPackageName) { throw - jslibRes.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } else { if (typeof(aPackageName) == "string"){ this.mNames = [aPackageName]; } else { this.mNames = aPackageName; } } this.mInstallCallback = installCallback; this.gRDF = jslibGetService("@mozilla.org/rdf/rdf-service;1", "nsIRDFService"); this.gDirService = jslibGetService("@mozilla.org/file/directory_service;1", "nsIProperties"); } /*********** UNINSTALL ***************/ Uninstall.prototype = { // set ACTIVE_MODE to false for debugging, and changes will only be simulated. ACTIVE_MODE : true, gRDF : null, gDirService : null, CHRM_REG_CID : "@mozilla.org/chrome/chrome-registry;1", CHROME_NS : "http://www.mozilla.org/rdf/chrome#", mNames : null, mLastURL : "about:blank", mLastChromeURL : null, mUninstallInfoGenerated : false, mInstallCallback : null, filesToDelete : [], filesToDeleteHash : {}, overlaysToDelete : [], baseURIs : {}, packageDisplayName : "", closeOpenWindows : function () { if (!this.ACTIVE_MODE) return; jslibDebug(opener.location); // jslibDebug(opener._content.location); this.mLastChomeURL = opener.location.toString(); try { this.mLastURL = opener._content.location.toString(); } catch (e) {} var win = new CommonWindow(); var openWindows = win.openWindows; for (var i=0; i<openWindows.length; i++) { if (/chrome:\/\/jslib\/content\/install\/uninstall.xul/.test(openWindows[i].location)) { jslibPrint("Skipping: "+openWindows[i].location); continue; } openWindows[i].close(); } return; }, launchLastWindow : function () { if (!this.mLastChomeURL) return; window.openDialog(this.mLastChomeURL, "_blank", "chrome,all,dialog=no", this.mLastURL); }, finish : function () { this.launchLastWindow(); }, generateUninstallInfo : function () { if (!this.mUninstallInfoGenerated){ this.mUninstallInfoGenerated = true; this.filesToDelete = []; this.filesToDeleteHash = {}; this.overlaysToDelete = []; this.baseURIs = {}; this.doUninstall(false); } }, uninstallPackage : function () { this.generateUninstallInfo(); this.doUninstall(true); }, /** * Iterates over the items in an RDF Container */ iterateContainer : function(ds, resource, callback) { try { var container = jslibCreateInstance("@mozilla.org/rdf/container;1", "nsIRDFContainer"); container.Init(ds, resource); } catch (ex){ return; } var elements = container.GetElements(); while (elements.hasMoreElements()){ var element = elements.getNext(); callback(resource, element, this); } }, /** * Get all of the currently installed packages. This function is not currently used. */ getAllPackagesInfo : function(chromeDS) { var allPackages = {}; var handlePackages = function(container, packres, uninstallObj) { var childPred = uninstallObj.gRDF.GetResource(uninstallObj.CHROME_NS + "name") var childName = chromeDS.GetTarget(packres, childPred, true); var displayPred = uninstallObj.gRDF.GetResource(uninstallObj.CHROME_NS + "displayName") var displayName = chromeDS.GetTarget(packres, displayPred, true); if (childName instanceof jslibI.nsIRDFLiteral){ if (displayName instanceof jslibI.nsIRDFLiteral){ displayName = displayName.Value; } else { displayName = childName.Value; } allPackages[childName.Value] = displayName; } } var rootseq = this.gRDF.GetResource("urn:mozilla:package:root"); this.iterateContainer(chromeDS, rootseq, handlePackages); }, /** * Do the uninstallation. This function will be called twice. Once to generate * the list of files and overlays to delete, and the second to do the deletions. */ doUninstall : function(makeChanges) { var ioService = jslibGetService("@mozilla.org/network/io-service;1", "nsIIOService"); // scan through chrome.rdf and find all references to the package and remove them. var appChromeDir = this.gDirService.get("AChrom", jslibI.nsIFile); var chromeRdfFile = appChromeDir.clone(); chromeRdfFile.append("chrome.rdf"); var chromeUrl = ioService.newFileURI(chromeRdfFile).spec; var appChromeDS = this.gRDF.GetDataSourceBlocking(chromeUrl); for (var pt = 0; pt < this.mNames.length; pt++){ this.handleChromeRDF(this.mNames[pt], appChromeDir, appChromeDS, makeChanges); } // scan through chrome.rdf and find all references to the package and remove them. var userChromeDir = this.gDirService.get("UChrm", jslibI.nsIFile); chromeRdfFile = userChromeDir.clone(); chromeRdfFile.append("chrome.rdf"); chromeUrl = ioService.newFileURI(chromeRdfFile).spec; var userChromeDS = this.gRDF.GetDataSourceBlocking(chromeUrl); for (var pt = 0; pt < this.mNames.length; pt++){ this.handleChromeRDF(this.mNames[pt], userChromeDir, userChromeDS, makeChanges); } if (makeChanges){ if (this.ACTIVE_MODE){ if (appChromeDS instanceof jslibI.nsIRDFRemoteDataSource) appChromeDS.Flush(); if (userChromeDS instanceof jslibI.nsIRDFRemoteDataSource) userChromeDS.Flush(); } if (this.mInstallCallback) this.mInstallCallback(this.filesToDelete,true); for (t=0; t<this.overlaysToDelete.length; t++){ this.removeOverlay(this.overlaysToDelete[t]); } this.removeFromInstalledChrome(appChromeDir); var uninstallObj = this; var callback = function() { uninstallObj.doNextUninstallStep(uninstallObj,0); } setTimeout(callback,50); } else { if (this.mInstallCallback) this.mInstallCallback(this.filesToDelete,false); } }, doNextUninstallStep : function(uninstallObj,step) { jslibPrint("doNextUninstallStep"); var pmeter = document.getElementById("uninstallProgress"); if (step >= uninstallObj.filesToDelete.length){ pmeter.value = 100; document.getElementById("progressText").value = "Uninstall Complete"; var wizard = document.getElementById("uninstallWizard"); wizard.canAdvance = true; return; } var adj = Math.round(100 / uninstallObj.filesToDelete.length); if (adj < 5){ if (step % Math.round(uninstallObj.filesToDelete.length / 20)) adj = 5; else adj = 0; } pmeter.value = parseInt(pmeter.value) + adj; // ignore errors since it doesn't matter if a file could not be found, and // non-empty directories should not be deleted. try { var file = uninstallObj.filesToDelete[step]; var path = file.path; document.getElementById("progressText").value = "Uninstalling " + file.leafName; var ext = path.substring(path.lastIndexOf(".")+1, path.length); // close the jar filehandle so we can unlock it and delete it on // OS's like Windows that like to lock their open files if (ext == "jar") { var IOService = jslibGetService("@mozilla.org/network/io-service;1", "nsIIOService"); var handler = IOService.getProtocolHandler("jar"); if (handler instanceof jslibI.nsIJARProtocolHandler) { var zrc = handler.JARCache; var nsIZipReader = zrc.getZip(file); nsIZipReader.close(); } } jslibDebug("Uninstall ---- Delete " + file.path + "\n"); if (this.ACTIVE_MODE && file.exists()) file.remove(false); } catch (ex){ jslibDebug(ex); } var callback = function() { uninstallObj.doNextUninstallStep(uninstallObj,step + 1); } setTimeout(callback,50); }, /** * Gather information about the package from a chrome.rdf file and remove it. */ handleChromeRDF :function(packagename, chromeDir, chromeDS, makeChanges) { // remove package from content var rootseq = this.gRDF.GetResource("urn:mozilla:package:root"); var packres = this.gRDF.GetResource("urn:mozilla:package:" + packagename); if (makeChanges){ this.removeFromChrome(chromeDS, rootseq, packres); } else { this.generateUninstallData(chromeDS, rootseq, packres, chromeDir); if (!this.packageDisplayName){ var displayNamePred = this.gRDF.GetResource(this.CHROME_NS + "displayName") var displayName = chromeDS.GetTarget(packres, displayNamePred, true); if (displayName instanceof Components.interfaces.nsIRDFLiteral){ this.packageDisplayName = displayName.Value; } else { this.packageDisplayName = packagename; } } } // remove package from skin var provider = "skin"; var handleSkinLocaleList = function(container, skinLocale, uninstallObj) { var rootseq = chromeDS.GetTarget(skinLocale, uninstallObj.gRDF.GetResource(uninstallObj.CHROME_NS + "packages"),true); rootseq.QueryInterface(jslibI.nsIRDFResource); var skinLocaleName = chromeDS.GetTarget(skinLocale, uninstallObj.gRDF.GetResource(uninstallObj.CHROME_NS + "name"),true); if (skinLocaleName instanceof jslibI.nsIRDFLiteral){ var skinLocaleRes = uninstallObj.gRDF.GetResource("urn:mozilla:" + provider + ":" + skinLocaleName.Value + ":" + packagename); if (makeChanges) uninstallObj.removeFromChrome(chromeDS, rootseq, skinLocaleRes); else uninstallObj.generateUninstallData(chromeDS, rootseq, skinLocaleRes, chromeDir); } }; var packreslist = this.gRDF.GetResource("urn:mozilla:skin:root"); this.iterateContainer(chromeDS, packreslist, handleSkinLocaleList); // remove package from locale provider = "locale"; packreslist = this.gRDF.GetResource("urn:mozilla:locale:root"); this.iterateContainer(chromeDS, packreslist, handleSkinLocaleList); }, /** * Perform an uninstallation given a contents.rdf datasource. * aChromeDS - chrome.rdf datasource * rootseq - root sequence * packres - packagename as a resource */ generateUninstallData : function(chromeDS, rootseq, packres, chromeDir) { var baseUrlPred = this.gRDF.GetResource(this.CHROME_NS + "baseURL") var baseUrl = chromeDS.GetTarget(packres, baseUrlPred, true); if (baseUrl instanceof jslibI.nsIRDFLiteral){ var ds; try { ds = this.gRDF.GetDataSourceBlocking(baseUrl.Value + "contents.rdf"); } catch (ex){ jslibDebug(ex); return; } this.markJarForDeletion(baseUrl.Value); this.generateFilesToDelete(ds, packres); this.generateOverlaysToDelete(ds, chromeDir, "overlays"); this.generateOverlaysToDelete(ds, chromeDir, "stylesheets"); } }, /** * Generate the files to delete, which are listed in the uninstallInfo section * of the contents.rdf */ generateFilesToDelete : function(aDS, node) { var pred = this.gRDF.GetResource(this.CHROME_NS + "uninstallInfo"); var uninstallInfo = aDS.GetTarget(node,pred,true); if (uninstallInfo){ this.iterateContainer(aDS, uninstallInfo, this.makeFileForDeletion); } }, /** * Mark a file for deletion. */ makeFileForDeletion : function(container, filename, uninstallObj) { if (!(filename instanceof jslibI.nsIRDFLiteral)) return; filename = filename.Value; var filekey; var colonIdx = filename.indexOf(":"); if (colonIdx >= 0){ filekey = filename.substring(0,colonIdx); filename = filename.substring(colonIdx + 1); } else { filekey = "CurProcD"; } var file; try { file = uninstallObj.gDirService.get(filekey, jslibI.nsIFile); } catch (ex) { return; } var fileparts = filename.split("/"); for (var t=0; t<fileparts.length; t++){ file.append(fileparts[t]); } if (!uninstallObj.filesToDeleteHash[file.path]){ uninstallObj.filesToDeleteHash[file.path] = file; uninstallObj.filesToDelete.push(file); } }, /** * Given a baseURI reference, determine the JAR file to delete. */ markJarForDeletion : function(url) { this.baseURIs[url] = url; if (url.indexOf("jar:")) return; var jarfile; url = url.substring(4); var expos = url.indexOf("!"); if (expos > 0){ url = url.substring(0,expos); if (url.indexOf("resource:/") == 0){ url = url.substring(10); jarfile = this.gDirService.get("CurProcD", jslibI.nsIFile); var fileparts = url.split("/"); for (var t=0; t<fileparts.length; t++){ jarfile.append(fileparts[t]); } } else if (url.indexOf("file://") == 0){ var ioService = jslibGetService("@mozilla.org/network/io-service;1", "nsIIOService"); var fileuri = ioService.newURI(url,"",null); if (fileuri instanceof jslibI.nsIFileURL){ jarfile = fileuri.file; } } } if (!this.filesToDeleteHash[jarfile.path]){ this.filesToDeleteHash[jarfile.path] = jarfile; this.filesToDelete.push(jarfile); } }, /** * Generate the list of overlays referenced in a contents.rdf file. */ generateOverlaysToDelete : function(aDS, chromeDir, overlayType) { var iterateOverlays = function(container, overlayFile, uninstallObj) { if ((container instanceof jslibI.nsIRDFResource) && (overlayFile instanceof jslibI.nsIRDFLiteral)){ uninstallObj.overlaysToDelete.push( { overlaidFile: container, overlayFile: overlayFile, chromeDir : chromeDir, type: overlayType }); } } var iterateOverlaids = function(container, overlaidFile, uninstallObj) { uninstallObj.iterateContainer(aDS, overlaidFile, iterateOverlays); } var oroot = this.gRDF.GetResource("urn:mozilla:" + overlayType); this.iterateContainer(aDS, oroot, iterateOverlaids); }, /** * Remove an overlay from the overlayinfo. */ removeOverlay : function(overlay) { jslibPrint("removeOverlay"); var overlayItems = this.splitURL(overlay.overlaidFile.Value); var overlayRdfFile = overlay.chromeDir.clone(); overlayRdfFile.append("overlayinfo"); overlayRdfFile.append(overlayItems.packagename); overlayRdfFile.append(overlayItems.provider); overlayRdfFile.append(overlay.type + ".rdf"); var ioService = jslibGetService("@mozilla.org/network/io-service;1", "nsIIOService"); var overlayRdfUrl = ioService.newFileURI(overlayRdfFile).spec; var dsource = this.gRDF.GetDataSourceBlocking(overlayRdfUrl); try { jslibDebug("Uninstall ---- Uncontain Overlay " + this.RDFGetValue(overlay.overlayFile) + " from " + this.RDFGetValue(overlay.overlaidFile) + "\n"); var container = jslibCreateInstance("@mozilla.org/rdf/container;1", "nsIRDFContainer"); container.Init(dsource, overlay.overlaidFile); if (this.ACTIVE_MODE) container.RemoveElement(overlay.overlayFile, true); } catch (ex) { jslibDebug(ex); } if (this.ACTIVE_MODE && dsource instanceof jslibI.nsIRDFRemoteDataSource) dsource.Flush(); }, /** * split a chrome URL into component parts. * * The algorithm was taken from mozilla/rdf/chrome/src/nsChromeRegistry.cpp */ splitURL : function(url) { if (url.indexOf("chrome://")) return null; var packagename = url.substring(9); var slashidx = packagename.indexOf("/"); if (slashidx == -1) return null; var provider = packagename.substring(slashidx + 1); packagename = packagename.substring(0,slashidx); slashidx = provider.indexOf("/"); if (slashidx >= 0){ provider = provider.substring(0,slashidx); } return { packagename: packagename, provider: provider }; }, /** * Useful debugging function to convert an nsIRDFNode into a string. */ RDFGetValue : function(node) { return ((node instanceof jslibI.nsIRDFResource) ? node.Value : ((node instanceof jslibI.nsIRDFLiteral) ? node.Value : "")); }, /** * Remove references to a package from chrome.rdf. */ removeFromChrome : function (dsource, rootseq, packres) { jslibPrint("removeFromChrome"); var packresnode = packres.QueryInterface(jslibI.nsIRDFNode); try { jslibDebug("Uninstall ---- Uncontain " + packres.Value + " from " + rootseq.Value + "\n"); var container = jslibCreateInstance("@mozilla.org/rdf/container;1", "nsIRDFContainer"); container.Init(dsource, rootseq); if (this.ACTIVE_MODE) container.RemoveElement(packresnode, true); } catch (ex) { jslibDebug(ex); } var arcs = dsource.ArcLabelsOut(packres); while(arcs.hasMoreElements()) { var arc = arcs.getNext(); var prop = arc.QueryInterface(jslibI.nsIRDFResource); var targets = dsource.GetTargets(packres, prop, true); while (targets.hasMoreElements()) { var target = targets.getNext(); var targetNode = target.QueryInterface(jslibI.nsIRDFNode); jslibDebug("Uninstall ---- Unassert [" + packres.Value + " , " + prop.Value + " , " + this.RDFGetValue(target) + "]\n"); if (this.ACTIVE_MODE) dsource.Unassert(packres, prop, targetNode); } } }, removeFromInstalledChrome : function(chromeDir) { jslibPrint("removeFromInstalledChrome"); chromeDir.append("installed-chrome.txt"); var ifile = new File(chromeDir.path); ifile.open("r"); var changeNeeded = false; try { var content = ""; while (!ifile.EOF){ var found = false; var ln = ifile.readline(); for (uri in this.baseURIs){ var idx = ln.indexOf(uri); if ((idx > 0) && (idx == ln.length - uri.length)){ jslibDebug("Uninstall ---- Removing from installed-chrome.txt : " + ln + "\n"); found = true; changeNeeded = true; } } if (!found) content += ln + "\n"; } } finally { ifile.close(); } if (this.ACTIVE_MODE && changeNeeded){ ifile.open("w",0664); try { ifile.write(content); } finally { ifile.close(); } } } } // END CLASS jslibDebug('*** load: '+JS_LIB_UNINSTALL_FILE+' OK'); } // END BLOCK DOM WINDOW CHECK // END BLOCK JS_LIB_LOADED CHECK // If jslib base library is not loaded, dump this error. } else { const JS_LIB_UNINSTALL_LOAD_MSG = "JS_LIB_UNISTALL library not loaded:\n" + " \tTo load use: chrome://slashhack/content/resources/js/jslib/jslib.js\n" + " \tThen: include(jslib_uninstall);\n\n"; dump(JS_LIB_UNINSTALL_LOAD_MSG); } --- NEW FILE: install.js --- /* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is jslib team code. The Initial Developer of the Original Code is jslib team. Portions created by jslib team are Copyright (C) 2000 jslib team. All Rights Reserved. Original Author: Pete Collins <pe...@mo...> Contributor(s): */ //Prefs var htmlresults = false; var installName = "Beonex Communicator 0.6"; var installPage = "http://www.beonex.com/communicator/version/0.6/install"; //Other global vars // for exclusive const anymozilla = 0; // any Mozilla const sameversion = 1; // this Mozilla release only, e.g. Mozilla 0.6/Netscape 6.0/Beonex Comm. 0.6 const samevendorrelease = 2; // this vendor release only, e.g. Beonex Comm. 0.6 var newline; if (htmlresults) newline = "<br>"; else newline = "\n"; var numstatus = 0; var numxpi = 0; var gxpi; function statusCallback(url, status) { for (i in gxpi) { if ( url.indexOf(gxpi[i]) != -1 ) { gxpi[i] = status; numstatus++; break; } } // if we've gotten all results then display them if (numstatus == numxpi) { var restart = false; var textResults = ""; var textInstructions = ""; for (i in gxpi) { textResults += i + ": "; switch (status) { case 999: restart = true; // fall-through case 0: textResults += "Successful"; restart = true; //XXX break; case -210: textResults += "Cancelled"; break; default: textResults += "Error encountered -- "+status; break; } textResults += newline; } if (restart) { textInstructions += "Please restart Communicator."; if (isWindows()) textInstructions += " If you are using Win9x (incl. Windows ME), restart your computer."; } if (htmlresults) { dlg = window.open("","resultWindow"); //open(,, "width=400,height=300,scrollbars=yes,resizable=yes"); XXX dlg.document.write("<he" + "ad>" + "<tit" + "le>" + "XPInstall Results" + "</tit" + "le>" + "</he" + "ad>"); dlg.document.write("<bo" + "dy>" + "<h1>Installation Results</h1>"); dlg.document.write(textResults); if (textInstructions != "") { dlg.document.write("<h1>Instructions</h1>"); dlg.document.write(textInstructions); } dlg.document.write("<p><center><f" + "orm name=\"okclose\">" + "<i" + "nput type=button " + "on" + "Click=\"window.close();\" " + "on" + "Command=\"window.close();\" " + "value=\"OK\">" + "</center></f" + "orm>"); dlg.document.write("</bo" + "dy>"); dlg.document.close(); } else { alert(textResults + newline + textInstructions); } } } function isWindows() { return (navigator.platform.indexOf("Win") == 0); } function isLinux() { return (navigator.platform.indexOf("Linux") == 0); } function isMac() { return (navigator.platform.indexOf("Mac") != -1); } function badPlatform() { alert("Platform not recognized"); } function gotoInstallPage() { document.location.href = installPage; } // exclusive: anymozilla, sameversion or samevendorrelease function browserOK(exclusive) { if (exclusive == anymozilla) { if (typeof InstallTrigger == "object") return true; else { if(window.confirm("This package is intended only for Beonex Communicator, Netscape 6 or Mozilla.\nWould you like to download " + installName + "?")) gotoInstallPage(); return false; } } else if (exclusive == sameversion) { var start = navigator.userAgent.indexOf("Gecko/") + 6; var build = parseInt(navigator.userAgent.substring(start, start + 8)); if (typeof InstallTrigger == "object" && build >= 20001100) return true; else { if(window.confirm("This package is intended only for Beonex Communicator 0.6, Netscape 6.0 or Mozilla 0.6.\nWould you like to download " + installName + "?")) gotoInstallPage(); return false; } } else if (exclusive == samevendorrelease) { if (typeof InstallTrigger == "object" && navigator.vendor && navigator.vendor == "Beonex" && navigator.vendorSub && navigator.vendorSub.substr(0,3) == "0.6") return true; else { if(window.confirm("This package is intended for Beonex Communicator 0.6 only.\nWould you like to download " + installName + "?")) gotoInstallPage(); return false; } } else { alert("Fatal error: Bug on Website"); return false; } } // xpi = Array for InstallTrigger // exclusive = see above function startInstall(xpi, exclusive) { if (!browserOK(exclusive)) return; gxpi = xpi; for (i in xpi) { numxpi++; } InstallTrigger.install(xpi,statusCallback); } // genLaunch - Generic Launcher: picks up package URLs and names from document. // idClass = Class of package to be installed. // Use empty string to install all packages. // exclusive = see above // // Example: // <a class="dlLinux,java" name="Java RE" href="http://foo/bar-ix.xpi">bla</a> // <a class="dlLinux,psm" name="PSM" href="http://foo/baz-ix.xpi">bla bla</a> // <a class="dlWin32,java" name="Java RE" href="http://foo/bar-win.xpi">bla</a> // <a class="dlWin32,psm" name="PSM" href="http://foo/baz-win.xpi">bla bla</a> // <div onclick="genLaunch('java',1)>button 1</div> // <div onclick="genLaunch('',1)>button 2</div> // If you click on button 1, the Java package for your platform // will be installed. // If you click on button 2, both the Java and PSM package for your platform // will be installed. function genLaunch(idClass, exclusive) { if (!browserOK(exclusive)) // make sure, older browsers don't fail below return; var platformClass; if (isWindows()) platformClass = "dlWin32"; else if (isLinux()) platformClass = "dlLinux"; else if (isMac()) platformClass = "dlMac"; else { badPlatform(); return; } // "dlAll" is OK, too. var xpi = new Array(); var found = false; var elems = document.getElementsByTagName("A"); for (var i = 0; i < elems.length; i++) { var elem = elems.item(i); var attrs = elem.attributes; if (attrs) { var classes = attrs.getNamedItem("class"); if (classes && ( classes.value.indexOf(platformClass) != -1 || classes.value.indexOf("dlAll") != -1 )) { if (classes && classes.value.indexOf(idClass) != -1) { uri = attrs.getNamedItem("href").value; name = attrs.getNamedItem("name").value; //alert("name " + name + "\nuri " + uri); xpi[name] = uri; found = true; } } } } if (!found) alert("No appropriate packages available"); else startInstall(xpi,exclusive); } |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:11:26
|
Update of /cvsroot/slashhack/slashhack/resources/js/jslib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28442/resources/js/jslib Modified Files: jslib.js Log Message: Task #106454 - include jslib. Index: jslib.js =================================================================== RCS file: /cvsroot/slashhack/slashhack/resources/js/jslib/jslib.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** jslib.js 21 Oct 2004 03:06:48 -0000 1.1 --- jslib.js 21 Oct 2004 03:11:16 -0000 1.2 *************** *** 34,38 **** const JS_LIBRARY = "jslib"; const JS_LIB_FILE = "jslib.js" ! const JS_LIB_PATH = "chrome://jslib/content/"; const JS_LIB_VERSION = "0.1.205"; const JS_LIB_AUTHORS = "\tPete Collins <pe...@mo...>\n" --- 34,38 ---- const JS_LIBRARY = "jslib"; const JS_LIB_FILE = "jslib.js" ! const JS_LIB_PATH = "chrome://slashhack/content/resources/js/jslib/"; const JS_LIB_VERSION = "0.1.205"; const JS_LIB_AUTHORS = "\tPete Collins <pe...@mo...>\n" *************** *** 140,144 **** * - errorno or throws exception on failure * * eg: * ! * var path='chrome://jslib/content/io/file.js'; * * include(path); * * Or: * --- 140,144 ---- * - errorno or throws exception on failure * * eg: * ! * var path='chrome://slashhack/content/resources/js/jslib/io/file.js'; * * include(path); * * Or: * *************** *** 214,218 **** { include (jslib_window); ! var win = new CommonWindow("chrome://jslib/content/splash.xul", 400, 220); win.position = JS_MIDDLE_CENTER; win.openSplash(); --- 214,218 ---- { include (jslib_window); ! var win = new CommonWindow("chrome://slashhack/content/resources/js/jslib/splash.xul", 400, 220); win.position = JS_MIDDLE_CENTER; win.openSplash(); |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:11:25
|
Update of /cvsroot/slashhack/slashhack/resources/js In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28442/resources/js Modified Files: RDFLocal.js TransformedDatasource.js slashhack.js Log Message: Task #106454 - include jslib. Index: TransformedDatasource.js =================================================================== RCS file: /cvsroot/slashhack/slashhack/resources/js/TransformedDatasource.js,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TransformedDatasource.js 21 Oct 2004 02:43:04 -0000 1.2 --- TransformedDatasource.js 21 Oct 2004 03:11:16 -0000 1.3 *************** *** 5,11 **** // #includes ! include('chrome://jslib/content/io/dirUtils.js'); ! include('chrome://jslib/content/io/fileUtils.js'); ! include('chrome://jslib/content/io/file.js'); // TransformedDatasource constructor --- 5,11 ---- // #includes ! include('chrome://slashhack/content/resources/js/jslib/io/dirUtils.js'); ! include('chrome://slashhack/content/resources/js/jslib/io/fileUtils.js'); ! include('chrome://slashhack/content/resources/js/jslib/io/file.js'); // TransformedDatasource constructor Index: slashhack.js =================================================================== RCS file: /cvsroot/slashhack/slashhack/resources/js/slashhack.js,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** slashhack.js 21 Oct 2004 02:43:04 -0000 1.3 --- slashhack.js 21 Oct 2004 03:11:16 -0000 1.4 *************** *** 7,11 **** include('chrome://slashhack/content/resources/js/CompositeDatasource.js'); include('chrome://slashhack/content/resources/js/RDFLocal.js'); ! include('chrome://jslib/content/rdf/rdf.js'); --- 7,11 ---- include('chrome://slashhack/content/resources/js/CompositeDatasource.js'); include('chrome://slashhack/content/resources/js/RDFLocal.js'); ! include('chrome://slashhack/content/resources/js/jslib/rdf/rdf.js'); Index: RDFLocal.js =================================================================== RCS file: /cvsroot/slashhack/slashhack/resources/js/RDFLocal.js,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RDFLocal.js 21 Oct 2004 02:43:04 -0000 1.2 --- RDFLocal.js 21 Oct 2004 03:11:16 -0000 1.3 *************** *** 4,8 **** const RDF_LOCAL_LOADED = true; ! include('chrome://jslib/content/rdf/rdf.js'); function RDFLocal(dsource) { --- 4,8 ---- const RDF_LOCAL_LOADED = true; ! include('chrome://slashhack/content/resources/js/jslib/rdf/rdf.js'); function RDFLocal(dsource) { |
|
From: Dave F. <fl...@us...> - 2004-10-21 03:11:25
|
Update of /cvsroot/slashhack/slashhack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28442 Modified Files: slashhack.xul Log Message: Task #106454 - include jslib. Index: slashhack.xul =================================================================== RCS file: /cvsroot/slashhack/slashhack/slashhack.xul,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** slashhack.xul 18 Oct 2004 20:25:08 -0000 1.1.1.1 --- slashhack.xul 21 Oct 2004 03:11:15 -0000 1.2 *************** *** 17,21 **** <script type='application/x-javascript' ! src='chrome://jslib/content/jslib.js' /> <script --- 17,21 ---- <script type='application/x-javascript' ! src='chrome://slashhack/content/resources/js/jslib/jslib.js' /> <script |