diff moztree.js @ 16:5209578ac8a7

shift-clicking on a dir name opens the HG browser in that window.
author Atul Varma <varmaa@toolness.com>
date Sun, 13 Dec 2009 09:46:57 -0800
parents 75d0099bff9e
children 08af758510cf
line wrap: on
line diff
--- a/moztree.js	Sun Dec 13 08:49:09 2009 -0800
+++ b/moztree.js	Sun Dec 13 09:46:57 2009 -0800
@@ -138,6 +138,7 @@
 var App = {
   tree: null,
   lastHash: null,
+  HG_URL: "http://hg.mozilla.org/mozilla-central/",
   onIdle: function onIdle() {
     if (window.location.hash != this.lastHash)
       this.updateTree();
@@ -175,8 +176,13 @@
     $("#tree").click(
       function(event) {
         if (event.target.moztreePath) {
-          window.location.hash = "#" + event.target.moztreePath;
-          self.updateTree();
+          if (event.shiftKey) {
+            window.open(self.HG_URL + 'file/tip/' +
+                        event.target.moztreePath);
+          } else {
+            window.location.hash = "#" + event.target.moztreePath;
+            self.updateTree();
+          }
         }
       });
     getJSON(