Browse Source

added a text field to show the state of things

master
mort 8 years ago
parent
commit
37b2c73969
2 changed files with 44 additions and 8 deletions
  1. 43
    7
      data/onload.js
  2. 1
    1
      package.json

+ 43
- 7
data/onload.js View File

blobs_hide: {code: 27}, blobs_hide: {code: 27},
blobs_click: {code: 13}, blobs_click: {code: 13},
blobs_click_new_tab: {code: 13, shiftKey: true}, blobs_click_new_tab: {code: 13, shiftKey: true},
blobs_backspace: {code: 8},

elem_deselect: {code: 27}, elem_deselect: {code: 27},


change_tab_left: {code: "H"}, change_tab_left: {code: "H"},
var blobList = { var blobList = {
blobs: {}, blobs: {},
container: null, container: null,
overview: null,


visible: false, visible: false,
needLoadBlobs: true, needLoadBlobs: true,
blobList.container = container; blobList.container = container;
}, },


createOverview: function() {
var overview = document.createElement("div");
overview.style =
"position: fixed;"+
"width: 100%;"+
"bottom: 0px;"+
"background-color: white;"+
"border-top: 2px solid black;"+
"color: black;"+
"font-size: 10pt;"+
"padding: 5px;"+
"height: 20px;"+
"z-index: 2147483647"; //Max z-index value in most browsers
blobList.container.appendChild(overview);
blobList.overview = overview;
},

init: function() { init: function() {
if (!onWebPage) if (!onWebPage)
return; return;
var linkElems = document.querySelectorAll("a, button, input, textarea"); var linkElems = document.querySelectorAll("a, button, input, textarea");


//Remove old container contents //Remove old container contents
blobList.container.innerHTML = ""
blobList.container.innerHTML = "";
blobList.createOverview();


//Remove old blobs //Remove old blobs
blobList.blobs = {}; blobList.blobs = {};


appendKey: function(c) { appendKey: function(c) {
blobList.currentKey += c; blobList.currentKey += c;
blobList.overview.innerHTML = blobList.currentKey;
},

backspace: function() {
blobList.currentKey = blobList.currentKey.substring(0, blobList.currentKey.length - 1);
blobList.overview.innerHTML = blobList.currentKey;
} }
} }
blobList.init(); blobList.init();
} }


//User is typing a key to a blob //User is typing a key to a blob
var c = String.fromCharCode(evt.keyCode);
if (blobList.visible && conf.chars.indexOf(c) !== -1) {
if (blobList.visible) {
//Hide blobs if appropriate //Hide blobs if appropriate
if (isMatch(keys.blobs_hide, evt)) { if (isMatch(keys.blobs_hide, evt)) {
blobList.hideBlobs(); blobList.hideBlobs();
return; return;
} }


blobList.appendKey(c);
evt.preventDefault();
evt.stopPropagation();
return false;
//Backspace if appropriate
if (isMatch(keys.blobs_backspace, evt)) {
blobList.backspace();
return;
}

var c = String.fromCharCode(evt.keyCode);
if (conf.chars.indexOf(c) !== -1) {
blobList.appendKey(c);
evt.preventDefault();
evt.stopPropagation();
return false;
}
} }


//Handle other key presses //Handle other key presses

+ 1
- 1
package.json View File

{ {
"title": "Mouseless", "title": "Mouseless",
"name": "mouseless", "name": "mouseless",
"version": "0.2.5",
"version": "0.3.0",
"description": "For a mouseless future.", "description": "For a mouseless future.",
"main": "index.js", "main": "index.js",
"author": "Martin Dørum Nygaard", "author": "Martin Dørum Nygaard",

Loading…
Cancel
Save