Skip to content

Commit

Permalink
moved to github
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Zabreznik committed Mar 3, 2012
1 parent 4ee4d36 commit 6f9219c
Show file tree
Hide file tree
Showing 14 changed files with 1,389 additions and 0 deletions.
643 changes: 643 additions & 0 deletions COPYING

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
VERSION=`grep "em:version" $(PWD)/src/install.rdf | sed -n -e 's/<.*>\(.*\)<\/.*>/\1/p' | sed 's/^[ \t]*//'`
FILENAME="fxkeyboard-$(VERSION).xpi"

build:
@echo "Building $(FILENAME)..."
@cd "src" && zip -r "$(FILENAME)" *
@mv "src/$(FILENAME)" .
@zip "$(FILENAME)" COPYING README
@echo "Done!"

clean:
rm fxkeyboard-*
@echo "Done!"
38 changes: 38 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FxKeyboard - A virtual keyboard for Firefox
==================================================

A handy Firefox virtual keyboard for touchscreen use.

By Marko Zabreznik � since 2008, GPL 3

![FxKeyboard](/Screenshot.png)

Features
--------------------------------------
- Auto-Close
- Works on XUL (url, search field, etc..)
- Numbers and Special simbols with capslock
- Locales
- Works on Fullscreen
- DOES NOT WORK WITH PLUGINS (Flash etc.)


Settings (via about:config)
--------------------------------------
- *extensions.fxkeyboard.keep_open* dissable auto close
- *extensions.fxkeyboard.repeat_all* make all keys repeat if long pressed
- *extensions.fxkeyboard.button_height* set the button height


Locales
--------------------------------------
Currently supported locales
- en-US
- de-DE
- de-AT
- sl-SI
- hr-HR

For missing locales, edit the [en-US](src/chrome/locale/en-US/overlay.xul) version and open a Issue.


Binary file added Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/chrome.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
content fxkeyboard chrome/content/

locale fxkeyboard en-US chrome/locale/en-US/
locale fxkeyboard de-DE chrome/locale/de-DE/
locale fxkeyboard de-AT chrome/locale/de-AT/
locale fxkeyboard sl-SI chrome/locale/sl-SI/
locale fxkeyboard hr-HR chrome/locale/hr-HR/

overlay chrome://browser/content/browser.xul chrome://fxkeyboard/locale/overlay.xul
11 changes: 11 additions & 0 deletions src/chrome/content/overlay.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#fxKeyboardToolbar * {
-moz-user-focus:ignore;
}

#fxKeyboardToolbar button {
min-width:1px;
}

.fxKeyboardActionKeys {
font-weight:bold;
}
171 changes: 171 additions & 0 deletions src/chrome/content/overlay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*
FxKeyboard
Version: 2.0
Author: Marko Zabreznik
Date: 3 Mar 2012
Purpose: A virtual keyboard for Firefox
*/

