- commit
- 4737705ee614e5c171ceb328a3912ed772e3bc68
- parent
- ee274ff052b9333f961dcc98a9a372dbeac1476c
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-07-30 18:18
restrict updateInherit to type
Diffstat
| M | popup.js | 12 | ++++++++---- |
1 files changed, 8 insertions, 4 deletions
diff --git a/popup.js b/popup.js
@@ -39,8 +39,12 @@ var getHostnames = function(data) {
39 39 };
40 40
41 41 sendMessage('get').then(data => {
42 -1 var updateInherit = function() {
43 -1 table.querySelectorAll('input').forEach(input => {
-1 42 var updateInherit = function(type) {
-1 43 var selector = 'input';
-1 44 if (type !== '*') {
-1 45 selector += `[data-type="${type}"]`;
-1 46 }
-1 47 table.querySelectorAll(selector).forEach(input => {
44 48 input.classList.toggle('inherit-allow', shouldAllow(
45 49 data.rules,
46 50 data.context,
@@ -61,7 +65,7 @@ sendMessage('get').then(data => {
61 65 hostname, type, input.checked
62 66 ]).then(rules => {
63 67 data.rules = rules;
64 -1 updateInherit();
-1 68 updateInherit(type);
65 69 });
66 70 };
67 71 return input;
@@ -127,5 +131,5 @@ sendMessage('get').then(data => {
127 131 table.append(createRow(hostname, data.rules[data.context] || {}));
128 132 }
129 133
130 -1 updateInherit();
-1 134 updateInherit('*');
131 135 });