From fe30872635521ef79f177b12b6f87ee5753e945f Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sat, 14 Jun 2025 21:05:27 +0200 Subject: [PATCH] luci-app-adblock: sync with adblock 4.4.2-3 Signed-off-by: Dirk Brenken (cherry picked from commit 74580723a32736f8900dbc35d5b64b70aa6d4e4c) --- .../resources/view/adblock/dnsreport.js | 26 ++++++++++--------- .../resources/view/adblock/map.html | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/dnsreport.js b/applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/dnsreport.js index 3f3a5c40ff..4080f6cf00 100644 --- a/applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/dnsreport.js +++ b/applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/dnsreport.js @@ -79,7 +79,7 @@ function handleAction(ev) { } if (ev === 'query') { - L.ui.showModal(_('Blocklist Query'), [ + ui.showModal(_('Blocklist Query'), [ E('p', _('Query active blocklists and backups for a specific domain.')), E('div', { 'class': 'left', 'style': 'display:flex; flex-direction:column' }, [ E('label', { 'style': 'padding-top:.5em', 'id': 'run' }, [ @@ -200,7 +200,7 @@ function handleAction(ev) { } if (ev === 'map') { - let md = ui.showModal(null, [ + const modal = ui.showModal(null, [ E('div', { id: 'mapModal', style: 'position: relative;' @@ -230,7 +230,7 @@ function handleAction(ev) { }, _('Map Reset')) ]) ]); - md.style.maxWidth = '90%'; + modal.style.maxWidth = '90%'; document.getElementById('mapModal').focus(); } } @@ -349,7 +349,7 @@ return view.extend({ } cbi_update_table(tbl_requests, rows_requests); - return E('div', { 'class': 'cbi-map', 'id': 'map' }, [ + const page = E('div', { 'class': 'cbi-map', 'id': 'map' }, [ E('div', { 'class': 'cbi-section' }, [ E('p', _('This tab shows the last generated DNS Report, press the \'Refresh\' button to get a current one.')), E('p', '\xa0'), @@ -387,13 +387,9 @@ return view.extend({ E('button', { 'class': 'btn cbi-button cbi-button-apply', 'style': 'float:none;margin-right:.4em;', + 'id': 'btnMap', + 'disabled': 'disabled', 'click': ui.createHandlerFn(this, function () { - if (uci.get('adblock', 'global', 'adb_map') !== '1') { - if (!notMsg) { - notMsg = true; - return ui.addNotification(null, E('p', _('GeoIP Map is not enabled!')), 'info'); - } - } if (content[1] && content[1].length > 1) { sessionStorage.setItem('mapData', JSON.stringify(content[1])); return handleAction('map'); @@ -420,9 +416,15 @@ return view.extend({ return handleAction('refresh'); }) }, [_('Refresh...')]) - ]), - + ]) ]); + if (uci.get('adblock', 'global', 'adb_map') === '1') { + const btn = page.querySelector('#btnMap'); + if (btn) { + btn.removeAttribute('disabled'); + } + } + return page; }, handleSaveApply: null, handleSave: null, diff --git a/applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/map.html b/applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/map.html index ad0f5821b4..d1cb61c1bd 100644 --- a/applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/map.html +++ b/applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/map.html @@ -33,7 +33,7 @@ /* intialize map */ let map = L.map('map', { - zoom: 4, + zoom: 3, minZoom: 2, maxZoom: 18, center: [50, 10] -- 2.30.2