Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Commit

Permalink
add bootstrap basics (after running jpm init and customizing its output
Browse files Browse the repository at this point in the history
  • Loading branch information
engeld committed Dec 15, 2015
1 parent 315c32e commit 9526a28
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 78 deletions.
2 changes: 0 additions & 2 deletions chrome.manifest

This file was deleted.

15 changes: 0 additions & 15 deletions content/functions.js

This file was deleted.

40 changes: 0 additions & 40 deletions content/overlay.xul

This file was deleted.

41 changes: 41 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var utils = require('sdk/window/utils');

var actions = [
{key: 'h', command: 'cmd_scrollLeft'},
{key: 'j', command: 'cmd_scrollLineDown'},
{key: 'k', command: 'cmd_scrollLineUp'},
{key: 'l', command: 'cmd_scrollRight'},
{key: 'g', command: 'cmd_scrollTop'},
{key: 'G', command: 'cmd_scrollBottom'}
];

function currentAndFutureWindows(func) {
var windows = require('sdk/windows').browserWindows,
{ viewFor } = require("sdk/view/core");
for (let window of windows) {
func(viewFor(window));
}
windows.on('open', function(window) {
func(viewFor(window));
});
}

function onWindow(window) {
window.gBrowser.addEventListener("keypress", function(event) {
var action = actions.find(function(value) {
return value.key == event.key;
});

if (action) {
runCommand(action.command);
}
}, false);
}

function runCommand(cmd) {
var window = utils.getMostRecentBrowserWindow();
var controller = window.document.commandDispatcher.getControllerForCommand(cmd);
controller.doCommand(cmd);
}

currentAndFutureWindows(onWindow);
43 changes: 22 additions & 21 deletions install.rdf
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:name>Vimkeys</em:name>
<em:version>0.2.2</em:version>
<em:creator>engeld</em:creator>
<em:description>Adds vim keybindings.</em:description>
<em:homepageURL>http://engeld.github.io/vimkeys/</em:homepageURL>
<em:type>2</em:type>
<em:targetApplication>
<Description>
<!-- the id below is the GUID of firefox -->
<!-- see https://addons.mozilla.org/en-US/firefox/pages/appversions/ -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>34.*</em:maxVersion>
</Description>
</em:targetApplication>
<?xml version='1.0' encoding='utf-8'?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:name>vimkeys</em:name>
<em:version>0.2.5</em:version>
<em:creator>Dana Engel (engeld)</em:creator>
<em:description>Adds vim keybindings.</em:description>
<em:homepageURL>http://engeld.github.io/vimkeys/</em:homepageURL>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
<em:unpack>false</em:unpack>

<em:targetApplication>
<Description>
<!-- the id below is the GUID of firefox -->
<!-- see https://addons.mozilla.org/en-US/firefox/pages/appversions/ -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>42.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>

16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"title": "vimkeys",
"name": "vimkeys",
"version": "0.2.3",
"description": "Adds vim keybindings.",
"main": "index.js",
"author": "Dana Engel",
"engines": {
"firefox": ">=38.0a1",
"fennec": ">=38.0a1"
},
"license": "MIT",
"keywords": [
"jetpack"
]
}
19 changes: 19 additions & 0 deletions test/test-index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var main = require("../");

exports["test main"] = function(assert) {
assert.pass("Unit test running!");
};

exports["test main async"] = function(assert, done) {
assert.pass("async Unit test running!");
done();
};

exports["test dummy"] = function(assert, done) {
main.dummy("foo", function(text) {
assert.ok((text === "foo"), "Is the text actually 'foo'");
done();
});
};

require("sdk/test").run(exports);

0 comments on commit 9526a28

Please sign in to comment.