Reactivated and modified text field for keyboard
This commit is contained in:
1 parent
5e67d9d4db
commit
9773aa31d8
7 files changed
+91
-37
No files matched your search
@@ -33,6 +33,7 @@ namespace ServerLib
|
||||
private bool _Encrypted;
|
||||
|
||||
public static SendKeyEventDelegate SendKeyEvent { internal get; set; }
|
||||
public static SendKeyStringEventDelegate SendKeyStringEvent { internal get; set; }
|
||||
|
||||
#region profile
|
||||
public static GetProfileDataDelegate GetProfileData { internal get; set; }
|
||||
|
||||
@@ -58,6 +58,23 @@ namespace ServerLib
|
||||
CServer.SendKeyEvent(key);
|
||||
}
|
||||
|
||||
public void SendKeyStringEvent(string keyString)
|
||||
{
|
||||
if (!_CheckRight(EUserRights.UseKeyboard))
|
||||
return;
|
||||
|
||||
if (CServer.SendKeyStringEvent == null)
|
||||
{
|
||||
if (WebOperationContext.Current != null)
|
||||
{
|
||||
WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.NotFound;
|
||||
WebOperationContext.Current.OutgoingResponse.StatusDescription = "Not found";
|
||||
}
|
||||
}
|
||||
else
|
||||
CServer.SendKeyStringEvent(keyString);
|
||||
}
|
||||
|
||||
#region profile
|
||||
public int GetOwnProfileId()
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ using System.Text.RegularExpressions;
|
||||
namespace ServerLib
|
||||
{
|
||||
public delegate bool SendKeyEventDelegate(string key);
|
||||
public delegate bool SendKeyStringEventDelegate(string keyString);
|
||||
|
||||
#region profile
|
||||
public delegate SProfileData GetProfileDataDelegate(int profileId, bool isReadonly);
|
||||
|
||||
@@ -30,6 +30,11 @@ namespace ServerLib
|
||||
UriTemplate = "/sendKeyEvent?key={key}")]
|
||||
void SendKeyEvent(string key);
|
||||
|
||||
[OperationContract, WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/sendKeyStringEvent?keyString={keyString}")]
|
||||
void SendKeyStringEvent(string keyString);
|
||||
|
||||
#region profile
|
||||
[OperationContract, WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace Vocaluxe.Base.Server
|
||||
_Server = new CServer(CConfig.ServerPort, CConfig.ServerEncryption == EOffOn.TR_CONFIG_ON);
|
||||
|
||||
CServer.SendKeyEvent = _SendKeyEvent;
|
||||
CServer.SendKeyStringEvent = _sendKeyStringEvent;
|
||||
CServer.GetProfileData = _GetProfileData;
|
||||
CServer.SendProfileData = _SendProfileData;
|
||||
CServer.GetProfileList = _GetProfileList;
|
||||
@@ -186,6 +187,31 @@ namespace Vocaluxe.Base.Server
|
||||
return result;
|
||||
}
|
||||
|
||||
private static bool _sendKeyStringEvent(string keyString)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
foreach (var key in keyString.ToCharArray())
|
||||
{
|
||||
Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, false, Char.IsUpper(key), false, false, key, _ParseKeys(key)));
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Keys _ParseKeys(char keyText)
|
||||
{
|
||||
Keys key;
|
||||
|
||||
if (!Enum.TryParse(keyText.ToString(), true, out key))
|
||||
{
|
||||
key = Keys.None;
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
#region profile
|
||||
private static SProfileData _GetProfileData(int profileId, bool isReadonly)
|
||||
{
|
||||
|
||||
@@ -301,10 +301,10 @@
|
||||
<a data-role="button" id="keyboardButtonP">P</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div style>
|
||||
<div>
|
||||
<label for="keyboardButtonKeys" data-i18n="keyboardButtonKeys"></label>
|
||||
<input type="text" id="keyboardButtonKeys" data-mini="true">
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /content -->
|
||||
</div>
|
||||
|
||||
+39
-35
@@ -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??
|
||||
@@ -316,9 +316,9 @@
|
||||
};
|
||||
|
||||
this.reset = function () {
|
||||
this.customSelectPlaylistSongCallback = null;
|
||||
this.profileIdRequest = -1;
|
||||
this.songIdRequest = -1;
|
||||
this.customSelectPlaylistSongCallback = null;
|
||||
this.profileIdRequest = -1;
|
||||
this.songIdRequest = -1;
|
||||
};
|
||||
|
||||
var replaceTransitionHandler = function () {
|
||||
@@ -693,17 +693,21 @@
|
||||
});
|
||||
|
||||
$('#keyboardButtonKeys').keyup(function (e) {
|
||||
var c = String.fromCharCode(e.keyCode);
|
||||
if (c.match(/\w/)) {
|
||||
c = e.keyCode >= 65 ? c.toLowerCase() : c;
|
||||
request({
|
||||
url: "sendKeyEvent?key=" + c
|
||||
});
|
||||
}
|
||||
var oldText = $('#keyboardButtonKeys')[0].value;
|
||||
if (oldText.length > 0) {
|
||||
$('#keyboardButtonKeys')[0].value = oldText.slice(1);
|
||||
var text = $('#keyboardButtonKeys')[0].value;
|
||||
|
||||
$('#keyboardButtonKeys')[0].value = "";
|
||||
if (text.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
request({
|
||||
contentType: "application/json;charset=utf-8",
|
||||
type: "GET",
|
||||
url: "sendKeyStringEvent?keyString=" + text
|
||||
}).fail(function () {
|
||||
$('#keyboardButtonKeys')[0].value = text + $('#keyboardButtonKeys')[0].value;
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
@@ -812,7 +816,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
var handleDisplayProfileData = function(data) {
|
||||
var handleDisplayProfileData = function (data) {
|
||||
$('#playerName').prop("value", data.PlayerName);
|
||||
|
||||
imageLoader.addImage($('#playerAvatar')[0], data.Avatar, "img/profile.png");
|
||||
@@ -829,19 +833,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,
|
||||
@@ -854,11 +858,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();
|
||||
@@ -1358,25 +1362,25 @@
|
||||
this.sessionId = "";
|
||||
this.serverBaseAddress = "";
|
||||
|
||||
var init = function() {
|
||||
var init = function () {
|
||||
initHeartbeat();
|
||||
};
|
||||
|
||||
this.logout = function () {
|
||||
this.ownProfileId = -1;
|
||||
|
||||
|
||||
this.sessionId = "";
|
||||
|
||||
pageHandler.reset();
|
||||
|
||||
pageHandler.reset();
|
||||
|
||||
if (window.localStorage) {
|
||||
window.localStorage.setItem("VocaluxeSessionKey", "");
|
||||
}
|
||||
$.mobile.changePage("#login", { transition: "slidefade" });
|
||||
};
|
||||
|
||||
|
||||
var checkSession = function() {
|
||||
|
||||
|
||||
var checkSession = function () {
|
||||
if (ownProfileId == -1
|
||||
&& profileIdRequest == -1
|
||||
&& ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login" || $.mobile.activePage.attr("id") == "discover")) {
|
||||
@@ -1393,10 +1397,10 @@
|
||||
});
|
||||
};
|
||||
|
||||
var initHeartbeat = function() {
|
||||
var initHeartbeat = function () {
|
||||
setInterval(checkSession, 20000);
|
||||
};
|
||||
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user