25.04.2016, 11:47
(This post was last modified: 25.04.2016, 23:11 by Erwin van der Zwart.)
Hi,
Put this in your custom Javascript and upload a audiofile called 'click.mp3' into your image -> backgrounds tab:
Only for / available in new upcomming firmware version
Put this in your custom Javascript and upload a audiofile called 'click.mp3' into your image -> backgrounds tab:
Only for / available in new upcomming firmware version
Code:
// Closing current script section to add elements
</script>
<audio id="LM_Audio" style="display: none;"></audio>
<script type="text/javascript"> // Starting new script section after adding elements
$(function() {
var LM_snd = document.getElementById("LM_Audio");
LM_snd.src= "/scada/resources/img/click.mp3";
LM_snd.load();
function LM_Pressed_Audio() {
LM_snd.play();
}
$(".item-control")
.on("vmousedown", function() {
LM_Pressed_Audio()
});
$(".btn")
.on("vmousedown", function() {
LM_Pressed_Audio()
});
mute = Scada.encodeGroupAddress('1/1/1'); // Use bit object !
objectStore.addListener(mute, function(obj, type) {
if(obj.value == 1){
LM_snd.muted = true;
} else {
LM_snd.muted = false;
}
});
volume = Scada.encodeGroupAddress('1/1/2'); // Use byte object !
objectStore.addListener(volume, function(obj, type) {
if( obj.datatype.major == 5 && obj.datatype.minor == 0 ){
var volumevalue = (obj.value / 2.55) / 100;
LM_snd.volume = volumevalue;
} else if ( obj.datatype.major == 5 && obj.datatype.minor == 1 ){
var volumevalue = (obj.value / 100);
LM_snd.volume = volumevalue;
}
});
});