Permalink
Browse files

Merge branch 'master' of github.com:firebug/firebug

  • Loading branch information...
2 parents 7c67ae6 + b2c9f4d commit 4cabe939be9c6e4585be9c413f0691c67d580097 @janodvarko janodvarko committed Oct 5, 2012
@@ -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"
@@ -43,7 +43,7 @@ SelectorEditor.prototype = domplate(Firebug.InlineEditor.prototype,
endEditing: function(target, value, cancel)
{
- if (cancel || value == "")
+ if (cancel)
return;
this.panel.setTrialSelector(target, value);
@@ -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)
@@ -53,17 +63,18 @@ SelectorPanel.prototype = Obj.extend(Firebug.Panel,
this.lockSelection = Obj.bind(this.lockSelection, this);
var panelNode = this.mainPanel.panelNode;
- Events.addEventListener(panelNode, "mouseover", this.setSelection, false);
- Events.addEventListener(panelNode, "mouseout", this.clearSelection, false);
- Events.addEventListener(panelNode, "mousedown", this.lockSelection, false);
+ // See: http://code.google.com/p/fbug/issues/detail?id=5931
+ //Events.addEventListener(panelNode, "mouseover", this.setSelection, false);
+ //Events.addEventListener(panelNode, "mouseout", this.clearSelection, false);
+ //Events.addEventListener(panelNode, "mousedown", this.lockSelection, false);
},
destroyNode: function()
{
var panelNode = this.mainPanel.panelNode;
- Events.removeEventListener(panelNode, "mouseover", this.setSelection, false);
- Events.removeEventListener(panelNode, "mouseout", this.clearSelection, false);
- Events.removeEventListener(panelNode, "mousedown", this.lockSelection, false);
+ //Events.removeEventListener(panelNode, "mouseover", this.setSelection, false);
+ //Events.removeEventListener(panelNode, "mouseout", this.clearSelection, false);
+ //Events.removeEventListener(panelNode, "mousedown", this.lockSelection, false);
Firebug.Panel.destroyNode.apply(this, arguments);
},
@@ -94,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)
@@ -1667,17 +1667,28 @@ console.cmd.help.help=Displays help for all available commands.
# List of command names is displayed if you type "help" (without quotes) into the command line.
console.cmd.helpUrlNotAvailable=Help page for this command is not available.
-css.selector.noSelection=Hover CSS rules to preview, click to select one.
+# LOCALIZATION NOTE (css.selector.noSelection): A help description used in empty
+# Selection side panel.
+css.selector.noSelection=Type custom selector or right click CSS rule and pick <b>Get Matching Elements</b>.
+
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
# LOCALIZATION NOTE (panel.tip.selector): Tooltip text for the Selection side panel
# Shown when hovering the Selection panel tab
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.

0 comments on commit 4cabe93

Please sign in to comment.