Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit c2a76a51f11dfbcf11a1b0b6331e3ee7f45fb569 @janodvarko janodvarko committed
Showing with 2,521 additions and 0 deletions.
  1. +7 −0 HelloAMD/chrome.manifest
  2. +54 −0 HelloAMD/chrome/content/main.js
  3. +36 −0 HelloAMD/chrome/content/mainOverlay.js
  4. +4 −0 HelloAMD/chrome/content/mainOverlay.xul
  5. +44 −0 HelloAMD/chrome/content/myModule.js
  6. +100 −0 HelloAMD/chrome/content/myPanel.js
  7. +1 −0 HelloAMD/chrome/locale/en-US/helloamd.properties
  8. +23 −0 HelloAMD/chrome/skin/classic/helloamd.css
  9. +1 −0 HelloAMD/defaults/preferences/prefs.js
  10. +24 −0 HelloAMD/install.rdf
  11. +30 −0 HelloAMD/license.txt
  12. +14 −0 HelloAMD/readme.txt
  13. +3 −0 HelloBootAMD/ant.properties
  14. +124 −0 HelloBootAMD/bootstrap.js
  15. +36 −0 HelloBootAMD/build.xml
  16. +8 −0 HelloBootAMD/chrome.manifest
  17. +52 −0 HelloBootAMD/chrome/content/main.js
  18. +39 −0 HelloBootAMD/chrome/content/mainOverlay.js
  19. +4 −0 HelloBootAMD/chrome/content/mainOverlay.xul
  20. +44 −0 HelloBootAMD/chrome/content/myModule.js
  21. +100 −0 HelloBootAMD/chrome/content/myPanel.js
  22. +1 −0 HelloBootAMD/chrome/locale/en-US/hellobootamd.properties
  23. +23 −0 HelloBootAMD/chrome/skin/classic/hellobootamd.css
  24. +1 −0 HelloBootAMD/defaults/preferences/prefs.js
  25. +26 −0 HelloBootAMD/install.rdf
  26. +30 −0 HelloBootAMD/license.txt
  27. +22 −0 HelloBootAMD/readme.txt
  28. +2 −0 HelloWorld/chrome.manifest
  29. +80 −0 HelloWorld/chrome/content/helloworld/helloWorld.js
  30. +21 −0 HelloWorld/chrome/content/helloworld/helloWorld.xul
  31. +2 −0 HelloWorld/defaults/preferences/prefs.js
  32. +24 −0 HelloWorld/install.rdf
  33. +3 −0 LinkInspector/chrome.manifest
  34. +190 −0 LinkInspector/chrome/content/inspector.js
  35. +6 −0 LinkInspector/chrome/content/inspector.xul
  36. +34 −0 LinkInspector/chrome/skin/classic/inspector.css
  37. +1 −0 LinkInspector/defaults/preferences/prefs.js
  38. +25 −0 LinkInspector/install.rdf
  39. +63 −0 SidePanel/bootstrap.js
  40. +1 −0 SidePanel/chrome.manifest
  41. +38 −0 SidePanel/chrome/content/main.js
  42. +43 −0 SidePanel/chrome/content/myNetSidePanel.js
  43. +37 −0 SidePanel/chrome/content/myPanel.js
  44. +42 −0 SidePanel/chrome/content/mySidePanel.js
  45. +23 −0 SidePanel/install.rdf
  46. +30 −0 SidePanel/license.txt
  47. +11 −0 TabularUI/.project
  48. +63 −0 TabularUI/bootstrap.js
  49. +1 −0 TabularUI/chrome.manifest
  50. +34 −0 TabularUI/chrome/content/main.js
  51. +72 −0 TabularUI/chrome/content/tabularDataPanel.js
  52. +23 −0 TabularUI/install.rdf
  53. +30 −0 TabularUI/license.txt
  54. +79 −0 Toolbar/bootstrap.js
  55. +3 −0 Toolbar/chrome.manifest
  56. +38 −0 Toolbar/chrome/content/main.js
  57. +45 −0 Toolbar/chrome/content/myListener.js
  58. +58 −0 Toolbar/chrome/content/myModule.js
  59. +63 −0 Toolbar/chrome/content/myPanel.js
  60. +5 −0 Toolbar/chrome/locale/en-US/toolbar.properties
  61. BIN Toolbar/chrome/skin/classic/button.png
  62. +23 −0 Toolbar/install.rdf
  63. +30 −0 Toolbar/license.txt
  64. +2 −0 cachelistener/chrome.manifest
  65. +103 −0 cachelistener/chrome/content/cachelistener/cacheListener.js
  66. +4 −0 cachelistener/chrome/content/cachelistener/cacheListener.xul
  67. +2 −0 cachelistener/defaults/preferences/prefs.js
  68. +24 −0 cachelistener/install.rdf
  69. +2 −0 infotip/chrome.manifest
  70. +96 −0 infotip/chrome/content/infoTip.js
  71. +5 −0 infotip/chrome/content/infoTip.xul
  72. +3 −0 infotip/defaults/preferences/prefs.js
  73. +24 −0 infotip/install.rdf
  74. +5 −0 netlistener/chrome.manifest
  75. +123 −0 netlistener/chrome/content/netlistener/netListener.js
  76. +4 −0 netlistener/chrome/content/netlistener/netListener.xul
  77. 0 netlistener/chrome/locale/en-US/netListener.properties
  78. +4 −0 netlistener/chrome/skin/classic/netListener.css
  79. +2 −0 netlistener/defaults/preferences/prefs.js
  80. +24 −0 netlistener/install.rdf
