[Pkg-mozext-commits] [requestpolicy] 16/100: adapt table in oldrules.html to yourpolicy.html

David Prévot taffit at moszumanska.debian.org
Fri Dec 12 22:56:48 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 7f64ba2788a308290e6eb95f33e5dfd16d52c033
Author: myrdd <myrdd at users.noreply.github.com>
Date:   Fri Sep 12 15:15:30 2014 +0200

    adapt table in oldrules.html to yourpolicy.html
    
    see https://github.com/RequestPolicyContinued/requestpolicy/pull/459#issuecomment-55280969
---
 src/content/settings/oldrules.html | 29 +++++++++++------------------
 src/content/settings/oldrules.js   | 26 ++++++++++----------------
 2 files changed, 21 insertions(+), 34 deletions(-)

diff --git a/src/content/settings/oldrules.html b/src/content/settings/oldrules.html
index b59bfed..3994052 100644
--- a/src/content/settings/oldrules.html
+++ b/src/content/settings/oldrules.html
@@ -80,27 +80,20 @@
           <div id="reimportOldRules">
 
             <div id="policy">
-              <div class="policyheader">
-                <table class="policy">
-                  <colgroup>
-                    <col class="type"/>
-                    <col class="origin"/>
-                    <col class="destination"/>
-                  </colgroup>
-                  <tr>
-                    <th data-string="type"></th>
-                    <th data-string="origin"></th>
-                    <th data-string="destination"></th>
-                  </tr>
-                </table>
-              </div>
               <div class="policydata">
-                <table id="policy-user" class="policy">
+                <table id="policy-user">
                   <colgroup>
-                    <col class="type"/>
-                    <col class="origin"/>
-                    <col class="destination"/>
+                    <col class="type">
+                    <col class="origin">
+                    <col class="destination">
                   </colgroup>
+                  <thead>
+                    <tr>
+                      <th data-string="policy"></th>
+                      <th data-string="origin"></th>
+                      <th data-string="destination"></th>
+                    </tr>
+                  </thead>
                   <tbody id="rules"></tbody>
                 </table>
               </div>
diff --git a/src/content/settings/oldrules.js b/src/content/settings/oldrules.js
index ad1ecc4..6c71323 100644
--- a/src/content/settings/oldrules.js
+++ b/src/content/settings/oldrules.js
@@ -18,7 +18,7 @@ var addHostWildcard = true;
 
 
 function clearPolicyTable() {
-  var table = document.getElementById('policy-user');
+  var table = document.getElementById('rules');
   var children = table.getElementsByTagName('tr');
   while (children.length) {
     var child = children.item(0);
@@ -27,7 +27,7 @@ function clearPolicyTable() {
 }
 
 function populateRuleTable() {
-  var table = document.getElementById('policy-user');
+  var table = document.getElementById('rules');
   // Setting the global rules var here.
   rules = common.getOldRulesAsNewRules(addHostWildcard);
 
@@ -40,22 +40,16 @@ function populateRuleTable() {
 }
 
 function addPolicyTableRow(table, type, origin, dest, ruleData) {
-  var rowCount = table.rows.length;
-  var row = table.insertRow(rowCount);
+  var typeClass = type == 'allow' ? 'allow' : 'block';
+  var ruleType = type == 'allow' ? _('allow') : _('block');
 
-  var typeCell = row.insertCell(0);
-  typeCell.textContent = type == 'allow' ? 'Allow' : 'Block';
+  var row = $('<tr>').addClass(typeClass).appendTo(table);
 
-  var originCell = row.insertCell(1);
-  originCell.textContent = origin;
-
-  var destCell = row.insertCell(2);
-  destCell.textContent = dest;
-
-  var destCell = row.insertCell(3);
-  var anchor = document.createElement('a');
-  anchor.appendChild(document.createTextNode(''));
-  destCell.appendChild(anchor);
+  row.append(
+    $('<td>').text(ruleType),
+    $('<td>').text(origin),
+    $('<td>').text(dest)
+  );
 }
 
 // TODO: remove code duplication with menu.js

-- 
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