Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual keyboard #448

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lg_common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
'extensions/ros_window_ready/*',
'extensions/monitor_page_urls/*',
'extensions/current_url/*',
'extensions/virtual_keyboard/*',
'extensions/minimize_adhoc_browser/*',
'extensions/ros_window_ready/*/*',
'extensions/monitor_page_urls/*/*',
'extensions/current_url/*/*',
'extensions/virtual_keyboard/*/*',
'extensions/minimize_adhoc_browser/*/*'
]
},
Expand Down
1 change: 1 addition & 0 deletions lg_common/src/lg_common/adhoc_browser_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ def _create_browser(self, new_browser_pool_id, new_browser, initial_state=None):
additional_extensions.append('ros_window_ready')

additional_extensions.append('current_url')
additional_extensions.append('virtual_keyboard')

geometry = self._get_browser_window_geometry(new_browser)
extensions = self._get_browser_extensions(new_browser, additional_extensions)
Expand Down
10 changes: 10 additions & 0 deletions lg_common/src/lg_common/extensions/virtual_keyboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Virtual Keyboard for Google Chrome™
=========================================

Virtual Keyboard for Google Chrome™ will popup automatically when the user clicks on an input field such as textboxes and textareas. Futhermore, the keyboard will disappear automatically once no longer needed.

This extension is ideal for touch screen devices. This keyboard works like an iOS/Android/Windows 8 touch virtual keyboard.

<img src="http://xontab.azurewebsites.net/Content/VirtualKeyboard/1.png" alt="" />

For more details visit: http://xontab.com/Apps/VirtualKeyboard/
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script>
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.method == "getLocalStorage")
{
sendResponse({data: localStorage[request.key]});
}
else if (request.method == "setLocalStorage")
{
localStorage[request.key] = request.value;
sendResponse({data: "ok"});
}
else {
sendResponse({});
}
});
</script>
123 changes: 123 additions & 0 deletions lg_common/src/lg_common/extensions/virtual_keyboard/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.method == "getLocalStorage")
{
sendResponse({data: localStorage[request.key]});
}
else if (request.method == "getSmallKeyboardCoords")
{
sendResponse({smallKeyboard: localStorage["smallKeyboard"], smallKeyboardTop: localStorage["smallKeyboardTop"], smallKeyboardBottom: localStorage["smallKeyboardBottom"], smallKeyboardRight: localStorage["smallKeyboardRight"], smallKeyboardLeft: localStorage["smallKeyboardLeft"]});
}
else if (request.method == "loadKeyboardSettings")
{
sendResponse({openedFirstTime: localStorage["openedFirstTime"],
capsLock: localStorage["capsLock"],
smallKeyboard: localStorage["smallKeyboard"],
touchEvents: localStorage["touchEvents"],
keyboardLayout1: localStorage["keyboardLayout1"],
urlButton: localStorage["urlButton"],
keyboardEnabled: localStorage["keyboardEnabled"]});
}
else if (request.method == "initLoadKeyboardSettings")
{
sendResponse({hardwareAcceleration: localStorage["hardwareAcceleration"],
zoomLevel: localStorage["zoomLevel"],
autoTrigger: localStorage["autoTrigger"],
repeatLetters: localStorage["repeatLetters"],
intelligentScroll: localStorage["intelligentScroll"],
autoTriggerLinks: localStorage["autoTriggerLinks"],
autoTriggerAfter: localStorage["autoTriggerAfter"]});
}
else if (request.method == "setLocalStorage")
{
localStorage[request.key] = request.value;
sendResponse({data: "ok"});
}
else if (request.method == "openFromIframe")
{
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.sendRequest(tab.id, request);
});
}
else if (request.method == "clickFromIframe")
{
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.sendRequest(tab.id, request);
});
}
else if (request.method == "toogleKeyboard")
{
if (localStorage["keyboardEnabled"] != "false") {
localStorage["keyboardEnabled"] = "false";
} else {
localStorage["keyboardEnabled"] = "true";
}
chrome.tabs.getSelected(null, function(tab) {
vkeyboard_loadPageIcon(tab.id);
if (localStorage["keyboardEnabled"] == "false") {
chrome.tabs.sendRequest(tab.id, "closeKeyboard");
} else {
chrome.tabs.sendRequest(tab.id, "openKeyboard");
}
})
sendResponse({data: "ok"});
}
else if (request.method == "toogleKeyboardOn")
{
localStorage["keyboardEnabled"] = "true";
chrome.tabs.getSelected(null, function(tab) {
vkeyboard_loadPageIcon(tab.id);
chrome.tabs.sendRequest(tab.id, "openKeyboard");
})
sendResponse({data: "ok"});
}
else if (request.method == "toogleKeyboardDemand")
{
localStorage["keyboardEnabled"] = "demand";
chrome.tabs.getSelected(null, function(tab) {
vkeyboard_loadPageIcon(tab.id);
chrome.tabs.sendRequest(tab.id, "openKeyboard");
})
sendResponse({data: "ok"});
}
else if (request.method == "toogleKeyboardOff")
{
localStorage["keyboardEnabled"] = "false";
chrome.tabs.getSelected(null, function(tab) {
vkeyboard_loadPageIcon(tab.id);
chrome.tabs.sendRequest(tab.id, "closeKeyboard");
})
sendResponse({data: "ok"});
}
else if (request.method == "openUrlBar")
{
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.sendRequest(tab.id, "openUrlBar");
sendResponse({data: "ok" });
});
} else if (request.method == "createTab") {
chrome.tabs.create({ url: request.url });
}
else {
sendResponse({});
}
});

