update
This commit is contained in:
parent
0427e0bf8f
commit
729b7b552b
@ -5,13 +5,13 @@
|
||||
<script src="firerecord.js" />
|
||||
|
||||
<menupopup id="menu_ToolsPopup">
|
||||
<menuitem label="&runlinktargetfinder;" key="link-target-finder-run-key" oncommand="firerecord.run()"/>
|
||||
<menuitem label="&runlinktargetfinder;" key="link-target-finder-run-key" oncommand="firerecord.running()"/>
|
||||
</menupopup>
|
||||
<toolbox>
|
||||
<menubar id="xulschoolhello-menubar">
|
||||
<menu id="xulschoolhello-greeting-menu" label="testing">
|
||||
<menupopup>
|
||||
<menuitem label="Nothing Yet"
|
||||
<menuitem label="Choose Text File"
|
||||
oncommand ="firerecord.file()"/>
|
||||
|
||||
</menupopup>
|
||||
@ -22,11 +22,11 @@
|
||||
</menubar>
|
||||
</toolbox>
|
||||
<keyset>
|
||||
<key id="link-target-finder-run-key" modifiers="accel alt shift" key="L" oncommand="firerecord.run()"/>
|
||||
<key id="link-target-finder-run-key" modifiers="accel alt shift" key="L" oncommand="firerecord.running()"/>
|
||||
</keyset>
|
||||
|
||||
<toolbar id="status-bar">
|
||||
<statusbarpanel id="link-target-finder-status-bar-icon" label="Record" class="statusbarpanel-iconic" src="chrome://firerecord/skin/toolbar-large.png" tooltiptext="&runlinktargetfinder;" onclick="firerecord.run()" />
|
||||
<statusbarpanel id="link-target-finder-status-bar-icon" label="Record" class="statusbarpanel-iconic" src="chrome://firerecord/skin/toolbar-large.png" tooltiptext="&runlinktargetfinder;" onclick="firerecord.running()" />
|
||||
|
||||
</toolbar>
|
||||
<toolbar id="status-bar">
|
||||
@ -35,9 +35,9 @@
|
||||
</toolbar>
|
||||
|
||||
<toolbarpalette id="BrowserToolbarPalette">
|
||||
<toolbarbutton id="link-target-finder-toolbar-button" label="firerecord:" class="statusbarpanel-iconic" src="chrome://firerecord/skin/toolbar-large.png" tooltiptext="&runlinktargetfinder;" oncommand="firerecord.run()"/>
|
||||
<toolbarbutton id="link-target-finder-toolbar-button" label="firerecord:" class="statusbarpanel-iconic" src="chrome://firerecord/skin/toolbar-large.png" tooltiptext="&runlinktargetfinder;" oncommand="firerecord.running()"/>
|
||||
</toolbarpalette>
|
||||
|
||||
<input type="file" id="upload" name="upload"/>
|
||||
|
||||
|
||||
</overlay>
|
@ -1,4 +1,6 @@
|
||||
var recordingx = false;
|
||||
var path = null;
|
||||
|
||||
|
||||
window.addEventListener("load", function load(event) {
|
||||
window.removeEventListener("load", load, false); //remove listener, no longer needed
|
||||
@ -18,19 +20,35 @@ var firerecord = function () {
|
||||
if(recordingx){
|
||||
recordingx = false;
|
||||
alert("Stop Listen");
|
||||
|
||||
//document.location.reload();
|
||||
//closes all tabs on firefox.
|
||||
}
|
||||
else{
|
||||
recordingx = true;
|
||||
alert("Start Listen");
|
||||
//createFile("Initialize New Test File");
|
||||
firerecord.run();
|
||||
}
|
||||
|
||||
},
|
||||
file: function(){
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||
.createInstance(nsIFilePicker);
|
||||
fp.init(window, "Dialog Title", nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
|
||||
|
||||
var rv = fp.show();
|
||||
if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
|
||||
var file = fp.file;
|
||||
// Get the path as string. Note that you usually won't
|
||||
// need to work with the string paths.
|
||||
path = fp.file.path;
|
||||
// work with returned nsILocalFile...
|
||||
|
||||
}
|
||||
},
|
||||
run : function () {
|
||||
var head = content.document.getElementsByTagName("head")[0],
|
||||
@ -151,6 +169,10 @@ var firerecord = function () {
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//_____________________________________________________________________
|
||||
var tname;
|
||||
var taginfo = new Array();
|
||||
@ -224,24 +246,57 @@ var firerecord = function () {
|
||||
|
||||
alert(window.content.location.href);
|
||||
if(!taginfo[1]){
|
||||
taginfo[1] = "null";
|
||||
//taginfo[1]= "null";
|
||||
}
|
||||
if(!taginfo[2]){
|
||||
taginfo[2] = "null";
|
||||
//taginfo[2]= "null";
|
||||
}
|
||||
if(!taginfo[3]){
|
||||
taginfo[3] = "null";
|
||||
//taginfo[3]= "null";
|
||||
}
|
||||
if(!taginfo[4]){
|
||||
taginfo[4] = "null";
|
||||
//taginfo[4]= "null";
|
||||
}
|
||||
alert("You clicked on a " + tname + " with info \n " + taginfo[1] + "\n" + taginfo[2] + "\n" + taginfo[3] + "\n" + " saving... " + taginfo.join('::'));
|
||||
var contents = "You clicked on a " + tname + " with info \n "+ taginfo.join(' :: ')+"\n";
|
||||
|
||||
appendFile(contents);
|
||||
e.cancelBubble = true;
|
||||
|
||||
};
|
||||
|
||||
}();
|
||||
function createFile(contents) {
|
||||
|
||||
alert("created File");
|
||||
var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||
file1.initWithPath("C:\\test\\" + "test.txt");
|
||||
//alert("create file nullcheck" +file1.toString());
|
||||
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
// use 0x02 | 0x10 to open file for appending.
|
||||
foStream.init(file1, 0x02 | 0x08 | 0x20, 438, 0);
|
||||
var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
|
||||
createInstance(Components.interfaces.nsIConverterOutputStream);
|
||||
converter.init(foStream, "UTF-8", 0, 0);
|
||||
converter.writeString(contents.toString());
|
||||
converter.close(); // this closes foStream
|
||||
}
|
||||
|
||||
function appendFile(contents) {
|
||||
|
||||
alert("appended File");
|
||||
var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||
file1.initWithPath(path);
|
||||
//alert("append file nullcheck: "+file1.toString());
|
||||
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
// use 0x02 | 0x10 to open file for appending.
|
||||
foStream.init(file1, 0x02 | 0x10, 438, 0);
|
||||
var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
|
||||
createInstance(Components.interfaces.nsIConverterOutputStream);
|
||||
converter.init(foStream, "UTF-8", 0, 0);
|
||||
|
||||
converter.writeString(contents);
|
||||
converter.close();
|
||||
}
|
||||
function handleType(e) {
|
||||
var targ;
|
||||
if (!e) {
|
||||
|
Reference in New Issue
Block a user