Confirmed users
596
edits
(add file input page) |
m (fix formatting) |
||
| Line 2: | Line 2: | ||
<?xml version="1.0"?> | <?xml version="1.0"?> | ||
<bindings xmlns="http://www.mozilla.org/xbl" | <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
<binding id="fileinput"> | <binding id="fileinput"> | ||
<content> | <content> | ||
| Line 16: | Line 15: | ||
var button = document.getAnonymousNodes(this)[1]; | var button = document.getAnonymousNodes(this)[1]; | ||
textbox.thefile = null; | textbox.thefile = null; | ||
var pickFunc = function pickFile() { | var pickFunc = function pickFile() { | ||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); | netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); | ||
| Line 34: | Line 33: | ||
button.addEventListener("command", pickFunc, false); | button.addEventListener("command", pickFunc, false); | ||
]]></constructor> | ]]></constructor> | ||
<property name="inputText" readonly="true"> | <property name="inputText" readonly="true"> | ||
<getter><![CDATA[ | <getter><![CDATA[ | ||
| Line 44: | Line 43: | ||
var sstream = Components.classes["@mozilla.org/scriptableinputstream;1"] | var sstream = Components.classes["@mozilla.org/scriptableinputstream;1"] | ||
.createInstance(Components.interfaces.nsIScriptableInputStream); | .createInstance(Components.interfaces.nsIScriptableInputStream); | ||
is.init( textbox.thefile, 0x01, 00004, null); | is.init( textbox.thefile, 0x01, 00004, null); | ||
sstream.init(is); | sstream.init(is); | ||
var data = ""; | var data = ""; | ||
var count = 0; | var count = 0; | ||
while (sstream.available() > 0) { | while (sstream.available() > 0) { | ||
count = sstream.available(); | count = sstream.available(); | ||
| Line 66: | Line 65: | ||
</implementation> | </implementation> | ||
</binding> | </binding> | ||
</bindings> | </bindings> | ||