Make Alert and Pop on Event into localStorage options
parent
df907208e7
commit
913d8e15a7
|
|
@ -4822,8 +4822,6 @@ module.exports = function(s,config,lang){
|
|||
"name": "detail=audio_note",
|
||||
"field": lang["Notification Sound"],
|
||||
"description": lang["fieldTextAudioNote"],
|
||||
"default": "",
|
||||
"example": "",
|
||||
"fieldType": "select",
|
||||
"possible": s.listOfAudioFiles
|
||||
},
|
||||
|
|
@ -4831,8 +4829,6 @@ module.exports = function(s,config,lang){
|
|||
"name": "detail=audio_alert",
|
||||
"field": lang["Alert Sound"],
|
||||
"description": lang["fieldTextAudioAlert"],
|
||||
"default": "",
|
||||
"example": "",
|
||||
"fieldType": "select",
|
||||
"possible": s.listOfAudioFiles
|
||||
},
|
||||
|
|
@ -4841,15 +4837,12 @@ module.exports = function(s,config,lang){
|
|||
"field": lang["Alert Sound Delay"],
|
||||
"description": lang["fieldTextAudioDelay"],
|
||||
"default": "1",
|
||||
"example": "",
|
||||
"possible": ""
|
||||
},
|
||||
{
|
||||
"name": "detail=event_mon_pop",
|
||||
"field": lang["Popout Monitor on Event"],
|
||||
"description": lang["fieldTextEventMonPop"],
|
||||
"default": "en_CA",
|
||||
"example": "",
|
||||
"fieldType": "select",
|
||||
"possible": [
|
||||
{
|
||||
|
|
@ -7690,6 +7683,18 @@ module.exports = function(s,config,lang){
|
|||
attributes: 'shinobi-switch="dontShowDetection" ui-change-target=".dot" on-class="dot-green" off-class="dot-grey"',
|
||||
color: 'grey',
|
||||
},
|
||||
{
|
||||
label: lang[`Alert on Event`],
|
||||
class: 'cursor-pointer',
|
||||
attributes: 'shinobi-switch="alertOnEvent" ui-change-target=".dot" on-class="dot-green" off-class="dot-grey"',
|
||||
color: 'grey',
|
||||
},
|
||||
{
|
||||
label: lang[`Popout on Event`],
|
||||
class: 'cursor-pointer',
|
||||
attributes: 'shinobi-switch="popOnEvent" ui-change-target=".dot" on-class="dot-green" off-class="dot-grey"',
|
||||
color: 'grey',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -748,6 +748,8 @@
|
|||
"Rotate": "Rotate",
|
||||
"Trigger Event": "Trigger Event",
|
||||
"Test": "Test",
|
||||
"Popout on Event": "Popout on Event",
|
||||
"Alert on Event": "Alert on Event",
|
||||
"Add Marker": "Add Marker",
|
||||
"Test Object Event": "Test Object Event",
|
||||
"Test Motion Event": "Test Motion Event",
|
||||
|
|
|
|||
|
|
@ -1273,7 +1273,7 @@ $(document).ready(function(e){
|
|||
}
|
||||
playAudioAlert()
|
||||
var monitorPop = monitorPops[monitorId]
|
||||
if($user.details.event_mon_pop === '1' && (!monitorPop || monitorPop.closed === true)){
|
||||
if(window.popLiveOnEvent && (!monitorPop || monitorPop.closed === true)){
|
||||
popOutMonitor(monitorId)
|
||||
}
|
||||
// console.log({
|
||||
|
|
@ -1321,12 +1321,28 @@ $(document).ready(function(e){
|
|||
window.dontShowDetection = true
|
||||
}
|
||||
}
|
||||
dashboardSwitchCallbacks.alertOnEvent = function(toggleState){
|
||||
// audio_alert
|
||||
if(toggleState !== 1){
|
||||
window.audioAlertOnEvent = false
|
||||
}else{
|
||||
window.audioAlertOnEvent = true
|
||||
}
|
||||
}
|
||||
dashboardSwitchCallbacks.popOnEvent = function(toggleState){
|
||||
if($user.details.event_mon_pop === '1'){
|
||||
window.popLiveOnEvent = true
|
||||
}else if(toggleState !== 1){
|
||||
window.popLiveOnEvent = false
|
||||
}else{
|
||||
window.popLiveOnEvent = true
|
||||
}
|
||||
}
|
||||
dashboardSwitchCallbacks.monitorMuteAudio = function(toggleState){
|
||||
var monitorMutes = dashboardOptions().monitorMutes || {}
|
||||
$('.monitor_item video').each(function(n,vidEl){
|
||||
var el = $(this)
|
||||
var monitorId = el.parents('[data-mid]').attr('data-mid')
|
||||
console.log(monitorId,monitorMutes[monitorId])
|
||||
if(toggleState === 1){
|
||||
vidEl.muted = true
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -230,6 +230,9 @@ function toggleSubStream(monitorId,callback){
|
|||
}
|
||||
function playAudioAlert(){
|
||||
var fileName = $user.details.audio_alert
|
||||
if(window.audioAlertOnEvent && !fileName){
|
||||
fileName = `alert.mp3`
|
||||
}
|
||||
if(fileName && window.soundAlarmed !== true){
|
||||
window.soundAlarmed = true
|
||||
var audio = new Audio(`libs/audio/${fileName}`)
|
||||
|
|
|
|||
Loading…
Reference in New Issue