mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-13 21:15:47 +01:00
Finish the Great Opening Brace Correction.
This commit is contained in:
@@ -25,8 +25,7 @@ AboutHandler.prototype = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
|
||||
|
||||
newChannel: function (uri)
|
||||
{
|
||||
newChannel: function (uri) {
|
||||
let channel = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService)
|
||||
.newChannel("chrome://" + name + "/content/about.html", null, null);
|
||||
|
||||
@@ -38,6 +37,6 @@ AboutHandler.prototype = {
|
||||
getURIFlags: function (uri) Ci.nsIAboutModule.ALLOW_SCRIPT,
|
||||
};
|
||||
|
||||
function NSGetModule(compMgr, fileSpec) XPCOMUtils.generateModule([AboutHandler]);
|
||||
function NSGetModule(compMgr, fileSpec) XPCOMUtils.generateModule([AboutHandler])
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -11,8 +11,7 @@ const Name = "Vimperator";
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const name = Name.toLowerCase();
|
||||
function CommandLineHandler()
|
||||
{
|
||||
function CommandLineHandler() {
|
||||
this.wrappedJSObject = this;
|
||||
}
|
||||
CommandLineHandler.prototype = {
|
||||
@@ -30,20 +29,17 @@ CommandLineHandler.prototype = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
|
||||
|
||||
handle: function (commandLine)
|
||||
{
|
||||
handle: function (commandLine) {
|
||||
// TODO: handle remote launches differently?
|
||||
try
|
||||
{
|
||||
try {
|
||||
this.optionValue = commandLine.handleFlagWithParam(name, false);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
catch (e) {
|
||||
//"vimperator: option -vimperator requires an argument"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function NSGetModule(compMgr, fileSpec) XPCOMUtils.generateModule([CommandLineHandler]);
|
||||
function NSGetModule(compMgr, fileSpec) XPCOMUtils.generateModule([CommandLineHandler])
|
||||
|
||||
// vim: set ft=javascript fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -119,8 +119,7 @@ const config = { //{{{
|
||||
get tempFile() {
|
||||
let prefix = this.name.toLowerCase();
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
prefix += "-" + window.content.document.location.hostname;
|
||||
}
|
||||
catch (e) {}
|
||||
@@ -128,12 +127,10 @@ const config = { //{{{
|
||||
return prefix + ".tmp";
|
||||
},
|
||||
|
||||
init: function ()
|
||||
{
|
||||
init: function () {
|
||||
commands.add(["winon[ly]"],
|
||||
"Close all other windows",
|
||||
function ()
|
||||
{
|
||||
function () {
|
||||
liberator.windows.forEach(function (win) {
|
||||
if (win != window)
|
||||
win.close();
|
||||
@@ -143,10 +140,8 @@ const config = { //{{{
|
||||
|
||||
commands.add(["pref[erences]", "prefs"],
|
||||
"Show " + config.hostApplication + " preferences",
|
||||
function (args)
|
||||
{
|
||||
if (args.bang) // open Firefox settings GUI dialog
|
||||
{
|
||||
function (args) {
|
||||
if (args.bang) { // open Firefox settings GUI dialog
|
||||
liberator.open("about:config",
|
||||
(options["newtab"] && options.get("newtab").has("all", "prefs"))
|
||||
? liberator.NEW_TAB : liberator.CURRENT_TAB);
|
||||
@@ -161,8 +156,7 @@ const config = { //{{{
|
||||
|
||||
commands.add(["sbcl[ose]"],
|
||||
"Close the sidebar window",
|
||||
function ()
|
||||
{
|
||||
function () {
|
||||
if (!document.getElementById("sidebar-box").hidden)
|
||||
window.toggleSidebar();
|
||||
},
|
||||
@@ -170,24 +164,20 @@ const config = { //{{{
|
||||
|
||||
commands.add(["sideb[ar]", "sb[ar]", "sbope[n]"],
|
||||
"Open the sidebar window",
|
||||
function (args)
|
||||
{
|
||||
function (args) {
|
||||
let arg = args.literalArg;
|
||||
function compare(a, b) util.compareIgnoreCase(a, b) == 0
|
||||
|
||||
// focus if the requested sidebar is already open
|
||||
if (compare(document.getElementById("sidebar-title").value, arg))
|
||||
{
|
||||
if (compare(document.getElementById("sidebar-title").value, arg)) {
|
||||
document.getElementById("sidebar-box").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
let menu = document.getElementById("viewSidebarMenu");
|
||||
|
||||
for (let [, panel] in Iterator(menu.childNodes))
|
||||
{
|
||||
if (compare(panel.label, arg))
|
||||
{
|
||||
for (let [, panel] in Iterator(menu.childNodes)) {
|
||||
if (compare(panel.label, arg)) {
|
||||
panel.doCommand();
|
||||
return;
|
||||
}
|
||||
@@ -197,8 +187,7 @@ const config = { //{{{
|
||||
},
|
||||
{
|
||||
argCount: "1",
|
||||
completer: function (context)
|
||||
{
|
||||
completer: function (context) {
|
||||
context.ignoreCase = true;
|
||||
return completion.sidebar(context);
|
||||
},
|
||||
@@ -207,8 +196,7 @@ const config = { //{{{
|
||||
|
||||
commands.add(["wind[ow]"],
|
||||
"Execute a command and tell it to output in a new window",
|
||||
function (args)
|
||||
{
|
||||
function (args) {
|
||||
liberator.forceNewWindow = true;
|
||||
liberator.execute(args.string, null, true);
|
||||
liberator.forceNewWindow = false;
|
||||
@@ -226,8 +214,7 @@ const config = { //{{{
|
||||
|
||||
commands.add(["wino[pen]", "wo[pen]", "wine[dit]"],
|
||||
"Open one or more URLs in a new window",
|
||||
function (args)
|
||||
{
|
||||
function (args) {
|
||||
args = args.string;
|
||||
|
||||
if (args)
|
||||
@@ -249,8 +236,7 @@ const config = { //{{{
|
||||
"Set the 'work offline' option",
|
||||
"boolean", true,
|
||||
{
|
||||
setter: function (value)
|
||||
{
|
||||
setter: function (value) {
|
||||
const ioService = services.get("io");
|
||||
if (ioService.offline == value)
|
||||
BrowserOffline.toggleOfflineStatus();
|
||||
@@ -289,8 +275,7 @@ const config = { //{{{
|
||||
services.get("autoCompleteSearch").startSearch(context.filter, "", context.result, {
|
||||
onSearchResult: function onSearchResult(search, result) {
|
||||
timer.tell(result);
|
||||
if (result.searchResult <= result.RESULT_SUCCESS)
|
||||
{
|
||||
if (result.searchResult <= result.RESULT_SUCCESS) {
|
||||
searchRunning = false;
|
||||
timer.flush();
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
|
||||
|
||||
function checkFragment()
|
||||
{
|
||||
function checkFragment() {
|
||||
let frag = document.location.hash.substr(1);
|
||||
if (!frag || document.getElementById(frag))
|
||||
return;
|
||||
|
||||
@@ -76,8 +76,7 @@ let functions = [
|
||||
// even after doing major Vimperator refactoring
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resetEnvironment()
|
||||
{
|
||||
function resetEnvironment() {
|
||||
multilineOutput.contentDocument.body.innerHTML = "";
|
||||
singlelineOutput.value = "";
|
||||
commandline.close();
|
||||
@@ -91,8 +90,7 @@ function getSinglelineOutput() singlelineOutput.value;
|
||||
function getTabIndex() getBrowser().mTabContainer.selectedIndex;
|
||||
function getTabCount() getBrowser().mTabs.length;
|
||||
|
||||
function getBufferPosition()
|
||||
{
|
||||
function getBufferPosition() {
|
||||
let win = window.content;
|
||||
return { x: win.scrollMaxX ? win.pageXOffset / win.scrollMaxX : 0,
|
||||
y: win.scrollMaxY ? win.pageYOffset / win.scrollMaxY : 0 }
|
||||
@@ -100,8 +98,7 @@ function getBufferPosition()
|
||||
|
||||
function getLocation() window.content.document.location.href;
|
||||
|
||||
function echoLine(str, group)
|
||||
{
|
||||
function echoLine(str, group) {
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
@@ -109,8 +106,7 @@ function echoLine(str, group)
|
||||
<div highlight={group} style="border: 1px solid gray; white-space: pre; height: 1.5em; line-height: 1.5em;">{str}</div>,
|
||||
doc));
|
||||
}
|
||||
function echoMulti(str, group)
|
||||
{
|
||||
function echoMulti(str, group) {
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
@@ -122,8 +118,7 @@ function echoMulti(str, group)
|
||||
|
||||
commands.addUserCommand(["regr[essions]"],
|
||||
"Run regression tests",
|
||||
function (args)
|
||||
{
|
||||
function (args) {
|
||||
// TODO: might need to increase the 'messages' option temporarily
|
||||
// TODO: count (better even range) support to just run test 34 of 102
|
||||
// TODO: bang support to either: a) run commands like deleting bookmarks which
|
||||
@@ -131,8 +126,7 @@ commands.addUserCommand(["regr[essions]"],
|
||||
// just Ex command tests; Yet to be decided
|
||||
|
||||
let updateOutputHeight = null;
|
||||
function init()
|
||||
{
|
||||
function init() {
|
||||
liberator.registerObserver("echoLine", echoLine);
|
||||
liberator.registerObserver("echoMultiline", echoMulti);
|
||||
liberator.open("chrome://liberator/content/buffer.xhtml", liberator.NEW_TAB);
|
||||
@@ -141,23 +135,20 @@ commands.addUserCommand(["regr[essions]"],
|
||||
doc.body.setAttributeNS(NS.uri, "highlight", "CmdLine");
|
||||
|
||||
updateOutputHeight = commandline.updateOutputHeight;
|
||||
commandline.updateOutputHeight = function (open)
|
||||
{
|
||||
commandline.updateOutputHeight = function (open) {
|
||||
let elem = document.getElementById("liberator-multiline-output");
|
||||
if (open)
|
||||
elem.collapsed = false;
|
||||
elem.height = 0;
|
||||
};
|
||||
}
|
||||
function cleanup()
|
||||
{
|
||||
function cleanup() {
|
||||
liberator.unregisterObserver("echoLine", echoLine);
|
||||
liberator.unregisterObserver("echoMultiline", echoMulti);
|
||||
commandline.updateOutputHeight = updateOutputHeight;
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
function run() {
|
||||
let now = Date.now();
|
||||
let totalTests = tests.length + functions.length;
|
||||
let successfulTests = 0;
|
||||
@@ -169,17 +160,14 @@ commands.addUserCommand(["regr[essions]"],
|
||||
// TODO: might want to unify 'tests' and 'functions' handling
|
||||
// 1.) run commands and mappings tests
|
||||
outer:
|
||||
for (let [, test] in Iterator(tests))
|
||||
{
|
||||
for (let [, test] in Iterator(tests)) {
|
||||
currentTest++;
|
||||
if (args.count >= 1 && currentTest != args.count)
|
||||
continue;
|
||||
|
||||
let testDescription = util.clip(test.cmds.join(" -> "), 80);
|
||||
for (let [, cmd] in Iterator(test.cmds))
|
||||
{
|
||||
if (skipTests.indexOf(cmd) != -1)
|
||||
{
|
||||
for (let [, cmd] in Iterator(test.cmds)) {
|
||||
if (skipTests.indexOf(cmd) != -1) {
|
||||
skippedTests++;
|
||||
liberator.echomsg("Skipping test " + currentTest + " of " + totalTests + ": " + testDescription, 0);
|
||||
continue outer;
|
||||
@@ -205,8 +193,7 @@ commands.addUserCommand(["regr[essions]"],
|
||||
}
|
||||
|
||||
// 2.) Run function tests
|
||||
for (let [, func] in Iterator(functions))
|
||||
{
|
||||
for (let [, func] in Iterator(functions)) {
|
||||
currentTest++;
|
||||
if (args.count >= 1 && currentTest != args.count)
|
||||
continue;
|
||||
@@ -232,8 +219,7 @@ commands.addUserCommand(["regr[essions]"],
|
||||
liberator.execute(":messages");
|
||||
}
|
||||
|
||||
if (!args.bang)
|
||||
{
|
||||
if (!args.bang) {
|
||||
liberator.echo(<e4x>
|
||||
<span style="font-weight: bold">Running tests should always be done in a new profile.</span><br/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user