7 HelloAMD/chrome.manifest
@@ -0,0 +1,7 @@
+content helloamd chrome/content/
+skin helloamd classic/1.0 chrome/skin/classic/
+locale helloamd en-US chrome/locale/en-US/
+
+resource helloamd chrome/
+
+overlay chrome://firebug/content/firebugOverlay.xul chrome://helloamd/content/mainOverlay.xul
54 HelloAMD/chrome/content/main.js
@@ -0,0 +1,54 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/trace",
+ "firebug/trace/traceModule",
+ "firebug/trace/traceListener",
+ "helloamd/myPanel",
+ "helloamd/myModule",
+],
+function(FBTrace, TraceModule, TraceListener) {
+
+// ********************************************************************************************* //
+// Documentation
+//
+// Firebug coding style: http://getfirebug.com/wiki/index.php/Coding_Style
+// Firebug tracing: http://getfirebug.com/wiki/index.php/FBTrace
+
+// ********************************************************************************************* //
+// The application/extension object
+
+var theApp =
+{
+ initialize: function()
+ {
+ // Register trace customization listener for FBTrace. DBG_HELLOAMD represents a CSS rule
+ // that is automatially associated with all logs prefixed with "helloAMD;".
+ // The prefix is removed (third parameter is true).
+ // The last parameter represents URL of the stylesheet that should be used by
+ // the tracing console.
+ this.traceListener = new TraceListener("helloAMD;", "DBG_HELLOAMD", true,
+ "resource://helloamd/skin/classic/helloamd.css");
+ TraceModule.addListener(this.traceListener);
+
+ if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("helloAMD; HelloAMD extension initialize");
+
+ // TODO: Extension initialization
+ },
+
+ shutdown: function()
+ {
+ if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("helloAMD; HelloAMD extension shutdown");
+
+ // TODO: Extension shutdown
+
+ TraceModule.removeListener(this.traceListener);
+ }
+}
+
+return theApp;
+
+// ********************************************************************************************* //
+});
36 HelloAMD/chrome/content/mainOverlay.js
@@ -0,0 +1,36 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+// Author: Jan Odvarko, odvarko@gmail.com
+//
+// Use this file together with mainOverlay.xul that loads the entire extension. This file
+// can be used as is, the only thing you need to provide is unique "extensionName" <ext-name>
+//
+// Search for <ext-name> keyword thourough this extension and replace by unique ID.
+//
+// Content of the mainOverlay.xul overlay should look like as follows:
+//
+// <?xml version="1.0"?>
+// <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+// <script type="application/x-javascript" src="chrome://<ext-name>/content/mainOverlay.js"/>
+// </overlay>
+//
+// The mainOverlay.xul file is used only to load the extension. The loading proces can be
+// also done through bootstrap.js (restartless Firefox support), but it needs additional
+// Firebug APIs support.
+//
+// Do not use XUL for any UI (you wouldn't be able to use restartless add-on support later).
+// Firebug UI should be extended only through Firebug related API.
+
+// ********************************************************************************************* //
+// Registration
+
+// Notice that <ext-name> is used to build chrome paths like: chrome://<ext-name>/content/main.js
+// The <ext-name> should comd from chrome.manifest: resource helloamd chrome/
+
+// The registration process will automatically look for 'main' module and load it.
+// TODO: Replace with your extension credentials.
+var config = {id: "helloamd@janodvarko.cz"};
+Firebug.registerExtension("helloamd", config);
+
+// ********************************************************************************************* //
4 HelloAMD/chrome/content/mainOverlay.xul
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/x-javascript" src="chrome://helloamd/content/mainOverlay.js"/>
+</overlay>
44 HelloAMD/chrome/content/myModule.js
@@ -0,0 +1,44 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/object",
+ "firebug/lib/trace",
+],
+function(Obj, FBTrace) {
+
+// ********************************************************************************************* //
+// Custom Module Implementation
+
+Firebug.MyModule = Obj.extend(Firebug.Module,
+{
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function(owner)
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ // TODO: Module initialization (there is one module instance per browser window)
+
+ if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("helloAMD; MyModule.initialize");
+ },
+
+ shutdown: function()
+ {
+ Firebug.Module.shutdown.apply(this, arguments);
+
+ if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("helloAMD; MyModule.shutdown");
+ },
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerModule(Firebug.MyModule);
+
+return Firebug.MyModule;
+
+// ********************************************************************************************* //
+});
100 HelloAMD/chrome/content/myPanel.js
@@ -0,0 +1,100 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/object",
+ "firebug/lib/trace",
+ "firebug/lib/locale",
+ "firebug/lib/domplate"
+],
+function(Obj, FBTrace, Locale, Domplate) {
+
+// ********************************************************************************************* //
+// Custom Panel Implementation
+
+var panelName = "helloamd";
+
+function MyPanel() {}
+MyPanel.prototype = Obj.extend(Firebug.Panel,
+{
+ name: panelName,
+ title: "Hello AMD World!",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+
+ if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("helloAMD; MyPanel.initialize");
+
+ // TODO: Panel initialization (there is one panel instance per browser tab)
+
+ this.refresh();
+ },
+
+ destroy: function(state)
+ {
+ if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("helloAMD; MyPanel.destroy");
+
+ Firebug.Panel.destroy.apply(this, arguments);
+ },
+
+ show: function(state)
+ {
+ Firebug.Panel.show.apply(this, arguments);
+
+ if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("helloAMD; MyPanel.show");
+ },
+
+ refresh: function()
+ {
+ // Render panel content. The HTML result of the template corresponds to:
+ //this.panelNode.innerHTML = "<span>" + Locale.$STR("helloamd.panel.label") + "</span>";
+ this.MyTemplate.render(this.panelNode);
+
+ // TODO: Render panel content
+ }
+});
+
+// ********************************************************************************************* //
+// Panel UI (Domplate)
+
+// Register locales before the following template definition.
+Firebug.registerStringBundle("chrome://helloamd/locale/helloamd.properties");
+
+/**
+ * Domplate template used to render panel's content. Note that the template uses
+ * localized strings and so, Firebug.registerStringBundle for the appropriate
+ * locale file must be already executed at this moment.
+ */
+with (Domplate) {
+MyPanel.prototype.MyTemplate = domplate(
+{
+ tag:
+ SPAN(
+ Locale.$STR("helloamd.panel.label")
+ ),
+
+ render: function(parentNode)
+ {
+ this.tag.replace({}, parentNode);
+ }
+})}
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerPanel(MyPanel);
+Firebug.registerStylesheet("resource://helloamd/skin/classic/helloamd.css");
+
+if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("helloAMD; myPanel.js, stylesheet registered");
+
+return MyPanel;
+
+// ********************************************************************************************* //
+});
1 HelloAMD/chrome/locale/en-US/helloamd.properties
@@ -0,0 +1 @@
+helloamd.panel.label=Hello AMD World!
23 HelloAMD/chrome/skin/classic/helloamd.css
@@ -0,0 +1,23 @@
+/* See license.txt for terms of usage */
+
+/*************************************************************************************************/
+
+/* Style applied on the panel node.
+ Rule syntax: .panelNode-<ext-id> */
+.panelNode-helloamd {
+ overflow: hidden;
+ color: green;
+ padding: 10px;
+ font-size: 12px;
+ font-weight: bold;
+}
+
+/*************************************************************************************************/
+
+/* Firebug Tracing Console customization. All messages from this example use this color.
+ This helps to distinguish logs from those coming from Firebug
+ Rule syntax: .DBG_<ext-id>
+ See: http://getfirebug.com/wiki/index.php/FBTrace for more details */
+.DBG_HELLOAMD {
+ color: rgb(101, 0, 114);
+}
1 HelloAMD/defaults/preferences/prefs.js
@@ -0,0 +1 @@
+pref("extensions.firebug.DBG_HELLOAMD", true);
24 HelloAMD/install.rdf
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>helloamd@janodvarko.cz</em:id>
+ <em:version>0.5</em:version>
+
+ <!-- Firefox -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>4.0</em:minVersion>
+ <em:maxVersion>20.0.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <em:name>Hello AMD!</em:name>
+ <em:description>Firebug Hello AMD extension shows how to use Asynchronous Module Definition in Firebug extensions</em:description>
+ <em:creator>Jan Odvarko</em:creator>
+ <em:homepageURL>http://www.janodvarko.cz</em:homepageURL>
+ </Description>
+</RDF>
30 HelloAMD/license.txt
@@ -0,0 +1,30 @@
+Software License Agreement (BSD License)
+
+Copyright (c) 2007, Parakey Inc.
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the
+ following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+* Neither the name of Parakey Inc. nor the names of its
+ contributors may be used to endorse or promote products
+ derived from this software without specific prior
+ written permission of Parakey Inc.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 HelloAMD/readme.txt
@@ -0,0 +1,14 @@
+/* See license.txt for terms of usage */
+
+Author: Jan Odvarko, odvarko@gmail.com
+
+This extension serves as an example of a Firebug extension based on
+Asynchronous Module Definition (AMD)
+
+Support APIs for AMD based extension is introduced in Firebug 1.9
+
+TODO:
+
+* Firebug needs API for creating a new toolbar and appending a button
+ into an existing toolbar. This shouldn't be done through XUL overlays
+ anymore (to support restartless/bootstrapped extensions in the future)
3 HelloBootAMD/ant.properties
@@ -0,0 +1,3 @@
+# DO NOT MERGE INTO TRUNK
+RELEASE=.1
+VERSION=0.5
124 HelloBootAMD/bootstrap.js
@@ -0,0 +1,124 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+// XPCOM
+
+var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+// ********************************************************************************************* //
+// Constants
+
+// Default preferences for bootstrap extensions are registered dynamically.
+var defaultPrefs =
+{
+ "DBG_HELLOBOOTAMD": true,
+}
+
+// ********************************************************************************************* //
+// Firefox Bootstrap API
+
+function install(data, reason) {}
+function uninstall(data, reason) {}
+function startup(data, reason) { firebugStartup(); }
+function shutdown(data, reason) { firebugShutdown(); }
+
+// ********************************************************************************************* //
+// Firebug Bootstrap API
+
+/**
+ * Executed by Firebug framework when Firebug is started. Since the order of Firebug
+ * and its bootstrapped extensions is not guaranteed this function is executed twice
+ * (of course the registration happens just once):
+ *
+ * 1) When Firebug is loaded
+ * 2) When this extension is loaded
+ *
+ * If Firebug is not loaded an exception happens
+ */
+function firebugStartup()
+{
+ try
+ {
+ Cu.import("resource://firebug/loader.js");
+ FirebugLoader.registerBootstrapScope(this);
+ FirebugLoader.registerDefaultPrefs(defaultPrefs);
+ }
+ catch (e)
+ {
+ // If an exception happens it's probably because Firebug hasn't been
+ // started yet. Just ignore it.
+ }
+}
+
+/**
+ * Executed by Firefox when this extension shutdowns.
+ */
+function firebugShutdown()
+{
+ try
+ {
+ Cu.import("resource://firebug/loader.js");
+ FirebugLoader.unregisterBootstrapScope(this);
+ }
+ catch (e)
+ {
+ Cu.reportError(e);
+ }
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+/**
+ * Executed by Firebug framework for every browser window. Use this function to append
+ * any new elements into the browser window (browser.xul). Don't forget to remove
+ * these elements in topWindowUnload.
+ *
+ * @param {Window} win The browser window
+ */
+function topWindowLoad(win)
+{
+ // TODO: overlay global browser window
+}
+
+/**
+ * Executed by Firebug framework when this extension
+ * @param {Object} win
+ */
+function topWindowUnload(win)
+{
+ // TODO: remove global browser window overlays
+}
+
+/**
+ * Entire Firebug UI is running inside an iframe (firebugFrame.xul). This function
+ * is executed by Firebug framework when the frame is loaded. This happens when
+ * the user requires Firebug for the first time (doesn't have to happen during the
+ * Firefox session at all)
+ *
+ * @param {Window} win The Firebug window
+ */
+function firebugFrameLoad(Firebug)
+{
+ // Register trace listener the customizes trace logs coming from this extension
+ // * helloBootAMD; is unique prefix of all messages that should be customized.
+ // * DBG_HELLOBOOTAMD is a class name with style defined in the specified stylesheet.
+ Firebug.registerTracePrefix("helloBootAMD;", "DBG_HELLOBOOTAMD", true,
+ "chrome://hellobootamd/skin/hellobootamd.css");
+
+ // The registration process will automatically look for 'main' module and load it.
+ // The is the same what happens in a XUL overlay applied on:
+ // chrome://firebug/content/firebugOverlay.xul
+ var config = {id: "hellobootamd@janodvarko.cz"};
+ Firebug.registerExtension("hellobootamd", config);
+}
+
+function firebugFrameUnload(Firebug)
+{
+ if (!Firebug.isInitialized)
+ return;
+
+ Firebug.unregisterExtension("hellobootamd");
+ Firebug.unregisterTracePrefix("helloBootAMD;");
+}
+
+// ********************************************************************************************* //
36 HelloBootAMD/build.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" ?>
+
+<!-- Run ant in the extension's directory and look for: hellobootamd-0.5.1.xpi -->
+<project name="hellobootamd" basedir="." default="build">
+
+ <!-- Properties -->
+ <property file="ant.properties"/>
+ <property name="build.dir" value="./release"/>
+ <property name="file-name" value="hellobootamd-${VERSION}${RELEASE}.xpi"/>
+
+ <!-- Clean -->
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <!-- Build -->
+ <target name="build" depends="clean">
+
+ <!-- Copy extension installation files and licence.txt -->
+ <copy file="bootstrap.js" todir="${build.dir}"/>
+ <copy file="install.rdf" todir="${build.dir}"/>
+ <copy file="license.txt" todir="${build.dir}"/>
+
+ <!-- Copy install.rdf with updated release version info -->
+ <replace file="${build.dir}/install.rdf" propertyFile="ant.properties">
+ <replacefilter token="@VERSION@" property="VERSION"/>
+ <replacefilter token="@RELEASE@" property="RELEASE"/>
+ </replace>
+
+ <!-- Compress files (ZIP) -->
+ <zip destfile="${file-name}" basedir="${build.dir}" update="true" />
+
+ <echo message="HelloBootAMD version: ${VERSION}${RELEASE} created!"/>
+ </target>
+
+</project>
8 HelloBootAMD/chrome.manifest
@@ -0,0 +1,8 @@
+content hellobootamd chrome/content/
+skin hellobootamd classic/1.0 chrome/skin/classic/
+locale hellobootamd en-US chrome/locale/en-US/
+
+# The extension is bootstrapped in this scenario
+# To switch to XUL overlay based extension change 'em:bootstrap' to false in install.rdf
+# and use the following line:
+#overlay chrome://firebug/content/firebugOverlay.xul chrome://hellobootamd/content/mainOverlay.xul
52 HelloBootAMD/chrome/content/main.js
@@ -0,0 +1,52 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/trace",
+ "hellobootamd/myPanel",
+ "hellobootamd/myModule",
+],
+function(FBTrace, MyPanel, MyModule) {
+
+// ********************************************************************************************* //
+// Documentation
+
+// Firebug coding style: http://getfirebug.com/wiki/index.php/Coding_Style
+// Firebug tracing: http://getfirebug.com/wiki/index.php/FBTrace
+
+// ********************************************************************************************* //
+// The application/extension object
+
+var theApp =
+{
+ initialize: function()
+ {
+ if (FBTrace.DBG_HELLOBOOTAMD)
+ FBTrace.sysout("helloBootAMD; HelloBootAMD extension initialize");
+
+ // Registration of Firebug panels and modules is made within appropriate files,
+ // but it could be also done here.
+
+ // TODO: Extension initialization
+ },
+
+ shutdown: function()
+ {
+ if (FBTrace.DBG_HELLOBOOTAMD)
+ FBTrace.sysout("helloBootAMD; HelloBootAMD extension shutdown");
+
+ // Unregister all registered Firebug components
+ Firebug.unregisterPanel(Firebug.MyPanel);
+ Firebug.unregisterModule(Firebug.MyModule);
+ Firebug.unregisterStylesheet("chrome://hellobootamd/skin/hellobootamd.css");
+ Firebug.unregisterStringBundle("chrome://hellobootamd/locale/hellobootamd.properties");
+
+ // TODO: Extension shutdown
+ }
+}
+
+// ********************************************************************************************* //
+
+return theApp;
+
+// ********************************************************************************************* //
+});
39 HelloBootAMD/chrome/content/mainOverlay.js
@@ -0,0 +1,39 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+// Author: Jan Odvarko, odvarko@gmail.com
+//
+// Use this file together with mainOverlay.xul that loads the entire extension. This file
+// can be used as is, the only thing you need to provide is unique "extensionName" <ext-name>
+//
+// Search for <ext-name> keyword thourough this extension and replace by unique ID.
+//
+// Content of the mainOverlay.xul overlay should look like as follows:
+//
+// <?xml version="1.0"?>
+// <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+// <script type="application/x-javascript" src="chrome://<ext-name>/content/mainOverlay.js"/>
+// </overlay>
+//
+// The mainOverlay.xul file is used only to load the extension. The loading proces can be
+// also done through bootstrap.js (restartless Firefox support), but it needs additional
+// Firebug APIs support.
+//
+// Do not use XUL for any UI (you wouldn't be able to use restartless add-on support later).
+// Firebug UI should be extended only through Firebug related API.
+
+// ********************************************************************************************* //
+// Registration
+
+// Notice that <ext-name> is used to build chrome paths like: chrome://<ext-name>/content/main.js
+// The <ext-name> should come from chrome.manifest: resource hellobootamd chrome/
+
+Firebug.registerTracePrefix("helloBootAMD;", "DBG_HELLOBOOTAMD", true,
+ "chrome://hellobootamd/skin/hellobootamd.css");
+
+// The registration process will automatically look for 'main' module and load it.
+// TODO: Replace with your extension credentials.
+var config = {id: "hellobootamd@janodvarko.cz"};
+Firebug.registerExtension("hellobootamd", config);
+
+// ********************************************************************************************* //
4 HelloBootAMD/chrome/content/mainOverlay.xul
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/x-javascript" src="mainOverlay.js"/>
+</overlay>
44 HelloBootAMD/chrome/content/myModule.js
@@ -0,0 +1,44 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/object",
+ "firebug/lib/trace",
+],
+function(Obj, FBTrace) {
+
+// ********************************************************************************************* //
+// Custom Module Implementation
+
+Firebug.MyModule = Obj.extend(Firebug.Module,
+{
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function(owner)
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ // TODO: Module initialization (there is one module instance per browser window)
+
+ if (FBTrace.DBG_HELLOBOOTAMD)
+ FBTrace.sysout("helloBootAMD; MyModule.initialize");
+ },
+
+ shutdown: function()
+ {
+ Firebug.Module.shutdown.apply(this, arguments);
+
+ if (FBTrace.DBG_HELLOBOOTAMD)
+ FBTrace.sysout("helloBootAMD; MyModule.shutdown");
+ },
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerModule(Firebug.MyModule);
+
+return Firebug.MyModule;
+
+// ********************************************************************************************* //
+});
100 HelloBootAMD/chrome/content/myPanel.js
@@ -0,0 +1,100 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/object",
+ "firebug/lib/trace",
+ "firebug/lib/locale",
+ "firebug/lib/domplate"
+],
+function(Obj, FBTrace, Locale, Domplate) {
+
+// ********************************************************************************************* //
+// Custom Panel Implementation
+
+var panelName = "hellobootamd";
+
+Firebug.MyPanel = function MyPanel() {};
+Firebug.MyPanel.prototype = Obj.extend(Firebug.Panel,
+{
+ name: panelName,
+ title: "Hello AMD World!",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+
+ if (FBTrace.DBG_HELLOBOOTAMD)
+ FBTrace.sysout("helloBootAMD; MyPanel.initialize");
+
+ // TODO: Panel initialization (there is one panel instance per browser tab)
+
+ this.refresh();
+ },
+
+ destroy: function(state)
+ {
+ if (FBTrace.DBG_HELLOBOOTAMD)
+ FBTrace.sysout("helloBootAMD; MyPanel.destroy");
+
+ Firebug.Panel.destroy.apply(this, arguments);
+ },
+
+ show: function(state)
+ {
+ Firebug.Panel.show.apply(this, arguments);
+
+ if (FBTrace.DBG_HELLOBOOTAMD)
+ FBTrace.sysout("helloBootAMD; MyPanel.show");
+ },
+
+ refresh: function()
+ {
+ // Render panel content. The HTML result of the template corresponds to:
+ //this.panelNode.innerHTML = "<span>" + Locale.$STR("hellobootamd.panel.label") + "</span>";
+ this.MyTemplate.render(this.panelNode);
+
+ // TODO: Render panel content
+ }
+});
+
+// ********************************************************************************************* //
+// Panel UI (Domplate)
+
+// Register locales before the following template definition.
+Firebug.registerStringBundle("chrome://hellobootamd/locale/hellobootamd.properties");
+
+/**
+ * Domplate template used to render panel's content. Note that the template uses
+ * localized strings and so, Firebug.registerStringBundle for the appropriate
+ * locale file must be already executed at this moment.
+ */
+with (Domplate) {
+Firebug.MyPanel.prototype.MyTemplate = domplate(
+{
+ tag:
+ SPAN(
+ Locale.$STR("hellobootamd.panel.label")
+ ),
+
+ render: function(parentNode)
+ {
+ this.tag.replace({}, parentNode);
+ }
+})}
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerPanel(Firebug.MyPanel);
+Firebug.registerStylesheet("chrome://hellobootamd/skin/hellobootamd.css");
+
+if (FBTrace.DBG_HELLOBOOTAMD)
+ FBTrace.sysout("helloBootAMD; myPanel.js, stylesheet registered");
+
+return Firebug.MyPanel;
+
+// ********************************************************************************************* //
+});
1 HelloBootAMD/chrome/locale/en-US/hellobootamd.properties
@@ -0,0 +1 @@
+hellobootamd.panel.label=Hello Bootstrapped AMD World!
23 HelloBootAMD/chrome/skin/classic/hellobootamd.css
@@ -0,0 +1,23 @@
+/* See license.txt for terms of usage */
+
+/*************************************************************************************************/
+
+/* Style applied on the panel node.
+ Rule syntax: .panelNode-<ext-id> */
+.panelNode-hellobootamd {
+ overflow: hidden;
+ color: green;
+ padding: 10px;
+ font-size: 12px;
+ font-weight: bold;
+}
+
+/*************************************************************************************************/
+
+/* Firebug Tracing Console customization. All messages from this example use this color.
+ This helps to distinguish logs from those coming from Firebug
+ Rule syntax: .DBG_<ext-id>
+ See: http://getfirebug.com/wiki/index.php/FBTrace for more details */
+.DBG_HELLOBOOTAMD {
+ color: rgb(101, 0, 114);
+}
1 HelloBootAMD/defaults/preferences/prefs.js
@@ -0,0 +1 @@
+pref("extensions.firebug.DBG_HELLOBOOTAMD", true);
26 HelloBootAMD/install.rdf
@@ -0,0 +1,26 @@
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>hellobootamd@janodvarko.cz</em:id>
+ <em:version>@VERSION@@RELEASE@</em:version>
+ <em:type>2</em:type>
+ <em:bootstrap>true</em:bootstrap>
+
+ <!-- Target Application this extension can install into,
+ with minimum and maximum supported versions. -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>10.0</em:minVersion>
+ <em:maxVersion>20.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <!-- Front End MetaData -->
+ <em:name>Bootstrapped Firebug 1.10 Extension Example</em:name>
+ <em:description>Example of a Firebug extension that doesn't require browser restart.</em:description>
+ <em:creator>Jan Odvarko</em:creator>
+ <em:homepageURL>http://getfirebug.com</em:homepageURL>
+ </Description>
+</RDF>
30 HelloBootAMD/license.txt
@@ -0,0 +1,30 @@
+Software License Agreement (BSD License)
+
+Copyright (c) 2007, Parakey Inc.
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the
+ following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+* Neither the name of Parakey Inc. nor the names of its
+ contributors may be used to endorse or promote products
+ derived from this software without specific prior
+ written permission of Parakey Inc.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 HelloBootAMD/readme.txt
@@ -0,0 +1,22 @@
+/* See license.txt for terms of usage */
+
+Author: Jan Odvarko, odvarko@gmail.com
+
+This extension serves as an example and proof of concept for restart-less
+(bootstrapped) support APIs in Firebug 1.10
+
+== Build Extension ==
+Run 'ant' command in the extension's directory and look for: hellobootamd-0.5.1.xpi
+(see build.xml for more)
+
+== TODO ==
+* Improve Firebug API for updating tab bar
+ - the extension needs to explicitly call Firebug.chrome.syncMainPanels();
+ - could it be automated
+
+* Make sure removed panel is no longer selected
+ - the extension needs to explicitly call win.Firebug.chrome.selectPanel("html");
+ - could it be automated
+
+* Firebug.Module.initialize event is not distributed to dynamically registered modules
+ - what about other modules?
2 HelloWorld/chrome.manifest
@@ -0,0 +1,2 @@
+content helloworld chrome/content/helloworld/
+overlay chrome://firebug/content/firebugOverlay.xul chrome://helloworld/content/helloWorld.xul
80 HelloWorld/chrome/content/helloworld/helloWorld.js
@@ -0,0 +1,80 @@
+/* See license.txt for terms of usage */
+
+FBL.ns(function() { with (FBL) {
+
+var panelName = "HelloWorld";
+
+// ********************************************************************************************* //
+// Module
+
+/**
+ * Author: Jan Odvarko, www.janodvarko.cz
+ */
+Firebug.HelloWorldModel = extend(Firebug.Module,
+{
+ initialize: function(prefDomain, prefNames)
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ FBTrace.sysout("helloworld; HelloWorldModel.initialize");
+ },
+
+ showPanel: function(browser, panel)
+ {
+ var isHwPanel = panel && panel.name == panelName;
+ var hwButtons = Firebug.chrome.$("fbHelloWorldButtons");
+ collapse(hwButtons, !isHwPanel);
+ },
+
+ onMyButton: function(context)
+ {
+ alert("Hello World!");
+ },
+});
+
+// ********************************************************************************************* //
+// Panel
+
+function HelloWorldPanel() {}
+HelloWorldPanel.prototype = extend(Firebug.Panel,
+{
+ name: panelName,
+ title: "Hello World!",
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+
+ FBTrace.sysout("helloworld; HelloWorldPanel.initialize");
+ },
+
+ getOptionsMenuItems: function(context)
+ {
+ return [
+ this.optionMenu("Option1", "helloworld.option1"),
+ "-",
+ this.optionMenu("Option2", "helloworld.option2")
+ ];
+ },
+
+ optionMenu: function(label, option)
+ {
+ var value = Firebug.getPref(Firebug.prefDomain, option);
+ return {
+ label: label,
+ nol10n: true,
+ type: "checkbox",
+ checked: value,
+ command: bindFixed(Firebug.setPref, this, Firebug.prefDomain, option, !value)
+ };
+ }
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerPanel(HelloWorldPanel);
+Firebug.registerModule(Firebug.HelloWorldModel);
+
+// ********************************************************************************************* //
+}});
21 HelloWorld/chrome/content/helloworld/helloWorld.xul
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://helloworld/content/helloWorld.js" type="application/x-javascript"/>
+
+ <commandset id="mainCommandSet">
+ <command id="cmd_hwMyButton" oncommand="Firebug.HelloWorldModel.onMyButton(Firebug.currentContext)"/>
+ <command id="cmd_hwDisableNetMonitoring"
+ oncommand="Firebug.HelloWorldModel.onDisableNetMonitoring(Firebug.currentContext)"/>
+ </commandset>
+
+ <toolbar id="fbToolbar" align="center">
+ <hbox id="fbToolbarInner" insertbefore="fbDetachButton" flex="1" align="center">
+ <hbox id="fbHelloWorldButtons" insertafter="fbNetButtons">
+ <toolbarbutton id="hwMyButton"
+ label="Say Hello" class="toolbar-text-button"
+ tooltiptext="Push to say hello" command="cmd_hwMyButton"/>
+ </hbox>
+ </hbox>
+ </toolbar>
+</overlay>
2 HelloWorld/defaults/preferences/prefs.js
@@ -0,0 +1,2 @@
+pref("extensions.firebug.helloworld.option1", true);
+pref("extensions.firebug.helloworld.option2", false);
24 HelloWorld/install.rdf
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>helloworld@janodvarko.cz</em:id>
+ <em:version>0.5</em:version>
+
+ <!-- Firefox -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>4.0</em:minVersion>
+ <em:maxVersion>10.0.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <em:name>Hello World!</em:name>
+ <em:description>Firebug Hello World! Extension</em:description>
+ <em:creator>Jan Odvarko</em:creator>
+ <em:homepageURL>http://www.janodvarko.cz</em:homepageURL>
+ </Description>
+</RDF>
3 LinkInspector/chrome.manifest
@@ -0,0 +1,3 @@
+content linkinspector chrome/content/
+skin linkinspector classic/1.0 chrome/skin/classic/
+overlay chrome://firebug/content/firebugOverlay.xul chrome://linkinspector/content/inspector.xul
190 LinkInspector/chrome/content/inspector.js
@@ -0,0 +1,190 @@
+/* See license.txt for terms of usage */
+
+FBL.ns(function() { with (FBL) {
+
+// ********************************************************************************************* //
+// Panel
+
+var panelName = "linkInspector";
+
+/**
+ * @panel This panel integrates with Firebug Inspector API and provides own logic
+ * and display of custom information for links. This code serves as an example of
+ * how to properly use and implement Inspector.
+ */
+function LinkInspectorPanel() {}
+LinkInspectorPanel.prototype = extend(Firebug.Panel,
+/** @lends LinkInspectorPanel */
+{
+ name: panelName,
+ title: "Link Inspector",
+ inspectable: true,
+ inspectHighlightColor: "green",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+
+ Firebug.Inspector.addListener(this);
+ },
+
+ destroy: function(state)
+ {
+ Firebug.Panel.destroy.apply(this, arguments);
+
+ Firebug.Inspector.removeListener(this);
+ },
+
+ show: function(state)
+ {
+ Firebug.Panel.show.apply(this, arguments);
+
+ LinkInspectorPlate.defaultContent.replace({}, this.panelNode);
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Inspector API implementation
+
+ startInspecting: function()
+ {
+ if (FBTrace.DBG_LINKINSPECTOR)
+ FBTrace.sysout("link-inspector; startInspecting()");
+ },
+
+ inspectNode: function(node)
+ {
+ if (FBTrace.DBG_LINKINSPECTOR)
+ FBTrace.sysout("link-inspector; inspectNode(node: " + node.tagName + ")");
+
+ LinkInspectorPlate.linkUrl.replace({object: node}, this.panelNode);
+ },
+
+ stopInspecting: function(node, canceled)
+ {
+ if (FBTrace.DBG_LINKINSPECTOR)
+ FBTrace.sysout("link-inspector; stopInspecting(node: " + node.tagName +
+ ", canceled: " + canceled + ")");
+
+ if (canceled)
+ return;
+
+ if (node.href.indexOf("http") != 0)
+ return;
+
+ LinkInspectorPlate.linkPreview.replace({object: node}, this.panelNode);
+ },
+
+ supportsObject: function(object, type)
+ {
+ if (object instanceof Element)
+ {
+ if (object.tagName.toLowerCase() == "a")
+ return 1;
+ }
+
+ return 0;
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Inspector Listener
+
+ onStartInspecting: function(context)
+ {
+ if (FBTrace.DBG_LINKINSPECTOR)
+ FBTrace.sysout("link-inspector; Listener.onStartInspecting(context: " +
+ context.getTitle() + ")");
+ },
+
+ onInspectNode: function(context, node)
+ {
+ if (FBTrace.DBG_LINKINSPECTOR)
+ FBTrace.sysout("link-inspector; Listener.onInspectNode(context: " +
+ context.getTitle() + ", node: " + node.tagName + ")");
+ },
+
+ onStopInspecting: function(context, node, canceled)
+ {
+ if (FBTrace.DBG_LINKINSPECTOR)
+ FBTrace.sysout("link-inspector; Listener.onStopInspecting(context: " +
+ context.getTitle() + ", node: " + node.tagName + ", canceled: " +
+ canceled + ")");
+ },
+});
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+var LinkInspectorPlate = domplate(
+{
+ linkUrl:
+ DIV({"class": "linkUrl"},
+ "$object.href"
+ ),
+
+ linkPreview:
+ IFRAME({"class": "linkPreview", "src": "$object.href"}),
+
+ defaultContent:
+ DIV({"class": "defaultContent"},
+ "Use Firebug Inspector and try to inspect a link on the current page."
+ )
+});
+
+// ********************************************************************************************* //
+// Module & Customizing Tracing
+
+/**
+ * @module The module object isn't really neccessary for the Inspector API. It serves
+ * only to support Firebug tracing console, which is useful when debugging inspector
+ * features.
+ */
+Firebug.LinkInspectorModule = extend(Firebug.Module,
+/** @lends Firebug.LinkInspectorModule */
+{
+ initialize: function()
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ if (Firebug.TraceModule)
+ Firebug.TraceModule.addListener(this);
+ },
+
+ shutdown: function()
+ {
+ Firebug.Module.shutdown.apply(this, arguments);
+
+ if (Firebug.TraceModule)
+ Firebug.TraceModule.removeListener(this);
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Trace Listener
+
+ onLoadConsole: function(win, rootNode)
+ {
+ appendStylesheet(rootNode.ownerDocument, "chrome://linkinspector/skin/inspector.css");
+ },
+
+ onDump: function(message)
+ {
+ var index = message.text.indexOf("link-inspector;");
+ if (index == 0)
+ {
+ message.text = message.text.substr("link-inspector;".length);
+ message.text = trim(message.text);
+ message.type = "DBG_LINKINSPECTOR";
+ }
+ }
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerPanel(LinkInspectorPanel);
+Firebug.registerModule(Firebug.LinkInspectorModule);
+Firebug.registerStylesheet("chrome://linkinspector/skin/inspector.css");
+
+// ********************************************************************************************* //
+}});
6 LinkInspector/chrome/content/inspector.xul
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://linkinspector/content/inspector.js" type="application/x-javascript"/>
+
+</overlay>
34 LinkInspector/chrome/skin/classic/inspector.css
@@ -0,0 +1,34 @@
+/* See license.txt for terms of usage */
+
+/*************************************************************************************************/
+
+/* Style applied on the panel node. */
+.panelNode-linkInspector {
+ overflow: hidden;
+}
+
+.defaultContent {
+ text-align: center;
+ padding-top: 30px;
+ color: gray;
+}
+
+.linkUrl {
+ text-align: center;
+ padding-top: 30px;
+ color: blue;
+}
+
+.linkPreview {
+ border: none;
+ width: 100%;
+ height: 100%;
+}
+
+/*************************************************************************************************/
+
+/* Firebug Tracing Console customization. All messages from this example use this color.
+ This helps to distinguish logs from those coming from Firebug */
+.DBG_LINKINSPECTOR {
+ color: rgb(0, 101, 114);
+}
1 LinkInspector/defaults/preferences/prefs.js
@@ -0,0 +1 @@
+pref("extensions.firebug.DBG_LINKINSPECTOR", true);
25 LinkInspector/install.rdf
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+<Description about="urn:mozilla:install-manifest">
+ <em:id>linkinspector@janodvarko.cz</em:id>
+ <em:version>0.5</em:version>
+
+ <!-- Any suitably modern toolkit application -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>3.6</em:minVersion>
+ <em:maxVersion>4.0.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <em:name>Link Inspector</em:name>
+ <em:description>How to create a custom Firebug inspector</em:description>
+ <em:creator>Jan Odvarko</em:creator>
+ <em:homepageURL>http://www.janodvarko.cz</em:homepageURL>
+</Description>
+
+</RDF>
63 SidePanel/bootstrap.js
@@ -0,0 +1,63 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+// XPCOM
+
+var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+// ********************************************************************************************* //
+// Firefox Bootstrap API
+
+function install(data, reason) {}
+function uninstall(data, reason) {}
+function startup(data, reason) { firebugStartup(); }
+function shutdown(data, reason) { firebugShutdown(); }
+
+// ********************************************************************************************* //
+// Firebug Bootstrap API
+
+function firebugStartup()
+{
+ try
+ {
+ Cu.import("resource://firebug/loader.js");
+ FirebugLoader.registerBootstrapScope(this);
+ }
+ catch (e)
+ {
+ }
+}
+
+function firebugShutdown()
+{
+ try
+ {
+ Cu.import("resource://firebug/loader.js");
+ FirebugLoader.unregisterBootstrapScope(this);
+ }
+ catch (e)
+ {
+ Cu.reportError(e);
+ }
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+function topWindowLoad(win) {}
+function topWindowUnload(win) {}
+
+function firebugFrameLoad(Firebug)
+{
+ var config = {id: "sidepanel@janodvarko.cz"};
+ Firebug.registerExtension("sidepanel", config);
+}
+
+function firebugFrameUnload(Firebug)
+{
+ if (!Firebug.isInitialized)
+ return;
+
+ Firebug.unregisterExtension("sidepanel");
+}
+
+// ********************************************************************************************* //
1 SidePanel/chrome.manifest
@@ -0,0 +1 @@
+content sidepanel chrome/content/
38 SidePanel/chrome/content/main.js
@@ -0,0 +1,38 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/trace",
+ "sidepanel/myPanel",
+ "sidepanel/mySidePanel",
+ "sidepanel/myNetSidePanel",
+],
+function(FBTrace, MyPanel, MySidePanel, MyNetSidePanel) {
+
+// ********************************************************************************************* //
+// The application object
+
+var theApp =
+{
+ initialize: function()
+ {
+ Firebug.registerPanel(MyPanel);
+ Firebug.registerPanel(MySidePanel);
+ Firebug.registerPanel(MyNetSidePanel);
+ },
+
+ shutdown: function()
+ {
+ FBTrace.sysout("sidePanel; shutdown");
+
+ Firebug.unregisterPanel(MyPanel);
+ Firebug.unregisterPanel(MySidePanel);
+ Firebug.unregisterPanel(MyNetSidePanel);
+ }
+}
+
+// ********************************************************************************************* //
+
+return theApp;
+
+// ********************************************************************************************* //
+});
43 SidePanel/chrome/content/myNetSidePanel.js
@@ -0,0 +1,43 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+],
+function(FBL, FBTrace) {
+
+// ********************************************************************************************* //
+// Panel Implementation
+
+var MyNetSidePanel = function MyNetSidePanel() {};
+MyNetSidePanel.prototype = FBL.extend(Firebug.Panel,
+{
+ name: "myNetSidePanel",
+ title: "My Net Side Panel",
+
+ /**
+ * This panel is automatically used as a side-panel when parent panel is set.
+ * In this case we are injecting a side panel into an existing panel.
+ */
+ parentPanel: "net",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+ },
+
+ destroy: function(state)
+ {
+ Firebug.Panel.destroy.apply(this, arguments);
+ },
+});
+
+// ********************************************************************************************* //
+
+return MyNetSidePanel;
+
+// ********************************************************************************************* //
+});
37 SidePanel/chrome/content/myPanel.js
@@ -0,0 +1,37 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+],
+function(FBL, FBTrace) {
+
+// ********************************************************************************************* //
+// Panel Implementation
+
+var MyPanel = function MyPanel() {};
+MyPanel.prototype = FBL.extend(Firebug.Panel,
+{
+ name: "myPanel",
+ title: "My Panel",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+ },
+
+ destroy: function(state)
+ {
+ Firebug.Panel.destroy.apply(this, arguments);
+ },
+});
+
+// ********************************************************************************************* //
+
+return MyPanel;
+
+// ********************************************************************************************* //
+});
42 SidePanel/chrome/content/mySidePanel.js
@@ -0,0 +1,42 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+],
+function(FBL, FBTrace) {
+
+// ********************************************************************************************* //
+// Panel Implementation
+
+var MySidePanel = function MySidePanel() {};
+MySidePanel.prototype = FBL.extend(Firebug.Panel,
+{
+ name: "mySidePanel",
+ title: "My Side Panel",
+
+ /**
+ * This panel is automatically used as a side-panel when parent panel is set.
+ */
+ parentPanel: "myPanel",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+ },
+
+ destroy: function(state)
+ {
+ Firebug.Panel.destroy.apply(this, arguments);
+ },
+});
+
+// ********************************************************************************************* //
+
+return MySidePanel;
+
+// ********************************************************************************************* //
+});
23 SidePanel/install.rdf
@@ -0,0 +1,23 @@
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>sidepanel@janodvarko.cz</em:id>
+ <em:version>@VERSION@@RELEASE@</em:version>
+ <em:type>2</em:type>
+ <em:bootstrap>true</em:bootstrap>
+
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>10.0</em:minVersion>
+ <em:maxVersion>20.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <em:name>Side Panel in Firebug</em:name>
+ <em:description>See how to create a side panel in Firebug</em:description>
+ <em:creator>Jan Odvarko</em:creator>
+ <em:homepageURL>http://getfirebug.com</em:homepageURL>
+ </Description>
+</RDF>
30 SidePanel/license.txt
@@ -0,0 +1,30 @@
+Software License Agreement (BSD License)
+
+Copyright (c) 2007, Parakey Inc.
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the
+ following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+* Neither the name of Parakey Inc. nor the names of its
+ contributors may be used to endorse or promote products
+ derived from this software without specific prior
+ written permission of Parakey Inc.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 TabularUI/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>(example) TabularUI</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
63 TabularUI/bootstrap.js
@@ -0,0 +1,63 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+// XPCOM
+
+var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+// ********************************************************************************************* //
+// Firefox Bootstrap API
+
+function install(data, reason) {}
+function uninstall(data, reason) {}
+function startup(data, reason) { firebugStartup(); }
+function shutdown(data, reason) { firebugShutdown(); }
+
+// ********************************************************************************************* //
+// Firebug Bootstrap API
+
+function firebugStartup()
+{
+ try
+ {
+ Cu.import("resource://firebug/loader.js");
+ FirebugLoader.registerBootstrapScope(this);
+ }
+ catch (e)
+ {
+ }
+}
+
+function firebugShutdown()
+{
+ try
+ {
+ Cu.import("resource://firebug/loader.js");
+ FirebugLoader.unregisterBootstrapScope(this);
+ }
+ catch (e)
+ {
+ Cu.reportError(e);
+ }
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+function topWindowLoad(win) {}
+function topWindowUnload(win) {}
+
+function firebugFrameLoad(Firebug)
+{
+ var config = {id: "tabularui@janodvarko.cz"};
+ Firebug.registerExtension("tabularui", config);
+}
+
+function firebugFrameUnload(Firebug)
+{
+ if (!Firebug.isInitialized)
+ return;
+
+ Firebug.unregisterExtension("tabularui");
+}
+
+// ********************************************************************************************* //
1 TabularUI/chrome.manifest
@@ -0,0 +1 @@
+content tabularui chrome/content/
34 TabularUI/chrome/content/main.js
@@ -0,0 +1,34 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/trace",
+ "tabularui/tabularDataPanel",
+],
+function(FBTrace, TabularDataPanel) {
+
+// ********************************************************************************************* //
+// The application object
+
+var theApp =
+{
+ initialize: function()
+ {
+ Firebug.registerPanel(TabularDataPanel);
+
+ FBTrace.sysout("tabularui; initialize");
+ },
+
+ shutdown: function()
+ {
+ Firebug.unregisterPanel(TabularDataPanel);
+
+ FBTrace.sysout("tabularui; shutdown");
+ }
+}
+
+// ********************************************************************************************* //
+
+return theApp;
+
+// ********************************************************************************************* //
+});
72 TabularUI/chrome/content/tabularDataPanel.js
@@ -0,0 +1,72 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+ "firebug/chrome/tableRep",
+],
+function(FBL, FBTrace, TableRep) {
+
+// ********************************************************************************************* //
+// Panel Implementation
+
+var TabularDataPanel = function TabularDataPanel() {};
+TabularDataPanel.prototype = FBL.extend(Firebug.Panel,
+{
+ name: "tabularDataPanel",
+ title: "Links",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+ },
+
+ destroy: function(state)
+ {
+ Firebug.Panel.destroy.apply(this, arguments);
+ },
+
+ show: function()
+ {
+ FBTrace.sysout("tabularui; TabularDataPanel.show");
+
+ var links = this.context.window.document.querySelectorAll("a");
+ this.renderTable(links);
+ },
+
+ renderTable: function(object)
+ {
+ var obj = [
+ {name: "John", age: "25"},
+ {name: "Jack", age: "24"},
+ {name: "Bob", age: "23"}
+ ];
+
+ var cols = [];
+ cols.push({
+ property: "name",
+ label: "name",
+ alphaValue: true
+ });
+
+ cols.push({
+ property: "age",
+ label: "Age",
+ alphaValue: false
+ });
+
+ FirebugReps.Table.columns = cols;
+ var object = {data: obj, columns: cols};
+ FirebugReps.Table.tag.replace({object: object}, this.panelNode);
+ }
+});
+
+// ********************************************************************************************* //
+
+return TabularDataPanel;
+
+// ********************************************************************************************* //
+});
23 TabularUI/install.rdf
@@ -0,0 +1,23 @@
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>tabularui@janodvarko.cz</em:id>
+ <em:version>@VERSION@@RELEASE@</em:version>
+ <em:type>2</em:type>
+ <em:bootstrap>true</em:bootstrap>
+
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>10.0</em:minVersion>
+ <em:maxVersion>20.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <em:name>Tabular UI based on Domplate</em:name>
+ <em:description>See how to present tabular data in Firebug extensions</em:description>
+ <em:creator>Jan Odvarko</em:creator>
+ <em:homepageURL>http://getfirebug.com</em:homepageURL>
+ </Description>
+</RDF>
30 TabularUI/license.txt
@@ -0,0 +1,30 @@
+Software License Agreement (BSD License)
+
+Copyright (c) 2007, Parakey Inc.
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the
+ following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+* Neither the name of Parakey Inc. nor the names of its
+ contributors may be used to endorse or promote products
+ derived from this software without specific prior
+ written permission of Parakey Inc.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
79 Toolbar/bootstrap.js
@@ -0,0 +1,79 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+// XPCOM
+
+var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+Cu.import("resource://gre/modules/Services.jsm");
+
+// ********************************************************************************************* //
+// Constants
+
+const BOOTSTRAP_REASONS = [
+ "", // the bootstrap reason is 1 based
+ "APP_STARTUP",
+ "APP_SHUTDOWN",
+ "ADDON_ENABLE",
+ "ADDON_DISABLE",
+ "ADDON_INSTALL",
+ "ADDON_UNINSTALL",
+ "ADDON_UPGRADE",
+ "ADDON_DOWNGRADE"
+];
+
+// ********************************************************************************************* //
+// Firefox Bootstrap API
+
+function install(data, reason) {}
+function uninstall(data, reason) {}
+function startup(data, reason) { firebugStartup(); }
+function shutdown(data, reason) { firebugShutdown(); }
+
+// ********************************************************************************************* //
+// Firebug Bootstrap API
+
+function firebugStartup()
+{
+ try
+ {
+ Cu.import("resource://firebug/loader.js");
+ FirebugLoader.registerBootstrapScope(this);
+ }
+ catch (e)
+ {
+ }
+}
+
+function firebugShutdown()
+{
+ try
+ {
+ Cu.import("resource://firebug/loader.js");
+ FirebugLoader.unregisterBootstrapScope(this);
+ }
+ catch (e)
+ {
+ Cu.reportError(e);
+ }
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+function topWindowLoad(win) {}
+function topWindowUnload(win) {}
+
+function firebugFrameLoad(Firebug)
+{
+ var config = {id: "toolbar@janodvarko.cz"};
+ Firebug.registerExtension("toolbar", config);
+}
+
+function firebugFrameUnload(Firebug)
+{
+ if (!Firebug.isInitialized)
+ return;
+
+ Firebug.unregisterExtension("toolbar");
+}
+
+// ********************************************************************************************* //
3 Toolbar/chrome.manifest
@@ -0,0 +1,3 @@
+content toolbar chrome/content/
+skin toolbar classic/1.0 chrome/skin/classic/
+locale toolbar en-US chrome/locale/en-US/
38 Toolbar/chrome/content/main.js
@@ -0,0 +1,38 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/trace",
+ "toolbar/myModule",
+ "toolbar/myListener",
+ "toolbar/myPanel",
+],
+function(FBTrace, MyModule, MyListener, MyPanel) {
+
+// ********************************************************************************************* //
+// The application object
+
+var theApp =
+{
+ initialize: function()
+ {
+ Firebug.registerStringBundle("chrome://toolbar/locale/toolbar.properties");
+ Firebug.registerModule(MyModule);
+ Firebug.registerUIListener(MyListener);
+ Firebug.registerPanel(MyPanel);
+ },
+
+ shutdown: function()
+ {
+ Firebug.unregisterStringBundle("chrome://toolbar/locale/toolbar.properties");
+ Firebug.unregisterModule(MyModule);
+ Firebug.unregisterUIListener(MyListener);
+ Firebug.unregisterPanel(MyPanel);
+ }
+}
+
+// ********************************************************************************************* //
+
+return theApp;
+
+// ********************************************************************************************* //
+});
45 Toolbar/chrome/content/myListener.js
@@ -0,0 +1,45 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+],
+function(FBL, FBTrace) {
+
+// ********************************************************************************************* //
+// Implementation
+
+var MyListener =
+{
+ /**
+ * Extends Net panel toolbar.
+ */
+ onGetPanelToolbarButtons: function(panel, buttons)
+ {
+ if (panel.name != "net")
+ return;
+
+ // Append a new button into Net panel's toolbar.
+ buttons.push("-");
+ buttons.push({
+ label: "toolbar.button.label",
+ tooltiptext: "toolbar.button.tooltip",
+ command: FBL.bindFixed(this.onHello, this)
+ });
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Commands
+
+ onHello: function()
+ {
+ alert(FBL.$STR("toolbar.msg.hello1"));
+ }
+};
+
+// ********************************************************************************************* //
+
+return MyListener;
+
+// ********************************************************************************************* //
+});
58 Toolbar/chrome/content/myModule.js
@@ -0,0 +1,58 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+],
+function(FBL, FBTrace) {
+
+// ********************************************************************************************* //
+// Custom Module Implementation
+
+Firebug.MyModule = FBL.extend(Firebug.Module,
+{
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function(owner)
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ // The main Firebug toolbar can't be extended from a panel object since it's
+ // crated as soon as the panel is actualy selected by the use (which doesn't
+ // have to even happen). That's why we are creating the button here, in a module.
+ this.buttons = [];
+ this.buttons.push("-");
+ this.buttons.push({
+ tooltiptext: "toolbar.button.tooltip",
+ image: "chrome://toolbar/skin/button.png",
+ command: FBL.bindFixed(this.onHello, this)
+ });
+
+ for (var i=0; i<this.buttons.length; i++)
+ Firebug.chrome.appendToolbarButton(this.buttons[i]);
+ },
+
+ shutdown: function()
+ {
+ Firebug.Module.shutdown.apply(this, arguments);
+
+ for (var i=0; i<this.buttons.length; i++)
+ Firebug.chrome.removeToolbarButton(this.buttons[i]);
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Commands
+
+ onHello: function()
+ {
+ alert(FBL.$STR("toolbar.msg.hello3"));
+ }
+});
+
+// ********************************************************************************************* //
+
+return Firebug.MyModule;
+
+// ********************************************************************************************* //
+});
63 Toolbar/chrome/content/myPanel.js
@@ -0,0 +1,63 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+],
+function(FBL, FBTrace) {
+
+// ********************************************************************************************* //
+// Panel Implementation
+
+var MyPanel = function MyPanel() {};
+MyPanel.prototype = FBL.extend(Firebug.Panel,
+{
+ name: "myToolbar",
+ title: "Custom Toolbar",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+ },
+
+ destroy: function(state)
+ {
+ Firebug.Panel.destroy.apply(this, arguments);
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ /**
+ * Extends toolbar for this panel.
+ */
+ getPanelToolbarButtons: function()
+ {
+ var buttons = [];
+
+ buttons.push({
+ label: "toolbar.button.label",
+ tooltiptext: "toolbar.button.tooltip",
+ command: FBL.bindFixed(this.onHello, this)
+ });
+
+ return buttons;
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Commands
+
+ onHello: function()
+ {
+ alert(FBL.$STR("toolbar.msg.hello2"));
+ }
+});
+
+// ********************************************************************************************* //
+
+return MyPanel;
+
+// ********************************************************************************************* //
+});
5 Toolbar/chrome/locale/en-US/toolbar.properties
@@ -0,0 +1,5 @@
+toolbar.button.label=Click Me
+toolbar.button.tooltip=Click to say hello
+toolbar.msg.hello1=Hello from the Net panel!
+toolbar.msg.hello2=Hello from my panel!
+toolbar.msg.hello3=Hello from main Firebug toolbar!
BIN Toolbar/chrome/skin/classic/button.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 Toolbar/install.rdf
@@ -0,0 +1,23 @@
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>toolbar@janodvarko.cz</em:id>
+ <em:version>@VERSION@@RELEASE@</em:version>
+ <em:type>2</em:type>
+ <em:bootstrap>true</em:bootstrap>
+
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>10.0</em:minVersion>
+ <em:maxVersion>20.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <em:name>Firebug 1.10 Toolbar API</em:name>
+ <em:description>See how to extend panel toolbar without XUL overlay</em:description>
+ <em:creator>Jan Odvarko</em:creator>
+ <em:homepageURL>http://getfirebug.com</em:homepageURL>
+ </Description>
+</RDF>
30 Toolbar/license.txt
@@ -0,0 +1,30 @@
+Software License Agreement (BSD License)
+
+Copyright (c) 2007, Parakey Inc.
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the
+ following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+* Neither the name of Parakey Inc. nor the names of its
+ contributors may be used to endorse or promote products
+ derived from this software without specific prior
+ written permission of Parakey Inc.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.