Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

New Get Matching Elemens context menu item for CSS panel context menu…

… + Rename Selection side panel to Elements
  • Loading branch information...
commit 989de4008a6f176704edd017eec34b0773f9d68f 1 parent af3202a
Jan Odvarko authored
2  extension/content/firebug/css/cssPanel.js
@@ -1244,6 +1244,7 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
1244 1244
                             command: Obj.bindFixed(this.deletePropertyRow, this, propRow)
1245 1245
                         },
1246 1246
                         {
  1247
+                            id: "fbDisableCSSProp",
1247 1248
                             label: Locale.$STRF("DisableProp", [propName]),
1248 1249
                             tooltiptext: Locale.$STRF("css.tip.Disable_Prop", [propName]),
1249 1250
                             nol10n: true,
@@ -1271,6 +1272,7 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
1271 1272
         items.push(
1272 1273
             "-",
1273 1274
             {
  1275
+                id: "fbRefresh",
1274 1276
                 label: "Refresh",
1275 1277
                 command: Obj.bind(this.refresh, this),
1276 1278
                 tooltiptext: "panel.tip.Refresh"
48  extension/content/firebug/css/selectorPanel.js
@@ -7,9 +7,10 @@ define([
7 7
     "firebug/lib/events",
8 8
     "firebug/lib/dom",
9 9
     "firebug/lib/domplate",
  10
+    "firebug/chrome/menu",
10 11
     "firebug/css/selectorEditor",
11 12
 ],
12  
-function(Firebug, Obj, Locale, Events, Dom, Domplate, SelectorEditor) {
  13
+function(Firebug, Obj, Locale, Events, Dom, Domplate, Menu, SelectorEditor) {
13 14
 with (Domplate) {
14 15
 
15 16
 // ********************************************************************************************* //
@@ -42,6 +43,15 @@ SelectorPanel.prototype = Obj.extend(Firebug.Panel,
42 43
     initialize: function(context, doc)
43 44
     {
44 45
         Firebug.Panel.initialize.apply(this, arguments);
  46
+
  47
+        Firebug.registerUIListener(this);
  48
+    },
  49
+
  50
+    shutdown: function(context, doc)
  51
+    {
  52
+        Firebug.Panel.shutdown.apply(this, arguments);
  53
+
  54
+        Firebug.unregisterUIListener(this);
45 55
     },
46 56
 
47 57
     initializeNode: function(oldPanelNode)
@@ -95,6 +105,42 @@ SelectorPanel.prototype = Obj.extend(Firebug.Panel,
95 105
     },
96 106
 
97 107
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  108
+    // Context Menu
  109
+
  110
+    onContextMenu: function(items, object, target, context, panel, popup)
  111
+    {
  112
+        if (panel.name != "stylesheet")
  113
+            return;
  114
+
  115
+        var cssRule = Dom.getAncestorByClass(target, "cssRule");
  116
+        if (!cssRule)
  117
+            return;
  118
+
  119
+        var rule = cssRule.repObject;
  120
+        if (!rule)
  121
+            return;
  122
+
  123
+        var item = {
  124
+           id: "fbGetMatchingElements",
  125
+           nol10n: true,
  126
+           label: Locale.$STR("css.selector.cmd.getMatchingElements"),
  127
+           command: Obj.bindFixed(this.getMatchingElements, this, rule)
  128
+        };
  129
+
  130
+        var refreshMenuItem = popup.querySelector("#fbRefresh");
  131
+        Menu.createMenuItem(popup, item, refreshMenuItem);
  132
+
  133
+        return [];
  134
+    },
  135
+
  136
+    getMatchingElements: function(rule)
  137
+    {
  138
+        this.trialSelector = rule.selectorText;
  139
+        this.selection = rule;
  140
+        this.rebuild();
  141
+    },
  142
+
  143
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 144
     // Selection
99 145
 
100 146
     setSelection: function(event)
11  extension/locale/en-US/firebug.properties
@@ -1670,10 +1670,19 @@ console.cmd.helpUrlNotAvailable=Help page for this command is not available.
1670 1670
 css.selector.noSelection=Hover CSS rules to preview, click to select one.
1671 1671
 css.selector.noSelectionResults=No matching elements
1672 1672
 css.selector.selectorError=Selection failed:
1673  
-css.selector.Selection=Selection
  1673
+
  1674
+# LOCALIZATION NOTE (css.selector.Selection): Title for Selector side panel displayed
  1675
+# in the CSS panel.
  1676
+css.selector.Selection=Elements
  1677
+
1674 1678
 panel.tip.selector=Displays elements matching a CSS selector
1675 1679
 css.selector.TryASelector=Try a selector...
1676 1680
 
  1681
+# LOCALIZATION NOTE (css.selector.cmd.getMatchingElements): A label for context menu item.
  1682
+# The menu-item is used in the CSS panel's context menu and allows to get matched elements
  1683
+# for the clicked rule selector. Elements are displayed in the side panel.
  1684
+css.selector.cmd.getMatchingElements=Get Matching Elements
  1685
+
1677 1686
 # LOCALIZATION NOTE (css.selector.unknownErrorMessage): An error message displayed
1678 1687
 # to the user if querySelectorAll (used by the Selector side panel) fails and there is no
1679 1688
 # explanantion coming from the platform.

0 notes on commit 989de40

Please sign in to comment.
Something went wrong with that request. Please try again.