Added manual key send to the remote keyboard

This commit is contained in:
lukeIam committed 2014-11-12 21:59:35 +01:00
1 parent b036aa5d69
commit 0cdb537424
4 files changed
+64 -38

No files matched your search

+5
View File
@@ -319,8 +319,13 @@
</div>
</div>
<div>
<fieldset data-role="controlgroup" data-type="horizontal">
<input type="checkbox" name="keyboardAutoSend" id="keyboardAutoSend" />
<label data-i18n="keyboardAutoSend" for="keyboardAutoSend"></label>
</fieldset>
<label for="keyboardButtonKeys" data-i18n="keyboardButtonKeys"></label>
<input type="text" id="keyboardButtonKeys" data-mini="true">
<a data-role="button" id="keyboardButtonSend" data-i18n="keyboardButtonSend"></a>
</div>
</div>
<!-- /content -->
+53 -36
View File
@@ -26,11 +26,11 @@
function preStart() {
translator.translationLoaded.done(function () {
translator.translate();
sessionHandler = new SessionHandler();
imageLoader = new ImageLoader();
externalServices = new ExternalServices();
pageHandler = new PageHandler();
pageHandler = new PageHandler();
pageHandler.init();
});
@@ -154,7 +154,7 @@
}
};
}
function ExternalServices() {
var popupVideoHeight = 390;
var popupVideoWidth = 640;
@@ -190,7 +190,7 @@
'height': h - (ifrPadding + ifrBorder)
};
}
$("#popupVideo").find("a").click(function () {
$("#popupVideo").popup("close");
$("#popupVideo").popup("close"); //Sometimes twice??
@@ -641,7 +641,6 @@
var KeyboardPageHandler = function () {
var init = function () {
initKeyboardPageHandler();
};
@@ -694,26 +693,45 @@
});
});
$("#keyboardAutoSend").change(function () {
if ($('#keyboardAutoSend').is(':checked')) {
$('#keyboardButtonSend').hide();
} else {
$('#keyboardButtonSend').show();
}
});
$('#keyboardButtonSend').click(function () {
sendKeyboardText();
});
$('#keyboardButtonKeys').keyup(function (e) {
if (!$('#keyboardAutoSend').is(':checked') && e.keyCode != 13) {
return;
}
sendKeyboardText();
});
function sendKeyboardText() {
var text = $('#keyboardButtonKeys')[0].value;
$('#keyboardButtonKeys')[0].value = "";
if (text.length <= 0) {
return;
}
$('#keyboardButtonKeys')[0].value = "";
$('#keyboardButtonKeys').first().focus();
/* if ($('#keyboardButtonFunct').is(':checked')) {
$('#keyboardButtonKeys')[0].value = text.splice(1) + $('#keyboardButtonKeys')[0].value;
var numericElements = /^[0-9][0-9]?/.exec(text.charAt(0));
if (parseInt(numericElements)) {
request({
url: "sendKeyEvent?key=F" + numericElements
});
}
$("#keyboardButtonFunct").attr("checked", false).checkboxradio("refresh");
}*/
/* if ($('#keyboardButtonFunct').is(':checked')) {
$('#keyboardButtonKeys')[0].value = text.splice(1) + $('#keyboardButtonKeys')[0].value;
var numericElements = /^[0-9][0-9]?/.exec(text.charAt(0));
if (parseInt(numericElements)) {
request({
url: "sendKeyEvent?key=F" + numericElements
});
}
$("#keyboardButtonFunct").attr("checked", false).checkboxradio("refresh");
}*/
request({
contentType: "application/json;charset=utf-8",
@@ -726,8 +744,7 @@
}).fail(function () {
$('#keyboardButtonKeys')[0].value = text + $('#keyboardButtonKeys')[0].value;
});
});
}
};
init();
@@ -835,7 +852,7 @@
}
};
var handleDisplayProfileData = function(data) {
var handleDisplayProfileData = function (data) {
$('#playerName').prop("value", data.PlayerName);
imageLoader.addImage($('#playerAvatar')[0], data.Avatar, "img/profile.png");
@@ -852,19 +869,19 @@
$('#playerPassword').prop('disabled', false).prop("value", "***__oldPassword__***").parent().show();
$('#playerPasswordLabel').show();
$('#playerAvatar').click(function() {
$('#playerAvatar').click(function () {
if ($('#captureContainer').length > 0) {
$('#captureContainer').remove();
}
if (document.location.protocol == "file:"
&& typeof(navigator) != 'undefined'
&& typeof(navigator.camera) != 'undefined'
&& typeof(navigator.camera.getPicture) != 'undefined') {
navigator.camera.getPicture(function(imageData) {
&& typeof (navigator) != 'undefined'
&& typeof (navigator.camera) != 'undefined'
&& typeof (navigator.camera.getPicture) != 'undefined') {
navigator.camera.getPicture(function (imageData) {
$('#playerAvatar').prop("src", "data:image/jpeg;base64," + imageData);
$('#playerAvatar').data("changed", true);
}, function() {
}, function () {
//Fail - do nothing
}, {
destinationType: navigator.camera.DestinationType.DATA_URL,
@@ -877,11 +894,11 @@
} else {
$(document.body).append('<div id="captureContainer" style="height: 0px;width:0px; overflow:hidden;"> <input type="file" accept="image/*" id="capture" capture> </div>');
$('#capture').change(function(eventData) {
$('#capture').change(function (eventData) {
if (eventData && eventData.target && eventData.target.files && eventData.target.files.length == 1) {
var file = eventData.target.files[0];
var reader = new FileReader();
reader.onloadend = function(e) {
reader.onloadend = function (e) {
$('#playerAvatar').prop("src", e.target.result);
$('#playerAvatar').data("changed", true);
$('#captureContainer').remove();
@@ -1383,25 +1400,25 @@
var t = this;
var init = function() {
var init = function () {
initHeartbeat();
};
this.logout = function () {
t.ownProfileId = -1;
t.sessionId = "";
pageHandler.reset();
pageHandler.reset();
if (window.localStorage) {
window.localStorage.setItem("VocaluxeSessionKey", "");
}
$.mobile.changePage("#login", { transition: "slidefade" });
};
var checkSession = function() {
var checkSession = function () {
if (t.ownProfileId == -1
&& pageHandler.profileIdRequest == -1
&& ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login" || $.mobile.activePage.attr("id") == "discover")) {
@@ -1418,10 +1435,10 @@
});
};
var initHeartbeat = function() {
var initHeartbeat = function () {
setInterval(checkSession, 20000);
};
init();
}
+3 -1
View File
@@ -80,5 +80,7 @@
"keyboardButtonShift": "Umschalt",
"keyboardButtonAlt": "Alt",
"keyboardButtonCtrl": "Steuerung",
"keyboardButtonBackspace": "Rücktaste"
"keyboardButtonBackspace": "Rücktaste",
"keyboardAutoSend": "Tasten autom. senden",
"keyboardButtonSend": "Senden"
}
+3 -1
View File
@@ -80,5 +80,7 @@
"keyboardButtonShift": "Shift",
"keyboardButtonAlt": "Alt",
"keyboardButtonCtrl": "Control",
"keyboardButtonBackspace": "Backspace"
"keyboardButtonBackspace": "Backspace",
"keyboardAutoSend": "Auto send keys",
"keyboardButtonSend": "Send"
}