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
+44 -18

No files matched your search

+5
View File
@@ -319,8 +319,13 @@
</div> </div>
</div> </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> <label for="keyboardButtonKeys" data-i18n="keyboardButtonKeys"></label>
<input type="text" id="keyboardButtonKeys" data-mini="true"> <input type="text" id="keyboardButtonKeys" data-mini="true">
<a data-role="button" id="keyboardButtonSend" data-i18n="keyboardButtonSend"></a>
</div> </div>
</div> </div>
<!-- /content --> <!-- /content -->
+33 -16
View File
@@ -641,7 +641,6 @@
var KeyboardPageHandler = function () { var KeyboardPageHandler = function () {
var init = function () { var init = function () {
initKeyboardPageHandler(); initKeyboardPageHandler();
}; };
@@ -694,15 +693,34 @@
}); });
}); });
$("#keyboardAutoSend").change(function () {
if ($('#keyboardAutoSend').is(':checked')) {
$('#keyboardButtonSend').hide();
} else {
$('#keyboardButtonSend').show();
}
});
$('#keyboardButtonSend').click(function () {
sendKeyboardText();
});
$('#keyboardButtonKeys').keyup(function (e) { $('#keyboardButtonKeys').keyup(function (e) {
if (!$('#keyboardAutoSend').is(':checked') && e.keyCode != 13) {
return;
}
sendKeyboardText();
});
function sendKeyboardText() {
var text = $('#keyboardButtonKeys')[0].value; var text = $('#keyboardButtonKeys')[0].value;
$('#keyboardButtonKeys')[0].value = "";
if (text.length <= 0) { if (text.length <= 0) {
return; return;
} }
$('#keyboardButtonKeys')[0].value = "";
$('#keyboardButtonKeys').first().focus();
/* if ($('#keyboardButtonFunct').is(':checked')) { /* if ($('#keyboardButtonFunct').is(':checked')) {
$('#keyboardButtonKeys')[0].value = text.splice(1) + $('#keyboardButtonKeys')[0].value; $('#keyboardButtonKeys')[0].value = text.splice(1) + $('#keyboardButtonKeys')[0].value;
@@ -726,8 +744,7 @@
}).fail(function () { }).fail(function () {
$('#keyboardButtonKeys')[0].value = text + $('#keyboardButtonKeys')[0].value; $('#keyboardButtonKeys')[0].value = text + $('#keyboardButtonKeys')[0].value;
}); });
}
});
}; };
init(); init();
@@ -835,7 +852,7 @@
} }
}; };
var handleDisplayProfileData = function(data) { var handleDisplayProfileData = function (data) {
$('#playerName').prop("value", data.PlayerName); $('#playerName').prop("value", data.PlayerName);
imageLoader.addImage($('#playerAvatar')[0], data.Avatar, "img/profile.png"); imageLoader.addImage($('#playerAvatar')[0], data.Avatar, "img/profile.png");
@@ -852,19 +869,19 @@
$('#playerPassword').prop('disabled', false).prop("value", "***__oldPassword__***").parent().show(); $('#playerPassword').prop('disabled', false).prop("value", "***__oldPassword__***").parent().show();
$('#playerPasswordLabel').show(); $('#playerPasswordLabel').show();
$('#playerAvatar').click(function() { $('#playerAvatar').click(function () {
if ($('#captureContainer').length > 0) { if ($('#captureContainer').length > 0) {
$('#captureContainer').remove(); $('#captureContainer').remove();
} }
if (document.location.protocol == "file:" if (document.location.protocol == "file:"
&& typeof(navigator) != 'undefined' && typeof (navigator) != 'undefined'
&& typeof(navigator.camera) != 'undefined' && typeof (navigator.camera) != 'undefined'
&& typeof(navigator.camera.getPicture) != 'undefined') { && typeof (navigator.camera.getPicture) != 'undefined') {
navigator.camera.getPicture(function(imageData) { navigator.camera.getPicture(function (imageData) {
$('#playerAvatar').prop("src", "data:image/jpeg;base64," + imageData); $('#playerAvatar').prop("src", "data:image/jpeg;base64," + imageData);
$('#playerAvatar').data("changed", true); $('#playerAvatar').data("changed", true);
}, function() { }, function () {
//Fail - do nothing //Fail - do nothing
}, { }, {
destinationType: navigator.camera.DestinationType.DATA_URL, destinationType: navigator.camera.DestinationType.DATA_URL,
@@ -877,11 +894,11 @@
} else { } else {
$(document.body).append('<div id="captureContainer" style="height: 0px;width:0px; overflow:hidden;"> <input type="file" accept="image/*" id="capture" capture> </div>'); $(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) { if (eventData && eventData.target && eventData.target.files && eventData.target.files.length == 1) {
var file = eventData.target.files[0]; var file = eventData.target.files[0];
var reader = new FileReader(); var reader = new FileReader();
reader.onloadend = function(e) { reader.onloadend = function (e) {
$('#playerAvatar').prop("src", e.target.result); $('#playerAvatar').prop("src", e.target.result);
$('#playerAvatar').data("changed", true); $('#playerAvatar').data("changed", true);
$('#captureContainer').remove(); $('#captureContainer').remove();
@@ -1383,7 +1400,7 @@
var t = this; var t = this;
var init = function() { var init = function () {
initHeartbeat(); initHeartbeat();
}; };
@@ -1401,7 +1418,7 @@
}; };
var checkSession = function() { var checkSession = function () {
if (t.ownProfileId == -1 if (t.ownProfileId == -1
&& pageHandler.profileIdRequest == -1 && pageHandler.profileIdRequest == -1
&& ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login" || $.mobile.activePage.attr("id") == "discover")) { && ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login" || $.mobile.activePage.attr("id") == "discover")) {
@@ -1418,7 +1435,7 @@
}); });
}; };
var initHeartbeat = function() { var initHeartbeat = function () {
setInterval(checkSession, 20000); setInterval(checkSession, 20000);
}; };
+3 -1
View File
@@ -80,5 +80,7 @@
"keyboardButtonShift": "Umschalt", "keyboardButtonShift": "Umschalt",
"keyboardButtonAlt": "Alt", "keyboardButtonAlt": "Alt",
"keyboardButtonCtrl": "Steuerung", "keyboardButtonCtrl": "Steuerung",
"keyboardButtonBackspace": "Rücktaste" "keyboardButtonBackspace": "Rücktaste",
"keyboardAutoSend": "Tasten autom. senden",
"keyboardButtonSend": "Senden"
} }
+3 -1
View File
@@ -80,5 +80,7 @@
"keyboardButtonShift": "Shift", "keyboardButtonShift": "Shift",
"keyboardButtonAlt": "Alt", "keyboardButtonAlt": "Alt",
"keyboardButtonCtrl": "Control", "keyboardButtonCtrl": "Control",
"keyboardButtonBackspace": "Backspace" "keyboardButtonBackspace": "Backspace",
"keyboardAutoSend": "Auto send keys",
"keyboardButtonSend": "Send"
} }