function vkeyboard_loadPageIcon(tabId) {
if (localStorage["keyboardEnabled"] == "demand") {
chrome.pageAction.setIcon({ tabId: tabId, path: "buttons/keyboard_2.png" }, function() { })
} else if (localStorage["keyboardEnabled"] != "false") {
chrome.pageAction.setIcon({ tabId: tabId, path: "buttons/keyboard_1.png" }, function() { })
} else {
chrome.pageAction.setIcon({ tabId: tabId, path: "buttons/keyboard_3.png" }, function() { })
}
}

chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (localStorage["toogleKeyboard"] != "false") {
chrome.pageAction.show(tabId);
vkeyboard_loadPageIcon(tabId);
} else {
localStorage["keyboardEnabled"] = "true";
chrome.pageAction.hide(tabId);
}
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
138 changes: 138 additions & 0 deletions lg_common/src/lg_common/extensions/virtual_keyboard/keyboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<div id="virtualKeyboardChromeExtensionOverlayScrollExtend" style="display: none; height:500px">
</div>
<div id="virtualKeyboardChromeExtensionOverlayDemand" style="display: none;">
</div>
<div id="virtualKeyboardChromeExtensionOverlaySettings" _state="closed" class="virtualKeyboardChromeExtensionOverlay" style="display: none;">
<ul id="virtualKeyboardChromeExtensionOverlaySettingsUl">
<li class="virtualKeyboardChromeExtensionOverlayButton" _action="setKeyboard" _layout="en">EN</li>
<li class="virtualKeyboardChromeExtensionOverlayButton" _action="setKeyboard" _layout="ru">RU</li>
</ul>
</div>
<div id="virtualKeyboardChromeExtensionUrlBar" style="top: -100px;">
<form onsubmit="this.action = 'http://'+document.getElementById('virtualKeyboardChromeExtensionUrlBarTextBox').value;">
<input type="text" id="virtualKeyboardChromeExtensionUrlBarTextBox" placeholder="http://" />
<input type="submit" value="Go" />
</form>
</div>
<div id="virtualKeyboardChromeExtension">
<div id="virtualKeyboardChromeExtensionDraggableLeft"></div>
<div id="virtualKeyboardChromeExtensionDraggableRight"></div>
<div id="virtualKeyboardChromeExtensionNumberBarKbdInput" style="display: none;">
<table cellpadding="2">
<tr>
<td class="kbdH kbdClick" _key="7"><span>7</span></td>
<td class="kbdH kbdClick" _key="8"><span>8</span></td>
<td class="kbdH kbdClick" _key="9"><span>9</span></td>
<td class="kbdH kbdClick" _key="#"><span>#</span></td>
<td class="kbdD kbdClick" _key="Backspace" rowspan="2"><span>Back</span></td>
</tr>
</table>
<table cellpadding="2">
<tr>
<td class="kbdH kbdClick" _key="4"><span>4</span></td>
<td class="kbdH kbdClick" _key="5"><span>5</span></td>
<td class="kbdH kbdClick" _key="6"><span>6</span></td>
<td class="kbdH kbdClick" _key="-"><span>-</span></td>
<td class="kbdH kbdClick" _key=")"><span>)</span></td>
</tr>
</table>
<table cellpadding="2">
<tr>
<td class="kbdH kbdClick" _key="1"><span>1</span></td>
<td class="kbdH kbdClick" _key="2"><span>2</span></td>
<td class="kbdH kbdClick" _key="3"><span>3</span></td>
<td class="kbdH kbdClick" _key="+"><span>+</span></td>
<td class="kbdH kbdClick" _key="("><span>(</span></td>
</tr>
</table>
<table cellpadding="2">
<tr>
<td class="kbdH kbdClick" _key="0"><span>0</span></td>
<td class="kbdH kbdClick" _key="."><span>.</span></td>
<td class="kbdH kbdClick" _key="*"><span>*</span></td>
<td class="kbdH kbdClick" _key="$"><span>$</span></td>
<td class="kbdD kbdClick" _key="Enter"><span>Enter</span></td>
</tr>
</table>
</div>
<div id="virtualKeyboardChromeExtensionMainKbd">
<table cellpadding="2" id="virtualKeyboardChromeExtensionNumberBarKbd1">
<tr>
<td class="kbdH kbNumberMain kbdClick " _key="1"><span>1</span></td>
<td class="kbdH kbNumberMain kbdClick " _key="2"><span>2</span></td>
<td class="kbdH kbNumberMain kbdClick " _key="3"><span>3</span></td>
<td class="kbdH kbNumberMain kbdClick " _key="4"><span>4</span></td>
<td class="kbdH kbNumberMain kbdClick " _key="5"><span>5</span></td>
<td class="kbdH kbNumberMain kbdClick " _key="6"><span>6</span></td>
<td class="kbdH kbNumberMain kbdClick " _key="7"><span>7</span></td>
<td class="kbdH kbNumberMain kbdClick " _key="8"><span>8</span></td>
<td class="kbdH kbNumberMain kbdClick " _key="9"><span>9</span></td>
<td class="kbdH kbNumberMain kbdClick " _key="0"><span>0</span></td>
</tr>
</table>
<div id="virtualKeyboardChromeExtensionMainKbdPH"></div>
</div>
<div id="virtualKeyboardChromeExtensionMainNumbers" style="display: none;">
<table cellpadding="2">
<tr>
<td class="kbdH kbdClick" _key="_"><span>_</span></td>
<td class="kbdH kbdClick" _key="\"><span>\</span></td>
<td class="kbdH kbdClick" _key=":"><span>:</span></td>
<td class="kbdH kbdClick" _key=";"><span>;</span></td>
<td class="kbdH kbdClick" _key=")"><span>)</span></td>
<td class="kbdH kbdClick" _key="("><span>(</span></td>
<td class="kbdH kbdClick" _key="/"><span>/</span></td>
<td class="kbdH kbdClick" _key="^"><span>^</span></td>
<td class="kbdH kbdClick" _key="1"><span>1</span></td>
<td class="kbdH kbdClick" _key="2"><span>2</span></td>
<td class="kbdH kbdClick" _key="3"><span>3</span></td>
<td style="width: 2px;"><span></span></td>
<td class="kbdD kbdClick" _key="Backspace"><span class="kBack"></span></td>
</tr>
<tr>
<td class="kbdH kbdClick" _key="&euro;"><span>&euro;</span></td>
<td class="kbdH kbdClick" _key="$"><span>$</span></td>
<td class="kbdH kbdClick" _key="&pound;"><span>&pound;</span></td>
<td class="kbdH kbdClick" _key="&"><span>&amp;</span></td>
<td class="kbdH kbdClick" _key="@"><span>@</span></td>
<td class="kbdH kbdClick" _key='"'><span>"</span></td>
<td class="kbdH kbdClick" _key="*"><span>*</span></td>
<td class="kbdH kbdClick" _key="~"><span>~</span></td>
<td class="kbdH kbdClick" _key="4"><span>4</span></td>
<td class="kbdH kbdClick" _key="5"><span>5</span></td>
<td class="kbdH kbdClick" _key="6"><span>6</span></td>
<td style="width: 2px;"><span></span></td>
<td class="kbdD kbdClick" _key="Enter"><span class="kEnter"></span></td>
</tr>
<tr>
<td class="kbdH kbdClick" _key="?"><span>?</span></td>
<td class="kbdH kbdClick" _key="!"><span>!</span></td>
<td class="kbdH kbdClick" _key="'"><span>'</span></td>
<td class="kbdH kbdClick" _key="_"><span>_</span></td>
<td class="kbdH kbdClick" _key="<"><span>&lt;</span></td>
<td class="kbdH kbdClick" _key=">"><span>&gt;</span></td>
<td class="kbdH kbdClick" _key="-"><span>-</span></td>
<td class="kbdH kbdClick" _key="`"><span>`</span></td>
<td class="kbdH kbdClick" _key="7"><span>7</span></td>
<td class="kbdH kbdClick" _key="8"><span>8</span></td>
<td class="kbdH kbdClick" _key="9"><span>9</span></td>
<td style="width: 2px;"><span></span></td>
<td class="kbdD kbdClick" _key="&123"><span class="kAbc">ABC</span></td>
</tr>
<tr>
<td class="kbdH kbdClick" _key="["><span>[</span></td>
<td class="kbdH kbdClick" _key="]"><span>]</span></td>
<td class="kbdH kbdClick" _key="{"><span>{</span></td>
<td class="kbdH kbdClick" _key="}"><span>}</span></td>
<td class="kbdH kbdClick" _key="#"><span>#</span></td>
<td class="kbdH kbdClick" _key=","><span>,</span></td>
<td class="kbdH kbdClick" _key="+"><span>+</span></td>
<td class="kbdH kbdClick" _key="%"><span>%</span></td>
<td colspan="2" class="kbdH kbdClick" _key="0"><span>0</span></td>
<td class="kbdD kbdClick" _key="."><span>.</span></td>
<td style="width: 2px;"><span></span></td>
<td class="kbdD kbdClick" _key="Close"><span class="kClose"></span></td>
</tr>
</table>
</div>
</div>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading