Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion desktop/js/administration.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,9 @@ document.getElementById('in_searchConfig').addEventListener('keyup', function(ev
if (tabId == undefined) return
//Create new tablink ?
if (!tabsArr.includes(tabId)) {
tabName = document.querySelector('a[data-target="#' + tabId + '"]').innerHTML
const _tabEl = document.querySelector('a[data-target="#' + tabId + '"]')
if (!_tabEl) return
tabName = _tabEl.innerHTML
if (tabName != null) {
var newTabLink = document.createElement('div')
newTabLink.innerHTML = '<a role="searchTabLink" data-target="#' + tabId + '">' + tabName + '</a>'
Expand Down
6 changes: 4 additions & 2 deletions desktop/js/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ if (!jeeFrontEnd.backup) {
options += '<option value="' + data[i] + '">' + data[i] + '</option>'
}
} else {
document.querySelector('.bt_restoreRepoBackup[data-repo="' + _repo + '"]').addClass('disabled')
const _btEl = document.querySelector('.bt_restoreRepoBackup[data-repo="' + _repo + '"]')
if (_btEl) _btEl.addClass('disabled')
}
document.querySelector('.sel_restoreCloudBackup[data-repo="' + _repo + '"]').innerHTML = options
const _selEl = document.querySelector('.sel_restoreCloudBackup[data-repo="' + _repo + '"]')
if (_selEl) _selEl.innerHTML = options
}
})
},
Expand Down
2 changes: 1 addition & 1 deletion desktop/js/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ document.getElementById('div_conf').addEventListener('click', function(event) {
success: function() {
jeeFrontEnd.modifyWithoutSave = false
document.getElementById('bt_gotoDashboard').querySelectorAll(':scope li a').forEach(_link => {
if (_link.href.includes(removeId)) _link.parentNode.remove()
if (_link.href.includes(id)) _link.parentNode.remove()
})
jeedomUtils.loadPage('index.php?v=d&p=object&removeSuccessFull=1')
}
Expand Down
4 changes: 3 additions & 1 deletion desktop/js/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ if (!jeeFrontEnd.overview) {
},
updateSummary: function(_className) {
_className = _className.replace('objectSummaryContainer ', '')
var parent = document.querySelector('.' + _className).closest('.objectPreview')
const _classEl = document.querySelector('.' + _className)
if (!_classEl) return
var parent = _classEl.closest('.objectPreview')
if (parent == null) return
parent.querySelector('.topPreview')?.querySelectorAll('.objectSummaryParent')?.remove()
var pResume = parent.querySelector('.resume')
Expand Down
3 changes: 2 additions & 1 deletion desktop/js/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ if (!jeeFrontEnd.replace) {
return select
},
resetEqlogicSelect: function(eqlogicId=-1) {
document.querySelector('#eqSource ul.eqLogic[data-id="' + eqlogicId + '"] select.selectEqReplace').jeeValue('')
const _selEl = document.querySelector('#eqSource ul.eqLogic[data-id="' + eqlogicId + '"] select.selectEqReplace')
if (_selEl) _selEl.jeeValue('')
},
resetCmdSelects: function(eqlogicId=-1) {
document.querySelectorAll('#eqSource ul.eqLogic[data-id="' + eqlogicId + '"] li.cmd').forEach( _cmd => {
Expand Down
3 changes: 3 additions & 0 deletions desktop/js/scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,7 @@ document.getElementById('generaltab').addEventListener('click', function(event)
document.getElementById('scenarioThumbnailDisplay').unseen()
jeeP.printScenario(_target.getAttribute('data-scenario_id'))
}
return
}

if (_target = event.target.closest('.action_link')) {
Expand Down Expand Up @@ -2215,10 +2216,12 @@ document.getElementById('scenariotab').addEventListener('click', function(event)

if (_target = event.target.closest('#bt_cancelElementSave')) {
jeeDialog.modal(document.getElementById('md_addElement'))._jeeDialog.hide()
return
}

if (_target = event.target.closest('#bt_crossElementSave')) {
jeeDialog.modal(document.getElementById('md_addElement'))._jeeDialog.hide()
return
}

if (_target = event.target.closest('input:not([type="checkbox"]).expressionAttr, textarea.expressionAttr')) { //ctrl-click input popup
Expand Down
20 changes: 13 additions & 7 deletions desktop/js/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,16 @@ if (!jeeFrontEnd.types) {
var eqName, cmdName, thisCmd, thisClass, select
for (var _id in queryEqIds) {
inner += '<div class="queryEq" data-id="' + _id + '">'
eqName = document.querySelector('li.eqLogic[data-id="' + _id + '"]').getAttribute('data-name')
const _eqEl = document.querySelector('li.eqLogic[data-id="' + _id + '"]')
if (!_eqEl) continue
eqName = _eqEl.getAttribute('data-name')
inner += '<div class="center biggerText">' + eqName + '</div>'
for (var _cmd in queryEqIds[_id].cmds) {
thisCmd = queryEqIds[_id].cmds[_cmd]
// console.log(thisCmd)
cmdName = document.querySelector('li.cmd[data-id="' + thisCmd.id + '"]').getAttribute('data-name')
const _cmdEl = document.querySelector('li.cmd[data-id="' + thisCmd.id + '"]')
if (!_cmdEl) continue
cmdName = _cmdEl.getAttribute('data-name')
thisClass = thisCmd.type == 'info' ? 'alert-info' : 'alert-warning'

inner += '<div class="form-group queryCmd" data-id="' + thisCmd.id + '">'
Expand Down Expand Up @@ -486,16 +490,18 @@ new jeeCtxMenu({

return {
callback: function(key, options) {
const _cmdEl = document.querySelector('li.cmd[data-id="' + cmdId + '"]')
if (!_cmdEl) return
if (options.commands[key].id == 'delete_me') {
document.querySelector('li.cmd[data-id="' + cmdId + '"] .genericType').textContent = 'None'
document.querySelector('li.cmd[data-id="' + cmdId + '"]').setAttribute('data-generic', '')
_cmdEl.querySelector('.genericType').textContent = 'None'
_cmdEl.setAttribute('data-generic', '')
} else {
//var text = options.commands[key].id.split('::')[0] + jeephp2js.typeStringSep + options.commands[key].node.innerText
var text = options.commands[key].id.split('::')[0] + jeephp2js.typeStringSep + options.commands[key].name
document.querySelector('li.cmd[data-id="' + cmdId + '"] .genericType').textContent = text
document.querySelector('li.cmd[data-id="' + cmdId + '"]').setAttribute('data-generic', options.commands[key].id.split('::')[1])
_cmdEl.querySelector('.genericType').textContent = text
_cmdEl.setAttribute('data-generic', options.commands[key].id.split('::')[1])
}
document.querySelector('li.cmd[data-id="' + cmdId + '"]').setAttribute('data-changed', '1')
_cmdEl.setAttribute('data-changed', '1')
jeeFrontEnd.modifyWithoutSave = true
},
items: contextmenuitems
Expand Down
3 changes: 2 additions & 1 deletion desktop/js/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ document.getElementById('div_pageContainer').addEventListener('click', function(
}

if (_target = event.target.closest('.bt_gotoViewZone')) {
document.querySelector('.lg_viewZone[data-zone_id="' + _target.getAttribute('data-zone_id') + '"]').scrollIntoView()
const _zoneEl = document.querySelector('.lg_viewZone[data-zone_id="' + _target.getAttribute('data-zone_id') + '"]')
if (_zoneEl) _zoneEl.scrollIntoView()
return
}

Expand Down
Loading