[Pkg-mozext-commits] [requestpolicy] 54/280: [refact] requestLog: code style changes

David Prévot taffit at moszumanska.debian.org
Sat May 2 20:29:59 UTC 2015


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

taffit pushed a commit to branch master
in repository requestpolicy.

commit b53b71cc206216c006be1e9303ca59ccbbd7356b
Author: Martin Kimmerle <dev at 256k.de>
Date:   Sun Dec 7 14:57:15 2014 +0100

    [refact] requestLog: code style changes
---
 src/content/ui/request-log.js  | 101 ++++++++++++++++++++---------------------
 src/content/ui/request-log.xul |  18 ++++++--
 2 files changed, 62 insertions(+), 57 deletions(-)

diff --git a/src/content/ui/request-log.js b/src/content/ui/request-log.js
index 3818911..ebf9cf9 100644
--- a/src/content/ui/request-log.js
+++ b/src/content/ui/request-log.js
@@ -22,7 +22,7 @@
  */
 
 
-window.requestpolicy.requestLog = (function () {
+window.requestpolicy.requestLog = (function (self) {
 
   const Ci = Components.interfaces;
   const Cc = Components.classes;
@@ -43,66 +43,63 @@ window.requestpolicy.requestLog = (function () {
   let tree = null;
 
 
-  let self = {
 
-    init: function() {
-      if (initialized) {
-        return;
-      }
-      initialized = true;
-
-      tree = document.getElementById("requestpolicy-requestLog-tree");
-      tree.view = window.requestpolicy.requestLogTreeView;
-
-      // Give the requestpolicyOverlay direct access to the tree view.
-      window.parent.requestpolicy.overlay.requestLogTreeView = window.requestpolicy.requestLogTreeView;
-    },
-
-    /**
-     * Copy the content of a cell to the clipboard. The row used will be the one
-     * selected when the context menu was opened.
-     */
-    copyToClipboard: function(columnName) {
-      var content = tree.view.getCellText(tree.currentIndex,
-          tree.columns.getNamedColumn(columnName));
-
-      const clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
-          .getService(Components.interfaces.nsIClipboardHelper);
-      clipboardHelper.copyString(content);
-    },
-
-    /**
-     * Open the content of a cell in a new tab. The row used will be the one
-     * selected when the context menu was opened.
-     */
-    openInNewTab: function(columnName) {
-      var content = tree.view.getCellText(tree.currentIndex,
-          tree.columns.getNamedColumn(columnName));
-
-      var forbidden = true;
-      try {
-        var uri = DomainUtil.getUriObject(content);
-        if (uri.scheme == 'http' || uri.scheme == 'https' || uri.scheme == 'ftp') {
-          forbidden = false;
-        }
-      } catch (e) {
-      }
+  self.init = function() {
+    if (initialized) {
+      return;
+    }
+    initialized = true;
 
-      if (forbidden) {
-        var alertTitle = StringUtils.strbundle.GetStringFromName("actionForbidden");
-        var alertText = StringUtils.strbundle
-            .GetStringFromName("urlCanOnlyBeCopiedToClipboard");
-        Services.prompt.alert(null, alertTitle, alertText);
-        return;
+    tree = document.getElementById("requestpolicy-requestLog-tree");
+    tree.view = window.requestpolicy.requestLogTreeView;
+
+    // Give the requestpolicyOverlay direct access to the tree view.
+    window.parent.requestpolicy.overlay.requestLogTreeView = window.requestpolicy.requestLogTreeView;
+  };
+
+  /**
+   * Copy the content of a cell to the clipboard. The row used will be the one
+   * selected when the context menu was opened.
+   */
+  self.copyToClipboard = function(columnName) {
+    var content = tree.view.getCellText(tree.currentIndex,
+        tree.columns.getNamedColumn(columnName));
+
+    const clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
+        .getService(Components.interfaces.nsIClipboardHelper);
+    clipboardHelper.copyString(content);
+  };
+
+  /**
+   * Open the content of a cell in a new tab. The row used will be the one
+   * selected when the context menu was opened.
+   */
+  self.openInNewTab = function(columnName) {
+    var content = tree.view.getCellText(tree.currentIndex,
+        tree.columns.getNamedColumn(columnName));
+
+    var forbidden = true;
+    try {
+      var uri = DomainUtil.getUriObject(content);
+      if (uri.scheme == 'http' || uri.scheme == 'https' || uri.scheme == 'ftp') {
+        forbidden = false;
       }
+    } catch (e) {
+    }
 
-      Utils.getChromeWindow(window).gBrowser.addTab(content);
+    if (forbidden) {
+      var alertTitle = StringUtils.strbundle.GetStringFromName("actionForbidden");
+      var alertText = StringUtils.strbundle
+          .GetStringFromName("urlCanOnlyBeCopiedToClipboard");
+      Services.prompt.alert(null, alertTitle, alertText);
+      return;
     }
 
+    Utils.getChromeWindow(window).gBrowser.addTab(content);
   };
 
   return self;
-}());
+}(window.requestpolicy.requestLog || {}));
 
 addEventListener("load", function(event) {
     window.requestpolicy.requestLog.init(event);
diff --git a/src/content/ui/request-log.xul b/src/content/ui/request-log.xul
index 586018d..a07c6eb 100644
--- a/src/content/ui/request-log.xul
+++ b/src/content/ui/request-log.xul
@@ -52,15 +52,23 @@
     </menupopup>
   </popupset>
 
-  <tree id="requestpolicy-requestLog-tree" flex="1" flags="dont-build-content" seltype="single" context="requestpolicyRequestLogContext">
+  <tree id="requestpolicy-requestLog-tree" flex="1" flags="dont-build-content"
+        seltype="single" context="requestpolicyRequestLogContext">
     <treecols>
-      <treecol id="requestpolicy-requestLog-origin" label="&rp.requestLog.origin;" flex="1" crop="center" persist="width ordinal hidden"/>
+      <treecol id="requestpolicy-requestLog-origin"
+               label="&rp.requestLog.origin;" flex="1" crop="center"
+               persist="width ordinal hidden"/>
       <splitter class="tree-splitter"/>
-      <treecol id="requestpolicy-requestLog-destination" label="&rp.requestLog.destination;" flex="1" crop="center" persist="width ordinal hidden"/>
+      <treecol id="requestpolicy-requestLog-destination"
+               label="&rp.requestLog.destination;" flex="1" crop="center"
+               persist="width ordinal hidden"/>
       <splitter class="tree-splitter"/>
-      <treecol id="requestpolicy-requestLog-blocked" label="&rp.requestLog.blocked;" width="80" persist="width ordinal hidden"/>
+      <treecol id="requestpolicy-requestLog-blocked"
+               label="&rp.requestLog.blocked;" width="80"
+               persist="width ordinal hidden"/>
       <splitter class="tree-splitter"/>
-      <treecol id="requestpolicy-requestLog-time" label="&rp.requestLog.time;" width="120" persist="width ordinal hidden"/>
+      <treecol id="requestpolicy-requestLog-time" label="&rp.requestLog.time;"
+               width="120" persist="width ordinal hidden"/>
     </treecols>
 
     <treechildren/>

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