Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
@janodvarko janodvarko authored
View
2  extension/content/firebug/css/cssPanel.js
@@ -1244,6 +1244,7 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
command: Obj.bindFixed(this.deletePropertyRow, this, propRow)
},
{
+ id: "fbDisableCSSProp",
label: Locale.$STRF("DisableProp", [propName]),
tooltiptext: Locale.$STRF("css.tip.Disable_Prop", [propName]),
nol10n: true,
@@ -1271,6 +1272,7 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
items.push(
"-",
{
+ id: "fbRefresh",
label: "Refresh",
command: Obj.bind(this.refresh, this),
tooltiptext: "panel.tip.Refresh"
View
48 extension/content/firebug/css/selectorPanel.js
@@ -7,9 +7,10 @@ define([
"firebug/lib/events",
"firebug/lib/dom",
"firebug/lib/domplate",
+ "firebug/chrome/menu",
"firebug/css/selectorEditor",
],
-function(Firebug, Obj, Locale, Events, Dom, Domplate, SelectorEditor) {
+function(Firebug, Obj, Locale, Events, Dom, Domplate, Menu, SelectorEditor) {
with (Domplate) {
// ********************************************************************************************* //
@@ -42,6 +43,15 @@ SelectorPanel.prototype = Obj.extend(Firebug.Panel,
initialize: function(context, doc)
{
Firebug.Panel.initialize.apply(this, arguments);
+
+ Firebug.registerUIListener(this);
+ },
+
+ shutdown: function(context, doc)
+ {
+ Firebug.Panel.shutdown.apply(this, arguments);
+
+ Firebug.unregisterUIListener(this);
},
initializeNode: function(oldPanelNode)
@@ -95,6 +105,42 @@ SelectorPanel.prototype = Obj.extend(Firebug.Panel,
},
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Context Menu
+
+ onContextMenu: function(items, object, target, context, panel, popup)
+ {
+ if (panel.name != "stylesheet")
+ return;
+
+ var cssRule = Dom.getAncestorByClass(target, "cssRule");
+ if (!cssRule)
+ return;
+
+ var rule = cssRule.repObject;
+ if (!rule)
+ return;
+
+ var item = {
+ id: "fbGetMatchingElements",
+ nol10n: true,
+ label: Locale.$STR("css.selector.cmd.getMatchingElements"),
+ command: Obj.bindFixed(this.getMatchingElements, this, rule)
+ };
+
+ var refreshMenuItem = popup.querySelector("#fbRefresh");
+ Menu.createMenuItem(popup, item, refreshMenuItem);
+
+ return [];
+ },
+
+ getMatchingElements: function(rule)
+ {
+ this.trialSelector = rule.selectorText;
+ this.selection = rule;
+ this.rebuild();
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Selection
setSelection: function(event)
View
11 extension/locale/en-US/firebug.properties
@@ -1670,10 +1670,19 @@ console.cmd.helpUrlNotAvailable=Help page for this command is not available.
css.selector.noSelection=Hover CSS rules to preview, click to select one.
css.selector.noSelectionResults=No matching elements
css.selector.selectorError=Selection failed:
-css.selector.Selection=Selection
+
+# LOCALIZATION NOTE (css.selector.Selection): Title for Selector side panel displayed
+# in the CSS panel.
+css.selector.Selection=Elements
+
panel.tip.selector=Displays elements matching a CSS selector
css.selector.TryASelector=Try a selector...
+# LOCALIZATION NOTE (css.selector.cmd.getMatchingElements): A label for context menu item.
+# The menu-item is used in the CSS panel's context menu and allows to get matched elements
+# for the clicked rule selector. Elements are displayed in the side panel.
+css.selector.cmd.getMatchingElements=Get Matching Elements
+
# LOCALIZATION NOTE (css.selector.unknownErrorMessage): An error message displayed
# to the user if querySelectorAll (used by the Selector side panel) fails and there is no
# explanantion coming from the platform.
Please sign in to comment.
Something went wrong with that request. Please try again.