mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 23:08:00 +01:00
moved log and logObject into the vimperator object
This commit is contained in:
@@ -261,7 +261,6 @@ function Bookmarks()
|
||||
}
|
||||
return res;
|
||||
}
|
||||
logMessage("Bookmarks initialized");
|
||||
}
|
||||
|
||||
function History()
|
||||
@@ -334,48 +333,15 @@ function History()
|
||||
if(!history)
|
||||
load();
|
||||
|
||||
// XXX: check if fast enough
|
||||
history = history.filter(function(elem) {
|
||||
return elem[0] != url;
|
||||
});
|
||||
// for(var i in history)
|
||||
// {
|
||||
// if(history[i][0] == url)
|
||||
// return;
|
||||
// }
|
||||
|
||||
history.unshift([url, title]);
|
||||
//history.push([url, title]);
|
||||
return true;
|
||||
};
|
||||
|
||||
logMessage("History initialized");
|
||||
}
|
||||
|
||||
/*Vimperator.prototype.quickmarks = new function()
|
||||
{
|
||||
//logObject(vimperator);
|
||||
//setTimeout(function() {logObject(vimperator)}, 1000);
|
||||
//Vimperator.echo("test");
|
||||
//alert(vimperator.getpr("hinttags"));
|
||||
this.add = function() { alert('add');};
|
||||
this.rem = function() { vimperator.echo("rem"); logObject(vimperator)};
|
||||
|
||||
logMessage("quickmarks initialized.");
|
||||
}
|
||||
|
||||
|
||||
function QM()
|
||||
{
|
||||
//logObject(vimperator);
|
||||
//logMessage(vimperator.getpr("complete"));
|
||||
|
||||
this.add = function() { alert('add');};
|
||||
this.rem = function() { vimperator.echo("rem"); logObject(vimperator)};
|
||||
this.zoom = function() { vimperator.zoom_to(200); logObject(vimperator)};
|
||||
|
||||
logMessage("QM initialized.");
|
||||
}*/
|
||||
|
||||
function Marks()
|
||||
{
|
||||
|
||||
@@ -457,8 +457,6 @@ function Search()
|
||||
point, matchRange, matchRange, dir);
|
||||
}
|
||||
}
|
||||
|
||||
logMessage("Search initialized");
|
||||
}
|
||||
|
||||
// @TODO should be moved into commands.js
|
||||
|
||||
@@ -681,8 +681,6 @@ function hit_a_hint()
|
||||
|
||||
window.document.addEventListener("pageshow", initDoc, null);
|
||||
window.addEventListener("resize", onResize, null);
|
||||
|
||||
logMessage("Hints initialized");
|
||||
}
|
||||
|
||||
var hah = new hit_a_hint();
|
||||
|
||||
@@ -440,6 +440,14 @@ function Options()//{{{
|
||||
default_value: false
|
||||
}
|
||||
));
|
||||
addOption(new Option(["verbose", "vbs"], "number",
|
||||
{
|
||||
short_help: "Define which type of messages are logged",
|
||||
help: "When bigger than zero, Vimperator will give messages about what it is doing. They are printed to the error console which can be shown with <code class=\"command\">:javascript!</code>.<br/>" +
|
||||
"The highest value is 9, being the most verbose mode.",
|
||||
default_value: 0
|
||||
}
|
||||
));
|
||||
addOption(new Option(["wildmode", "wim"], "stringlist",
|
||||
{
|
||||
short_help: "Define how command line completion works",
|
||||
@@ -476,8 +484,6 @@ function Options()//{{{
|
||||
setShowTabline(this.showtabline);
|
||||
setGuiOptions(this.guioptions);
|
||||
setTitleString(this.titlestring);
|
||||
|
||||
logMessage("Options initialized");
|
||||
}//}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -230,7 +230,6 @@ function CommandLine ()
|
||||
|
||||
if(event.type == "blur")
|
||||
{
|
||||
logMessage("blur");
|
||||
// when we do a command_widget.focus() we get a blur event immediately,
|
||||
// so check if the target is the actualy input field
|
||||
if (event.target == command_widget.inputField)
|
||||
@@ -502,7 +501,6 @@ function CommandLine ()
|
||||
{
|
||||
Options.setPref("commandline_history", history.join("\n"));
|
||||
}
|
||||
logMessage("CommandLine initialized.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -704,8 +702,6 @@ function InformationList(id, options)
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
logMessage("InformationList initialized for widget id: " + id);
|
||||
}
|
||||
|
||||
function StatusLine()
|
||||
@@ -812,8 +808,6 @@ function StatusLine()
|
||||
|
||||
bufferposition_widget.value = bufferposition_str;
|
||||
};
|
||||
|
||||
logMessage("StatusLine initialized");
|
||||
}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -29,7 +29,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
// The only global object, a handler to the main Vimperator object
|
||||
var vimperator = null;
|
||||
|
||||
var popup_allowed_events; // need to change and reset this firefox pref
|
||||
var popup_allowed_events; // need to change and reset this firefox pref XXX: move to options class
|
||||
|
||||
// called when the chrome is fully loaded and before the main window is shown
|
||||
window.addEventListener("load", init, false);
|
||||
@@ -39,27 +39,40 @@ window.addEventListener("load", init, false);
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
function init()
|
||||
{
|
||||
window.dump("in init\n");
|
||||
// init the main object
|
||||
vimperator = new Vimperator;
|
||||
vimperator.log("Initializing vimperator object...", 1);
|
||||
|
||||
// these inner classes are created here, because outside the init()
|
||||
// function, the chrome:// is not ready
|
||||
|
||||
// TODO: can these classes be moved into a namesspace to now clobber
|
||||
// the main namespace?
|
||||
vimperator.log("Loading module options...", 3);
|
||||
Vimperator.prototype.options = new Options;
|
||||
vimperator.log("Loading module events...", 3);
|
||||
Vimperator.prototype.events = new Events;
|
||||
vimperator.log("Loading module commands...", 3);
|
||||
Vimperator.prototype.commands = new Commands;
|
||||
vimperator.log("Loading module bookmarks...", 3);
|
||||
Vimperator.prototype.bookmarks = new Bookmarks;
|
||||
vimperator.log("Loading module history...", 3);
|
||||
Vimperator.prototype.history = new History;
|
||||
vimperator.log("Loading module commandline...", 3);
|
||||
Vimperator.prototype.commandline = new CommandLine;
|
||||
vimperator.log("Loading module search...", 3);
|
||||
Vimperator.prototype.search = new Search;
|
||||
vimperator.log("Loading module preview window...", 3);
|
||||
Vimperator.prototype.previewwindow = new InformationList("vimperator-previewwindow", { incremental_fill: false, max_items: 10 });
|
||||
vimperator.log("Loading module buffer window...", 3);
|
||||
Vimperator.prototype.bufferwindow = new InformationList("vimperator-bufferwindow", { incremental_fill: false, max_items: 10 });
|
||||
Vimperator.prototype.statusline = new StatusLine;
|
||||
Vimperator.prototype.tabs = new Tabs;
|
||||
vimperator.log("Loading module mappings...", 3);
|
||||
Vimperator.prototype.mappings = new Mappings;
|
||||
vimperator.log("Loading module statusline...", 3);
|
||||
Vimperator.prototype.statusline = new StatusLine;
|
||||
vimperator.log("Loading module tabs...", 3);
|
||||
Vimperator.prototype.tabs = new Tabs;
|
||||
vimperator.log("Loading module marks...", 3);
|
||||
Vimperator.prototype.marks = new Marks;
|
||||
vimperator.log("All modules loaded", 3);
|
||||
|
||||
// DJK FIXME
|
||||
Vimperator.prototype.echo = vimperator.commandline.echo;
|
||||
@@ -69,7 +82,7 @@ function init()
|
||||
vimperator.input = {
|
||||
buffer: "", // partial command storage
|
||||
pendingMap: null, // pending map storage
|
||||
count: -1, // parsed count from the input buffer
|
||||
count: -1 // parsed count from the input buffer
|
||||
};
|
||||
|
||||
// XXX: move elsewhere
|
||||
@@ -109,11 +122,11 @@ function init()
|
||||
// Make sourcing asynchronous, otherwise commands that open new tabs won't work
|
||||
setTimeout(function() {
|
||||
source("~/.vimperatorrc", true);
|
||||
logMessage("~/.vimperatorrc sourced");
|
||||
vimperator.log("~/.vimperatorrc sourced", 1);
|
||||
}, 50);
|
||||
|
||||
window.addEventListener("unload", unload, false);
|
||||
logMessage("Vimperator fully initialized");
|
||||
vimperator.log("Vimperator fully initialized", 1);
|
||||
}
|
||||
|
||||
function unload()
|
||||
@@ -172,6 +185,10 @@ function Vimperator() //{{{1
|
||||
var count = -1;
|
||||
var inputbuffer = "";
|
||||
|
||||
// our services
|
||||
var console_service = Components.classes['@mozilla.org/consoleservice;1']
|
||||
.getService(Components.interfaces.nsIConsoleService);
|
||||
|
||||
function showMode()
|
||||
{
|
||||
if (!vimperator.options["showmode"])
|
||||
@@ -200,11 +217,9 @@ function Vimperator() //{{{1
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
this.version = "###VERSION### CVS (created: ###DATE###)";
|
||||
// DJK FIXME
|
||||
// this.commandline = new CommandLine();
|
||||
// this.search = new Search();
|
||||
|
||||
/////////////// callbacks ////////////////////////////
|
||||
// XXX: shouldn't that callback be moved to commandline? --mst
|
||||
/**
|
||||
* @param type Can be:
|
||||
* "submit": when the user pressed enter in the command line
|
||||
@@ -297,6 +312,38 @@ function Vimperator() //{{{1
|
||||
{
|
||||
return document.commandDispatcher.focusedWindow;
|
||||
}
|
||||
|
||||
/**
|
||||
* logs any object to the javascript error console
|
||||
* also prints all properties of thie object
|
||||
*/
|
||||
this.log = function(msg, level)
|
||||
{
|
||||
// if(Options.getPref("verbose") >= level) FIXME: hangs vimperator
|
||||
console_service.logStringMessage('vimperator: ' + msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* logs any object to the javascript error console
|
||||
* also prints all properties of thie object
|
||||
*/
|
||||
this.logObject = function(object, level)
|
||||
{
|
||||
if (typeof object != 'object')
|
||||
return false;
|
||||
|
||||
var string = object + '::\n';
|
||||
for (var i in object)
|
||||
{
|
||||
var value;
|
||||
try {
|
||||
var value = object[i];
|
||||
} catch (e) { value = '' }
|
||||
|
||||
string += i + ': ' + value + '\n';
|
||||
}
|
||||
this.log(string, level);
|
||||
}
|
||||
}
|
||||
|
||||
function Events() //{{{1
|
||||
@@ -639,7 +686,7 @@ function Events() //{{{1
|
||||
vimperator.statusline.updateProgress(0);
|
||||
}
|
||||
else if (flags & Components.interfaces.nsIWebProgressListener.STATE_STOP)
|
||||
logMessage("stop");// vimperator.statusline.updateUrl();
|
||||
;// vimperator.statusline.updateUrl();
|
||||
}
|
||||
},
|
||||
// for notifying the user about secure web pages
|
||||
@@ -655,7 +702,6 @@ function Events() //{{{1
|
||||
},
|
||||
onStatusChange: function(webProgress, request, status, message)
|
||||
{
|
||||
//logMessage("status: " + message);
|
||||
vimperator.statusline.updateUrl(message);
|
||||
},
|
||||
onProgressChange: function(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress)
|
||||
@@ -677,7 +723,6 @@ function Events() //{{{1
|
||||
// called at the very end of a page load
|
||||
asyncUpdateUI: function()
|
||||
{
|
||||
//logMessage("async");
|
||||
setTimeout(vimperator.statusline.updateUrl, 100);
|
||||
},
|
||||
setOverLink : function(link, b)
|
||||
|
||||
Reference in New Issue
Block a user