add feature word_typed_listener_allowed_only_for_empty_customerf
This commit is contained in:
@@ -4,7 +4,7 @@ var seq = '';
|
||||
var socket;
|
||||
$(document).ready(
|
||||
function(){
|
||||
|
||||
|
||||
$("input[name='number']").on('focus', function (e) {
|
||||
$(this)
|
||||
.one('mouseup', function () {
|
||||
@@ -13,7 +13,7 @@ $(document).ready(
|
||||
})
|
||||
.select();
|
||||
});
|
||||
|
||||
|
||||
addDocumentKeypressedListener();
|
||||
}
|
||||
);
|
||||
@@ -23,9 +23,9 @@ function addDocumentKeypressedListener(){
|
||||
$( document ).keypress(function( event ) {
|
||||
var tag = event.target.tagName.toLowerCase();
|
||||
if ( tag != 'input' && tag != 'textarea' && tag != 'select') {
|
||||
|
||||
|
||||
resetSequenceIfToMuchTimePassedOrEnterWasPressed(event);
|
||||
|
||||
|
||||
if ( event.which == 13 ) {
|
||||
enterPressed = 1;
|
||||
if ( seq ){
|
||||
@@ -35,19 +35,27 @@ function addDocumentKeypressedListener(){
|
||||
appendCharToSeq(event);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$( document ).on( "wordtyped", function( event, data ) {
|
||||
var word;
|
||||
word = data.word;
|
||||
if ( word && word.length > 0){
|
||||
|
||||
location.href= reception_card_url +'&number=' + word;
|
||||
|
||||
|
||||
var redirectAllowed = true;
|
||||
if ( isWordTypedListenerAllowedOnlyForEmptyCustomer ){
|
||||
if ( location.href !== reception_card_url ){
|
||||
redirectAllowed = false;
|
||||
console.info("disalbling customer redirect. reason: isWordTypedListenerAllowedOnlyForEmptyCustomer = true")
|
||||
}
|
||||
}
|
||||
if ( redirectAllowed){
|
||||
location.href= reception_card_url +'&number=' + word;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function resetSequenceIfToMuchTimePassedOrEnterWasPressed(){
|
||||
var prevDate, timePassed;
|
||||
prevDate= keyDate;
|
||||
@@ -58,7 +66,7 @@ function addDocumentKeypressedListener(){
|
||||
enterPressed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function appendCharToSeq(event){
|
||||
var code,s;
|
||||
code = event.which;
|
||||
@@ -68,7 +76,7 @@ function addDocumentKeypressedListener(){
|
||||
seq += s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user