window.addEventListener("load", function() { fxKeyboard.startUp(); }, false);
var fxKeyboard = {
startUp: function()
{
this.prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);


// set button styles
var buttonHeight = this.prefs.getCharPref("extensions.fxkeyboard.button_height");
var repeatAll = this.prefs.getBoolPref("extensions.fxkeyboard.repeat_all");
var buttons = document.getElementById('fxKeyboardToolbar').getElementsByTagName('button');
for( b in buttons) {
buttons[b].style.height = buttonHeight;
if (repeatAll)
buttons[b].type = 'repeat';
if (!buttons[b].flex)
buttons[b].flex = 1;
}

this.shift = 0; // 0 closed, 1 open, 2 persistent
this.toolbar = document.getElementById('fxKeyboardToolbar');
this.mainKeys = document.getElementById('fxKeyboardMainKeys');
this.altKeys = document.getElementById('fxKeyboardAltKeys');
this.alt = 0;

this.focus; // current focused element

document.addEventListener("focus", this.onFocus,true);

this.toogleKeepOpen(
this.prefs.getBoolPref("extensions.fxkeyboard.keep_open")
); // keep open
},
onFocus: function() {
fxKeyboard.focus = document.commandDispatcher.focusedElement;
if(!fxKeyboard.focus) fxKeyboard.focus = document.commandDispatcher.focusedWindow.document.activeElement;

// auto open/close
if (!fxKeyboard.keepOpen) {
if (fxKeyboard.focus && (
fxKeyboard.focus.type == 'text' ||
fxKeyboard.focus.type == 'textarea' ||
fxKeyboard.focus.type == 'email' ||
fxKeyboard.focus.type == "password"
)
) fxKeyboard.toolbar.collapsed = false;
else fxKeyboard.toolbar.collapsed = true;
}
},
toogleKeepOpen: function ( keepopened )
{
if (!keepopened) {
// close keyboard
this.keepOpen = false;
this.toolbar.collapsed = true;
} else {
// force open keyboard
this.keepOpen = true;
this.toolbar.collapsed = false;
}
},
doKey: function ( key )
{
// press a key on the focused item
if (typeof(key)=='string') {
if (this.shift > 0) {
key = key.toUpperCase();
if ( this.shift<2 )
this.undoShift();
}
key = key.charCodeAt(0);
}

// alt keys
if (this.alt == 1) {
this.alt = 2;
this.switchAltKeys();
}

var evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent("keypress", true, true, null, false, false, false, false, 0, key);
this.focus.dispatchEvent(evt);
},
doSpecialKey: function ( key ) {
var evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent("keypress", true, true, null, false, false, false, false, key, 0);
this.focus.dispatchEvent(evt);
},
undoShift: function () {
fxKeyboard.shift = 0;
for( k in fxKeyboard.keys) {
if (fxKeyboard.keys[k].label!==undefined)
fxKeyboard.keys[k].label = fxKeyboard.keys[k].label.toLowerCase();
}
},
doShift: function ( )
{
// reset alt
if (this.alt > 0) {
this.alt = 2;
this.switchAltKeys();
this.undoShift();
return;
}

// uppercase
switch ( this.shift ) {
case 0:
this.shift = 1;
for( k in fxKeyboard.keys) {
if (fxKeyboard.keys[k].label!==undefined)
fxKeyboard.keys[k].label = fxKeyboard.keys[k].label.toUpperCase();
}
break;
case 1:
this.shift = 2;
document.getElementById('fxKeyboardShift').style.color = 'red';
break;
default:
document.getElementById('fxKeyboardShift').style.color = 'inherit';
this.undoShift();
break;
}
},
switchAltKeys: function () {
// reset shift
if ( this.shift > 0) {
document.getElementById('fxKeyboardShift').style.color = 'inherit';
this.undoShift();
}

switch ( this.alt ) {
case 0:
// show alt
this.mainKeys.collapsed = true;
this.altKeys.collapsed = false;
this.alt = 1;
break;
case 1:
// keep alt
document.getElementById('fxKeyboardAlt').style.color = 'red';
this.alt = 2;
break;
default:
// show default
document.getElementById('fxKeyboardAlt').style.color = 'inherit';
this.mainKeys.collapsed = false;
this.altKeys.collapsed = true;
this.alt = 0;
break;
}
},
doClear: function() {
// select all text
var evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent("keypress", true, true, null, true, false, false, false, 0, 97);
this.focus.dispatchEvent(evt);
// backspace
this.doSpecialKey(8);
},
}
// END fxKeyboard
95 changes: 95 additions & 0 deletions src/chrome/locale/de-AT/overlay.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://fxkeyboard/content/overlay.css" type="text/css"?>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://fxkeyboard/content/overlay.js"/>
<vbox>
<hbox collapsed="true" id="fxKeyboardToolbar" flex="1">
<vbox flex="1">
<vbox flex="1" id="fxKeyboardMainKeys" >
<hbox flex="1">
<button label="q" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('q')"/>
<button label="w" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('w')"/>
<button label="e" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('e')"/>
<button label="r" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('r')"/>
<button label="t" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('t')"/>
<button label="z" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('y')"/>
<button label="u" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('u')"/>
<button label="i" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('i')"/>
<button label="o" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('o')"/>
<button label="p" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('p')"/>
<button label="ù" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('ù')"/>
</hbox>
<hbox flex="1">
<button label="a" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('a')"/>
<button label="s" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('s')"/>
<button label="d" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('d')"/>
<button label="f" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('f')"/>
<button label="g" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('g')"/>
<button label="h" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('h')"/>
<button label="j" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('j')"/>
<button label="k" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('k')"/>
<button label="l" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('l')"/>
<button label="ô" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('ô')"/>
</hbox>
<hbox flex="1">
<button label="Umschalt" flex="2" class="fxKeyboardActionKeys" id="fxKeyboardShift" oncommand="fxKeyboard.doShift()"/>
<button label="y" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('y')"/>
<button label="x" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('x')"/>
<button label="c" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('c')"/>
<button label="v" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('v')"/>
<button label="b" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('b')"/>
<button label="n" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('n')"/>
<button label="m" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('m')"/>
<button label="á" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('á')"/>
<button label="&#8592; Rücktaste" type="repeat" class="fxKeyboardActionKeys" flex="2" oncommand="fxKeyboard.doSpecialKey(8)"/>
</hbox>
</vbox>
<vbox id="fxKeyboardAltKeys" collapsed="true" >
<hbox flex="1">
<button label="1" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('1')"/>
<button label="2" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('2')"/>
<button label="3" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('3')"/>
<button label="4" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('4')"/>
<button label="5" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('5')"/>
<button label="6" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('6')"/>
<button label="7" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('7')"/>
<button label="8" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('8')"/>
<button label="9" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('9')"/>
<button label="0" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('0')"/>
</hbox>
<hbox flex="1">
<button label="@" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('@')"/>
<button label="#" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('#')"/>
<button label="$" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('$')"/>
<button label="%" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('%')"/>
<button label="&amp;" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('&amp;')"/>
<button label="*" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('*')"/>
<button label="-" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('-')"/>
<button label="+" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('+')"/>
<button label="." class="fxKeyboardKey" oncommand="fxKeyboard.doKey('.')"/>
<button label="," class="fxKeyboardKey" oncommand="fxKeyboard.doKey(',')"/>
</hbox>
<hbox flex="1">
<button label="Umschalt" flex="2" class="fxKeyboardActionKeys" oncommand="fxKeyboard.doShift()"/>
<button label="!" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('!')"/>
<button label="&#34;" class="fxKeyboardKey" oncommand="fxKeyboard.doKey(34)"/>
<button label="'" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('\'')"/>
<button label=":" class="fxKeyboardKey" oncommand="fxKeyboard.doKey(':')"/>
<button label=";" class="fxKeyboardKey" oncommand="fxKeyboard.doKey(';')"/>
<button label="&#47;" class="fxKeyboardKey" oncommand="fxKeyboard.doKey(47)"/>
<button label="?" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('?')"/>
<button label="(" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('(')"/>
<button label=")" class="fxKeyboardKey" oncommand="fxKeyboard.doKey(')')"/>
<button label="&#8592; Rücktaste" type="repeat" class="fxKeyboardActionKeys" flex="2" oncommand="fxKeyboard.doSpecialKey(8)"/>
</hbox>
</vbox>
<hbox flex="1" id="fxKeyboardBottomRow">
<button label="?123" flex="1" class="fxKeyboardActionKeys" id="fxKeyboardAlt" oncommand="fxKeyboard.switchAltKeys()" />
<button label="&#10008; Löschen" flex="1" class="fxKeyboardActionKeys" oncommand="fxKeyboard.doClear()" />
<button label="&#160;" flex="5" id="fxKeyboardSpace" oncommand="fxKeyboard.doKey(32)" />
<button label="&#10004; Eingabe" class="fxKeyboardActionKeys" flex="1" oncommand="fxKeyboard.doSpecialKey(13)"/>
</hbox>
</vbox>
</hbox>
</vbox>
</overlay>
Loading

0 comments on commit 6f9219c

Please sign in to comment.