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> </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 -->
+53 -36
View File
@@ -26,11 +26,11 @@
function preStart() { function preStart() {
translator.translationLoaded.done(function () { translator.translationLoaded.done(function () {
translator.translate(); translator.translate();
sessionHandler = new SessionHandler(); sessionHandler = new SessionHandler();
imageLoader = new ImageLoader(); imageLoader = new ImageLoader();
externalServices = new ExternalServices(); externalServices = new ExternalServices();
pageHandler = new PageHandler(); pageHandler = new PageHandler();
pageHandler.init(); pageHandler.init();
}); });
@@ -154,7 +154,7 @@
} }
}; };
} }
function ExternalServices() { function ExternalServices() {
var popupVideoHeight = 390; var popupVideoHeight = 390;
var popupVideoWidth = 640; var popupVideoWidth = 640;
@@ -190,7 +190,7 @@
'height': h - (ifrPadding + ifrBorder) 'height': h - (ifrPadding + ifrBorder)
}; };
} }
$("#popupVideo").find("a").click(function () { $("#popupVideo").find("a").click(function () {
$("#popupVideo").popup("close"); $("#popupVideo").popup("close");
$("#popupVideo").popup("close"); //Sometimes twice?? $("#popupVideo").popup("close"); //Sometimes twice??
@@ -641,7 +641,6 @@
var KeyboardPageHandler = function () { var KeyboardPageHandler = function () {
var init = function () { var init = function () {
initKeyboardPageHandler(); 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) { $('#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;
var numericElements = /^[0-9][0-9]?/.exec(text.charAt(0)); var numericElements = /^[0-9][0-9]?/.exec(text.charAt(0));
if (parseInt(numericElements)) { if (parseInt(numericElements)) {
request({ request({
url: "sendKeyEvent?key=F" + numericElements url: "sendKeyEvent?key=F" + numericElements
}); });
} }
$("#keyboardButtonFunct").attr("checked", false).checkboxradio("refresh"); $("#keyboardButtonFunct").attr("checked", false).checkboxradio("refresh");
}*/ }*/
request({ request({
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
@@ -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,25 +1400,25 @@
var t = this; var t = this;
var init = function() { var init = function () {
initHeartbeat(); initHeartbeat();
}; };
this.logout = function () { this.logout = function () {
t.ownProfileId = -1; t.ownProfileId = -1;
t.sessionId = ""; t.sessionId = "";
pageHandler.reset(); pageHandler.reset();
if (window.localStorage) { if (window.localStorage) {
window.localStorage.setItem("VocaluxeSessionKey", ""); window.localStorage.setItem("VocaluxeSessionKey", "");
} }
$.mobile.changePage("#login", { transition: "slidefade" }); $.mobile.changePage("#login", { transition: "slidefade" });
}; };
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,10 +1435,10 @@
}); });
}; };
var initHeartbeat = function() { var initHeartbeat = function () {
setInterval(checkSession, 20000); setInterval(checkSession, 20000);
}; };
init(); init();
} }
+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"
} }