diff --git a/src/css/popup.css b/src/css/popup.css index fb88e334d..e926a762e 100644 --- a/src/css/popup.css +++ b/src/css/popup.css @@ -338,22 +338,26 @@ body.dirty #refresh:hover { visibility: hidden; } -#saveRules { +#saveflushButtonGroup { + display: none; + position: fixed; +} +#saveRules, +#flushRules { opacity: 0.7; background-color: #444; border-radius: 4px; color: rgb(255, 213, 123); cursor: pointer; - display: none; font-size: 35px; height: 35px; padding: 8px; - position: fixed; text-align: center; } -#firewallContainer.dirty ~ #saveRules { +#firewallContainer.dirty ~ #saveflushButtonGroup { display: block; } -#firewallContainer.dirty ~ #saveRules:hover { +#firewallContainer.dirty ~ #saveRules:hover, +#firewallContainer.dirty ~ #flushRules:hover { opacity: 1; } diff --git a/src/img/icons.svg b/src/img/icons.svg index c0c71abb5..c1f2fa7d3 100755 --- a/src/img/icons.svg +++ b/src/img/icons.svg @@ -4,6 +4,10 @@ lock + + trash + + power diff --git a/src/js/messaging.js b/src/js/messaging.js index 595e8e5b2..5bfb82f7a 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -329,6 +329,14 @@ var onMessage = function(request, sender, callback) { µb.savePermanentFirewallRules(); break; + case 'flushFirewallRules': + µb.sessionFirewall.copyRules( + µb.permanentFirewall, + request.srcHostname, + request.desHostnames + ); + break; + case 'toggleFirewallRule': µb.toggleFirewallRule(request); response = getStats(request.tabId); diff --git a/src/js/popup.js b/src/js/popup.js index fef1f2f6e..46300e92b 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -47,7 +47,7 @@ document.getElementById('dfPane').style.setProperty( // The padlock must be manually positioned: // - It's vertical position depends on the height on the title bar. -document.getElementById('saveRules').style.setProperty( +document.getElementById('saveflushButtonGroup').style.setProperty( 'top', (document.getElementById('gotoPrefs').getBoundingClientRect().bottom + 4) + 'px' ); @@ -325,7 +325,7 @@ var buildAllFirewallRows = function() { // - Its horizontal position depends on whether there is a vertical // scrollbar. var rect = document.getElementById('firewallContainer').getBoundingClientRect(); - document.getElementById('saveRules').style.setProperty('left', (rect.left + 4) + 'px'); + document.getElementById('saveflushButtonGroup').style.setProperty('left', (rect.left + 4) + 'px'); updateAllFirewallCells(); }; @@ -651,6 +651,17 @@ var saveFirewallRules = function() { /******************************************************************************/ +var flushFirewallRules = function() { + messager.send({ + what: 'flushFirewallRules', + srcHostname: popupData.pageHostname, + desHostnames: popupData.hostnameDict + }); + popupData.contentLastModified = -1; + uDom('#firewallContainer').removeClass('dirty'); +}; + +/******************************************************************************/ // Poll for changes. // // I couldn't find a better way to be notified of changes which can affect @@ -734,6 +745,7 @@ uDom.onLoad(function () { uDom('h2').on('click', toggleFirewallPane); uDom('#refresh').on('click', reloadTab); uDom('#saveRules').on('click', saveFirewallRules); + uDom('#flushRules').on('click', flushFirewallRules); uDom('[data-i18n="popupAnyRulePrompt"]').on('click', toggleMinimize); }); diff --git a/src/popup.html b/src/popup.html index cc36e5ca4..f563c6920 100644 --- a/src/popup.html +++ b/src/popup.html @@ -35,7 +35,11 @@
-
+ +
+
+
+