[Pkg-mozext-commits] [firebug] 72/82: Initial imlementation for Issue 6200: add FireClosure syntax in the help command
David Prévot
taffit at moszumanska.debian.org
Mon Mar 31 22:45:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag fbtest-1.11.2
in repository firebug.
commit de69745778441e6f2632207d12af2d586e16b9c4
Author: Jan Odvarko <odvarko at gmail.com>
Date: Thu Jan 24 13:22:19 2013 +0100
Initial imlementation for Issue 6200: add FireClosure syntax in the help command
---
.../content/firebug/console/commandLineHelp.js | 79 +++++++++++++++++++++-
extension/locale/en-US/firebug.properties | 14 +++-
extension/skin/classic/console.css | 11 ++-
3 files changed, 100 insertions(+), 4 deletions(-)
diff --git a/extension/content/firebug/console/commandLineHelp.js b/extension/content/firebug/console/commandLineHelp.js
index eb12ce5..8f8d982 100644
--- a/extension/content/firebug/console/commandLineHelp.js
+++ b/extension/content/firebug/console/commandLineHelp.js
@@ -26,7 +26,7 @@ var CMD_TYPE_PROPERTY = 3;
const prompts = Xpcom.CCSV("@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService");
// ********************************************************************************************* //
-// Domplates
+// Command Line Help
var HelpCaption = domplate(
{
@@ -128,12 +128,64 @@ var HelpEntry = domplate(
});
// ********************************************************************************************* //
+// Command Line Tips
+
+var TipsCaption = domplate(
+{
+ tag:
+ SPAN({"class": "helpTitle"},
+ SPAN({"class": "helpCaption"},
+ Locale.$STR("console.cmd.tip_title")
+ ),
+ SPAN({"class": "helpCaptionDesc"},
+ Locale.$STR("console.cmd.tip_title_desc")
+ )
+ )
+});
+
+var TipsList = domplate(
+{
+ tag:
+ DIV({"class": "tipsContent"},
+ UL({"class": "tipsList"})
+ )
+});
+
+var Tip = domplate(
+{
+ tag:
+ FOR("tip", "$tips",
+ LI({"class": "tip"},
+ SPAN("$tip|getText"),
+ SPAN(" "),
+ SPAN({"class": "example"},"$tip|getExample")
+ )
+ ),
+
+ getText: function(object)
+ {
+ return object.nol10n ? object.text : Locale.$STR(object.text);
+ },
+
+ getExample: function(object)
+ {
+ return object.nol10n ? object.example : Locale.$STR(object.example);
+ }
+});
+
+// ********************************************************************************************* //
// Help Object
var CommandLineHelp = domplate(
{
render: function(context)
{
+ this.renderHelp(context);
+ this.renderTips(context);
+ },
+
+ renderHelp: function(context)
+ {
var row = Firebug.Console.openGroup("help", context, "help",
HelpCaption, true, null, true);
Firebug.Console.closeGroup(context, true);
@@ -196,8 +248,31 @@ var CommandLineHelp = domplate(
// Generate table
HelpEntry.tag.insertRows({commands: commands}, tBody);
+ },
+
+ renderTips: function(context)
+ {
+ var row = Firebug.Console.openGroup("help", context, "help",
+ TipsCaption, true, null, true);
+ Firebug.Console.closeGroup(context, true);
+
+ var logGroupBody = row.lastChild;
+ var table = TipsList.tag.replace({}, logGroupBody);
+ var list = table.lastChild;
+
+ var tips = [];
+
+ tips.push({
+ example: "1 + 1",
+ text: "console.cmd.tip.javascript"
+ });
+
+ tips.push({
+ example: "object.%closureVarName",
+ text: "console.cmd.tip.closures"
+ });
- return row;
+ Tip.tag.append({tips: tips}, list);
}
});
diff --git a/extension/locale/en-US/firebug.properties b/extension/locale/en-US/firebug.properties
index 447856f..fba6946 100644
--- a/extension/locale/en-US/firebug.properties
+++ b/extension/locale/en-US/firebug.properties
@@ -1550,9 +1550,21 @@ console.msg.an_empty_string=(an empty string)
cookies.legacy.firecookie_detected=Firecookie add-on is detected. This add-on has been integrated with Firebug 1.10 by default. To avoid a collision you need to uninstall Firecookie. \n\nYou must restart to finish uninstalling the add-on.
cookies.legacy.uninstall=Uninstall
cookies.legacy.uninstall_and_restart=Uninstall && Restart
-# LOCALIZATION NOTE (firebug.cmd.help.values, console.cmd.help_title_desc):
+
+# LOCALIZATION NOTE (console.cmd.help_title, console.cmd.help_title_desc):
console.cmd.help_title=Command Line API
console.cmd.help_title_desc=Press F1 to open online Firebug help
+
+# LOCALIZATION NOTE (console.cmd.tip_title, console.cmd.tip_title_desc):
+console.cmd.tip_title=Command Line Tips
+console.cmd.tip_title_desc=Learn Command Line Tips & Tricks
+
+# LOCALIZATION NOTE (console.cmd.tip.javascript, console.cmd.tip.closures):
+# Description for Command Line tips that is logged
+# in the the Console panel if the user types "help" into the command line.
+console.cmd.tip.javascript=Any valid JavaScript expression can be executed on the Command Line. Example:
+console.cmd.tip.closures=In order to access variables in closures use '.%' syntax. Example:
+
# LOCALIZATION NOTE (console.cmd.help.$): Description for Command Line API that is logged
# in the the Console panel if the user types "help" into the command line.
console.cmd.help.$=Returns a single element with the given id.
diff --git a/extension/skin/classic/console.css b/extension/skin/classic/console.css
index e713648..490eb94 100644
--- a/extension/skin/classic/console.css
+++ b/extension/skin/classic/console.css
@@ -443,7 +443,16 @@
}
.logRow-help .commandDesc {
- color: gray
+ color: gray;
+}
+
+.logRow-help .tipsContent .tip {
+ margin-bottom: 5px;
+}
+
+.logRow-help .tipsContent .tip .example {
+ color: green;
+ font-family: monospace;
}
/*************************************************************************************************/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git
More information about the Pkg-mozext-commits
mailing list