12.06.2020, 11:09
(This post was last modified: 12.06.2020, 11:24 by Erwin van der Zwart.)
Hi,
I created this a few years ago in custom JS, works a lot faster and smoother..
1) Create 10 buttons and give it a custom class pin0 to pin9
2) Create 1 button with custom class "pinback"
3) Create 1 button with custom class "pincancel"
4) Create a text label with custom cllass "entered"
5) Create a 4 byte signed integer object (in this sample "63/7/254")
6) Add this script to custom JS :
You can attached a LUA script to 63/7/254 to compare the enter code with your desired code and if it match execute the action..
BR,
Erwin
I created this a few years ago in custom JS, works a lot faster and smoother..
1) Create 10 buttons and give it a custom class pin0 to pin9
2) Create 1 button with custom class "pinback"
3) Create 1 button with custom class "pincancel"
4) Create a text label with custom cllass "entered"
5) Create a 4 byte signed integer object (in this sample "63/7/254")
6) Add this script to custom JS :
Code:
$(function(){
// Reset pin on visu load
var pin = ""
var enteredpin = ""
var maxlenght = 8
$(".entered").text(pin);
function Pin(pinnumber) {
if (pin.length < maxlenght){
pin = pin + String(pinnumber);
enteredpin = enteredpin + '*'
$(".entered").text(enteredpin);
if (pin.length == maxlenght){
Pin_Send();
}
}
}
function Pin_Back() {
if (pin.length > 1){
pin = pin.substring(0, pin.length - 1);
enteredpin = enteredpin.substring(0, enteredpin.length - 1);
$(".entered").text(enteredpin);
} else {
Pin_Cancel();
}
}
function Pin_Cancel() {
pin = "";
enteredpin = "";
$(".entered").text(enteredpin);
}
function Pin_Send() {
if (pin.length > 0 && pin.length < (maxlenght + 1) ){
grp.write('63/7/254', pin);
Pin_Cancel();
} else {
Pin_Cancel();
}
}
$( ".pin1" ).click(function() {
Pin(1);
});
$( ".pin2" ).click(function() {
Pin(2);
});
$( ".pin3" ).click(function() {
Pin(3);
});
$( ".pin4" ).click(function() {
Pin(4);
});
$( ".pin5" ).click(function() {
Pin(5);
});
$( ".pin6" ).click(function() {
Pin(6);
});
$( ".pin7" ).click(function() {
Pin(7);
});
$( ".pin8" ).click(function() {
Pin(8);
});
$( ".pin9" ).click(function() {
Pin(9);
});
$( ".pin0" ).click(function() {
Pin(0);
});
$( ".pincancel" ).click(function() {
Pin_Cancel();
});
$( ".pinback" ).click(function() {
Pin_Back();
});
});
You can attached a LUA script to 63/7/254 to compare the enter code with your desired code and if it match execute the action..
BR,
Erwin