[Pkg-mozext-commits] [requestpolicy] 05/100: Add toggle to highlight rule rows based on type

David Prévot taffit at moszumanska.debian.org
Fri Dec 12 22:56:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit b0586061c656d885de87800bee2db0e40447a4f7
Author: Christopher Bura <christopher.bura at gmail.com>
Date:   Mon Sep 1 04:08:42 2014 -0400

    Add toggle to highlight rule rows based on type
---
 src/content/settings/settings.css    | 19 ++++++++++++++++++-
 src/content/settings/yourpolicy.html |  9 ++++++++-
 src/content/settings/yourpolicy.js   | 15 +++++++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/src/content/settings/settings.css b/src/content/settings/settings.css
index 6148b8e..89b25cd 100644
--- a/src/content/settings/settings.css
+++ b/src/content/settings/settings.css
@@ -264,4 +264,21 @@ table.policy tr:hover a.deleterule:hover {
 
 #subscriptionschanged {
   margin-top: 20px;
-}
\ No newline at end of file
+}
+
+/* yourpolicy.html */
+
+.policy-table-options {
+  padding: 10px;
+  color: #A6B2A9;
+}
+
+.allow.highlight {
+  background-color: #CCE6C2;
+  color: #007F00;
+}
+
+.block.highlight {
+  background-color: #EBCCCC;
+  color: #7F0000;
+}
diff --git a/src/content/settings/yourpolicy.html b/src/content/settings/yourpolicy.html
index 055a40e..af3c531 100644
--- a/src/content/settings/yourpolicy.html
+++ b/src/content/settings/yourpolicy.html
@@ -67,6 +67,13 @@
         </div>
       </div>
 
+      <div class="policy-table-options">
+        <form>
+          <label for="highlight_rows">Highlight Rule Types</label>
+          <input type="checkbox" id="highlight_rows">
+        </form>
+      </div>
+
       <style>
         #addrule {
           margin-top: 20px;
@@ -132,4 +139,4 @@
 </table>
 
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/src/content/settings/yourpolicy.js b/src/content/settings/yourpolicy.js
index e9e7564..c53c118 100644
--- a/src/content/settings/yourpolicy.js
+++ b/src/content/settings/yourpolicy.js
@@ -23,6 +23,18 @@ $(function () {
   $('[name=desthost]').prop('placeholder', _('host'));
   $('[name=originport]').prop('placeholder', _('port'));
   $('[name=destport]').prop('placeholder', _('port'));
+
+  var rows_highlighted = false;
+
+  $('#highlight_rows').change(function () {
+    rows_highlighted = !rows_highlighted;
+    if (rows_highlighted) {
+      $('#policy-user tr').addClass('highlight');
+    } else {
+      $('#policy-user tr').removeClass('highlight');
+    }
+  });
+
 });
 
 const SEARCH_DELAY = 500;
@@ -89,6 +101,9 @@ function addPolicyTableRow(table, type, origin, dest, ruleData) {
   var rowCount = table.rows.length;
   var row = table.insertRow(rowCount);
 
+  var type_class = type == 'allow' ? 'allow' : 'block';
+  row.setAttribute('class', type_class);
+
   var typeCell = row.insertCell(0);
   typeCell.textContent = type == 'allow' ? 'Allow' : 'Block';
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list