<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DkMDQ3Y6eyp7ImA9WhRaFEg.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234</id><updated>2012-02-16T20:54:32.813-08:00</updated><category term="show" /><category term="menu item" /><category term="statusbar" /><category term="status bar" /><category term="Firefox" /><category term="user IP" /><category term="message" /><category term="find IP" /><category term="background color" /><category term="detect IP" /><category term="development" /><category term="XUL" /><category term="IP address" /><category term="local IP" /><category term="notificationbox" /><category term="context menu" /><category term="menuitem-iconic" /><title>Firefox extension development tips &amp; tricks</title><subtitle type="html">This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/FirefoxExtensionDevelopmentTipsTricks" /><feedburner:info uri="firefoxextensiondevelopmenttipstricks" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><entry gd:etag="W/&quot;CEIFRXc_eyp7ImA9WhZQFEg.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-5777219683210486980</id><published>2011-04-21T23:08:00.000-07:00</published><updated>2011-04-21T23:08:34.943-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-21T23:08:34.943-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="statusbar" /><category scheme="http://www.blogger.com/atom/ns#" term="show" /><category scheme="http://www.blogger.com/atom/ns#" term="status bar" /><category scheme="http://www.blogger.com/atom/ns#" term="message" /><category scheme="http://www.blogger.com/atom/ns#" term="Firefox" /><title>How to show message in Firefox statusbar</title><content type="html">Today I've spent bit more time then expected trying to show message in Firefox status bar. (I know that there is no statusbar by default in Firefox 4). The solution was simple, as usual :-):&lt;br /&gt;
&lt;code&gt;&lt;pre&gt;    document.getElementById("statusbar-display").label = "Your message here";
&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
That is all!&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-5777219683210486980?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/5777219683210486980/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=5777219683210486980" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/5777219683210486980?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/5777219683210486980?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2011/04/how-to-show-message-in-firefox.html" title="How to show message in Firefox statusbar" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;D08ESHc5fSp7ImA9Wx5QE0g.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-8091860460594089390</id><published>2010-09-01T08:43:00.000-07:00</published><updated>2010-09-01T08:43:29.925-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-01T08:43:29.925-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="notificationbox" /><category scheme="http://www.blogger.com/atom/ns#" term="background color" /><title>How to change background color of notificationbox</title><content type="html">If you take a look on official documentation for &lt;b&gt;notificationbox&lt;/b&gt;, you will not find any attributes or properties which allows to change background color. But it is possible to do. Let's assume that you have create notification box with the next code:&lt;br /&gt;
&lt;pre&gt;    var nb = gBrowser.getNotificationBox();
    nb.appendNotification(
        "This is my message",
        "my-notification",
        "chrome://myext/skin/notification.gif",
        nb.PRIORITY_INFO_MEDIUM,
        [
            {
                label: "More info",
                accessKey: "M",
                callback: function() {alert('More info action!')}
            }
        ]);
&lt;/pre&gt;Take a look on the second parameter of &lt;code&gt;appendNotification&lt;/code&gt; function. This parameter will be used as &lt;b&gt;value&lt;/b&gt; attribute for &lt;code&gt;notification&lt;/code&gt; element which will be created. We can use this fact. So only one thing that you need is to add one rule in CSS file of the extension. Something like this:&lt;br /&gt;
&lt;pre&gt;  notification[value='my-notification'] {
    background-color: green;
  }
&lt;/pre&gt;You will see your notification with green background color. You can also add more CSS rules and specify value of &lt;code&gt;color&lt;/code&gt; property and etc.&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-8091860460594089390?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/8091860460594089390/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=8091860460594089390" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/8091860460594089390?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/8091860460594089390?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2010/09/how-to-change-background-color-of.html" title="How to change background color of notificationbox" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DUIGSXo6fSp7ImA9Wx5RGE8.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-4994461612689475747</id><published>2010-08-26T05:57:00.000-07:00</published><updated>2010-08-26T05:58:48.415-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-26T05:58:48.415-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="menu item" /><category scheme="http://www.blogger.com/atom/ns#" term="context menu" /><category scheme="http://www.blogger.com/atom/ns#" term="menuitem-iconic" /><category scheme="http://www.blogger.com/atom/ns#" term="XUL" /><title>How to add new menu item in context menu</title><content type="html">For some extensions it has sense to think on adding new menu item in standard context menu. Such menu item can be useful for end-users and improve usability of your extension.&lt;br /&gt;
&lt;br /&gt;
I assume that you already have some XUL overlay:&lt;br /&gt;
&lt;pre&gt;overlay chrome://browser/content/browser.xul chrome://myext/content/myext.xul
&lt;/pre&gt;Now you need to add in myext.xul file the next code:&lt;br /&gt;
&lt;pre&gt;&amp;lt;popup id="contentAreaContextMenu"&amp;gt;
        &amp;lt;menuitem id="my-menu-item"
                  insertafter="context-selectall"
                  accesskey="H"
                  class="menuitem-iconic"
                  label="Hello world!"
                  oncommand="alert('Hello again');"/&amp;gt;
    &amp;lt;/popup&amp;gt;
&lt;/pre&gt;You can see that I've added CSS class there: &lt;code&gt;class="menuitem-iconic"&lt;/code&gt;. It will allow you to add icon for the menu item. You can do that in CSS file which should be included in the current XUL file:&lt;br /&gt;
&lt;pre&gt;#my-menu-item {
    list-style-image: url("chrome://myext/skin/icon16.png");
}
&lt;/pre&gt;That is all. Make your extensions user-friendly!&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-4994461612689475747?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/4994461612689475747/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=4994461612689475747" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/4994461612689475747?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/4994461612689475747?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2010/08/how-to-add-new-menu-item-in-context.html" title="How to add new menu item in context menu" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;AkUDQXo9cCp7ImA9WxFXF08.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-1859996465745192165</id><published>2010-05-24T12:07:00.000-07:00</published><updated>2010-05-24T12:11:10.468-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-24T12:11:10.468-07:00</app:edited><title>How to detect is a socket free or busy</title><content type="html">Sometimes you need to perform very simple task. But unexpectedly this task can take much more time that you have expected at the start. &lt;br /&gt;
&lt;br /&gt;
I've met this case when I was need to check if some socket is free or busy. I've spent some time on playing with core Mozilla interfaces like &lt;a href="https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIServerSocket" target="_blank"&gt;nsIServerSocket&lt;/a&gt; or &lt;a href="https://developer.mozilla.org/en/nsISocketTransportService" target="_blank"&gt;nsISocketTransportService&lt;/a&gt;. But was not able to find right solution. &lt;br /&gt;
&lt;br /&gt;
Finally, I've used not very traditional method to solve my problem. I've managed all work to Java classes:&lt;br /&gt;
&lt;code&gt;&lt;pre&gt;function isPortAvailable(port) {
    try {
        var srv = new java.net.ServerSocket(port);
        srv.close();
        srv = null;
        return true;
    } catch (e) {
        return false;
    }
}&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;
This solution has one limitation. You need to be ensure that Java in installed on user's machine. But in my case this limitation was not significant.&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-1859996465745192165?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/1859996465745192165/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=1859996465745192165" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/1859996465745192165?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/1859996465745192165?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2010/05/how-to-detect-is-socket-free-or-busy.html" title="How to detect is a socket free or busy" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;A0UFQX84eip7ImA9WxFTGUs.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-309857376479420737</id><published>2010-04-11T00:00:00.000-07:00</published><updated>2010-04-11T00:00:10.132-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-11T00:00:10.132-07:00</app:edited><title>How to Store Complex Objects in Firefox</title><content type="html">There are a couple of ways which can be used to store data in Firefox. First of all, you can use SQLite to store all your data. But in most of cases you don't need such powerful approach.&lt;br /&gt;
&lt;br /&gt;
Basic data types can be stored in &lt;a href="https://developer.mozilla.org/en/Toolkit_API/extIApplication"&gt;Application.storage&lt;/a&gt; or in &lt;a href="https://developer.mozilla.org/en/XUL_School/Handling_Preferences"&gt;preferences&lt;/a&gt;. But what to do if you need to store complex data?&lt;br /&gt;
&lt;br /&gt;
In those cases when performance is not very critical for you, you ca use the next trick: encode with &lt;a href="https://developer.mozilla.org/en/JSON"&gt;JSON&lt;/a&gt; your data and store it as result string. When you will need to access stored data, simply decode it back from string and enjoy!&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-309857376479420737?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/309857376479420737/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=309857376479420737" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/309857376479420737?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/309857376479420737?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2010/04/how-to-store-complex-objects-in-firefox.html" title="How to Store Complex Objects in Firefox" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;D0UMQHg_cSp7ImA9WxBbGUU.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-7532110451359616700</id><published>2010-03-19T00:54:00.000-07:00</published><updated>2010-03-19T00:54:41.649-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-19T00:54:41.649-07:00</app:edited><title>How To Call Java From XPCOM</title><content type="html">It is quite easy to call Java methods directly from the extension. You can find a lot of information how to do that &lt;a href="https://developer.mozilla.org/en/Java_in_Firefox_Extensions"&gt;here&lt;/a&gt;. But there is no information how to call java from JavaScript XPCOM. &lt;code&gt;java&lt;/code&gt; keyword is not available here. &lt;br /&gt;
&lt;br /&gt;
There is one trick that allow you to get reference on &lt;code&gt;java&lt;/code&gt; variable from XPCOM:&lt;br /&gt;
&lt;code&gt;&lt;pre&gt;const Cc = Components.classes;
const Ci = Components.interfaces;

var java = Cc["@mozilla.org/appshell/window-mediator;1"].
             getService(Ci.nsIWindowMediator).
             getMostRecentWindow("navigator:browser").java;
&lt;/pre&gt;&lt;/code&gt;Very simple, but not very obvious.&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-7532110451359616700?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/7532110451359616700/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=7532110451359616700" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/7532110451359616700?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/7532110451359616700?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2010/03/how-to-call-java-from-xpcom.html" title="How To Call Java From XPCOM" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Dk8GRHs7cSp7ImA9WxBVFEU.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-5179707106149121514</id><published>2010-02-18T01:20:00.000-08:00</published><updated>2010-02-18T01:20:25.509-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-18T01:20:25.509-08:00</app:edited><title>How to install search plugin together with your extension</title><content type="html">A lot of modern sites has own search system. Such system usually performs search on a site and provide search result to a user in accordance with his request.&lt;br /&gt;
&lt;br /&gt;
If you are working on some extension for such site, you can also create and install search plugin for the site. &lt;br /&gt;
&lt;br /&gt;
There are two search plugin formats supported by Firefox:&lt;br /&gt;
&lt;a href="https://developer.mozilla.org/en/Creating_MozSearch_plugins"&gt;MozSearch&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en/Creating_OpenSearch_plugins_for_Firefox"&gt;OpenSearch&lt;/a&gt;. Hope that above links will help you to create necessary search plugin.&lt;br /&gt;
&lt;br /&gt;
Then you need to distribute it with your extension. You should do two basic things:&lt;br /&gt;
1. Create &lt;code&gt;searchplugins&lt;/code&gt; folder in the root of your extension.&lt;br /&gt;
2. Add your search plugin to this folder.&lt;br /&gt;
&lt;br /&gt;
So, inside XPI your &lt;code&gt;searchplugins&lt;/code&gt; folder will be located on the same level with &lt;code&gt;chrome.manifest&lt;/code&gt; and &lt;code&gt;install.rdf&lt;/code&gt; files.&lt;br /&gt;
&lt;br /&gt;
There is also one small trick that can be used in your extension. You can select your installed search plugin as default search provider on the first run of your extension. To do that simply add two lines of code:&lt;pre&gt;&lt;code&gt;  var sb = document.getElementById("searchbar");
  sb.searchService.currentEngine = sb.searchService.getEngineByName("YourEngineName");
&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-5179707106149121514?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/5179707106149121514/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=5179707106149121514" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/5179707106149121514?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/5179707106149121514?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2010/02/how-to-install-search-plugin-together.html" title="How to install search plugin together with your extension" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;DUcFQnoyeip7ImA9WxBWGE0.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-6424786907723989830</id><published>2010-02-10T04:52:00.000-08:00</published><updated>2010-02-10T05:03:33.492-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-10T05:03:33.492-08:00</app:edited><title>How to change size of image for toolbarbutton on the fly</title><content type="html">Sometimes you need to use for &lt;code&gt;toolbarbutton&lt;/code&gt; an image which is returned by some third-party service. And it's size can be much greater than you need:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;toolbarbutton id="my-btn-id" label="My Button" image="http://somesite.com/images/img.png"/&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In this case you need to add one line of code in CSS file:&lt;br /&gt;&lt;code&gt;&lt;pre&gt;#my-btn-id .toolbarbutton-icon {&lt;br /&gt;  width: 16px;&lt;br /&gt;  height: 16px;&lt;br /&gt;} &lt;/pre&gt;&lt;/code&gt;This simple trick will allow you to get &lt;code&gt;toolbarbutton&lt;/code&gt; image with necessary size.&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-6424786907723989830?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/6424786907723989830/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=6424786907723989830" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/6424786907723989830?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/6424786907723989830?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2010/02/how-to-change-size-of-image-for.html" title="How to change size of image for toolbarbutton on the fly" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DkAFRn86cSp7ImA9WxBWEU4.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-8374839024040009273</id><published>2010-02-02T09:02:00.001-08:00</published><updated>2010-02-02T10:18:37.119-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-02T10:18:37.119-08:00</app:edited><title>Header for richlistbox component</title><content type="html">Using of &lt;code&gt;header&lt;/code&gt; in &lt;code&gt;listbox&lt;/code&gt; XUL control is quite common task. But there is no clear information about ability to use &lt;code&gt;header&lt;/code&gt; in &lt;code&gt;richlistbox&lt;/code&gt; control. I've found quite obvious but undocumented solution for this problem. The next short example will show how to add &lt;code&gt;header&lt;/code&gt; to &lt;code&gt;richlistbox&lt;/code&gt; control.&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&amp;lt;richlistbox rows="10" flex="1"&amp;gt;&lt;br /&gt;    &amp;lt;listhead&amp;gt;&lt;br /&gt;        &amp;lt;listheader label="My header" flex="1"/&amp;gt;&lt;br /&gt;    &amp;lt;/listhead&amp;gt;&lt;br /&gt;    &amp;lt;richlistitem&amp;gt;&lt;br /&gt;        &amp;lt;label value="Item1"/&amp;gt; &lt;br /&gt;    &amp;lt;/richlistitem&amp;gt;&lt;br /&gt;    &amp;lt;richlistitem&amp;gt;&lt;br /&gt;        &amp;lt;label value="Item2"/&amp;gt; &lt;br /&gt;    &amp;lt;/richlistitem&amp;gt;&lt;br /&gt;&amp;lt;/richlistbox&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-8374839024040009273?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/8374839024040009273/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=8374839024040009273" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/8374839024040009273?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/8374839024040009273?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2010/02/header-for-richlistbox-component.html" title="Header for richlistbox component" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;DUcDSX89eyp7ImA9WxNWEUo.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-9093019054607730629</id><published>2009-10-09T23:55:00.001-07:00</published><updated>2009-10-10T05:17:58.163-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-10T05:17:58.163-07:00</app:edited><title>Firefox add-on for copying containing folder for a downloaded file</title><content type="html">I've created small add-on which extends standard context menu in Download Manager. I think that it can be useful for those people which who uses some kinds of file managers like Far, Total Commander and etc. &lt;br /&gt;&lt;br /&gt;Usually after downloading of a file I need to open containing folder it my Far manager. But there is no basic way to copy path of the folder which contains a downloaded file. So, I've added one menu item in Download Manager context menu. It allows to do exactly that I need - copy containing folder for a downloaded file.&lt;br /&gt;&lt;br /&gt;Hope that it will be useful for someone too. You can download this extension &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/14868"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-9093019054607730629?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/9093019054607730629/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=9093019054607730629" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/9093019054607730629?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/9093019054607730629?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2009/10/firefox-add-on-for-copying-containing.html" title="Firefox add-on for copying containing folder for a downloaded file" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;CUMBQXk4cCp7ImA9WxNRF0g.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-3796881900482583438</id><published>2009-09-12T03:55:00.000-07:00</published><updated>2009-09-12T04:04:10.738-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-12T04:04:10.738-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="user IP" /><category scheme="http://www.blogger.com/atom/ns#" term="detect IP" /><category scheme="http://www.blogger.com/atom/ns#" term="find IP" /><category scheme="http://www.blogger.com/atom/ns#" term="local IP" /><category scheme="http://www.blogger.com/atom/ns#" term="IP address" /><title>How to get local IP address</title><content type="html">Some time ago I was need to detect local IP address of the machine where my Firefox add-on is installed. I've not found complete example. Finally, I've found the next solution:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    var dnsService = Components.classes["@mozilla.org/network/dns-service;1"].&lt;br /&gt;getService(Components.interfaces.nsIDNSService);&lt;br /&gt;    var ip = dnsService.resolve(dnsService.myHostName, false).getNextAddrAsString();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Nothing difficult!&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-3796881900482583438?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/3796881900482583438/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=3796881900482583438" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/3796881900482583438?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/3796881900482583438?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2009/09/how-to-get-local-ip-address.html" title="How to get local IP address" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Dk8CRHY_fip7ImA9WxJQEEo.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-9122795608502880007</id><published>2009-05-23T03:11:00.000-07:00</published><updated>2009-05-23T03:34:25.846-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-23T03:34:25.846-07:00</app:edited><title>How to add welcome page</title><content type="html">Sometimes it will be helpful to open welcome page immediately after first running of an extension. This is quite simple task. But it will allow to make your &lt;br /&gt;extension more user-friendly. &lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;const MY_EXT_PREF_BRANCH = "extensions.myext";&lt;br /&gt;const Cc = Components.classes; &lt;br /&gt;const Ci = Components.interfaces; &lt;br /&gt;&lt;br /&gt;var myExt = {&lt;br /&gt;    PREF_FIRSTRUN : MY_EXT_PREF_BRANCH + ".firstrun",&lt;br /&gt;&lt;br /&gt;    PAGE_WELCOME : "http://www.myext.com/welcome",&lt;br /&gt;&lt;br /&gt;    prefService : Cc["@mozilla.org/preferences-service;1"].&lt;br /&gt;                  getService(Ci.nsIPrefBranch),&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    load : function () {&lt;br /&gt;        if (myExt.isFirstRun()) {&lt;br /&gt;            setTimeout(myExt.openSuccessPage, 2000);&lt;br /&gt;            myExt.prefService.setBoolPref(myExt.PREF_FIRSTRUN, false);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    isFirstRun : function() {&lt;br /&gt;        return myExt.getBoolPref(myExt.PREF_FIRSTRUN, true);&lt;br /&gt;    },&lt;br /&gt;&lt;br /&gt;    openSuccessPage : function() {&lt;br /&gt;        gBrowser.selectedTab = gBrowser.addTab(myExt.PAGE_WELCOME);&lt;br /&gt;    },&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    getBoolPref: function(prefname, prefdef) {&lt;br /&gt;        try {&lt;br /&gt;            return myExt.prefService.getBoolPref(prefname);&lt;br /&gt;        } catch(e) {&lt;br /&gt;            myExt.prefService.setBoolPref(prefname, prefdef);&lt;br /&gt;            return myExt.prefService.getBoolPref(prefname);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;window.addEventListener("load", myExt.load, false);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-9122795608502880007?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/9122795608502880007/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=9122795608502880007" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/9122795608502880007?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/9122795608502880007?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2009/05/how-to-add-welcome-page.html" title="How to add welcome page" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Dk4ESHY-fCp7ImA9WxJQEEo.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-3199756050610863992</id><published>2009-04-09T03:30:00.000-07:00</published><updated>2009-05-23T03:35:09.854-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-23T03:35:09.854-07:00</app:edited><title>User-friendly uninstall process of an extensions</title><content type="html">As a rule you need to perform few steps when user uninstalls your extension. &lt;br /&gt;&lt;br /&gt;1. Remove all data that was added by your extension.&lt;br /&gt;2. Open feedback page.&lt;br /&gt;&lt;br /&gt;Below you will find some code that performs all these actions:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;const&amp;nbsp;MY_EXT_PREF_BRANCH&amp;nbsp;=&amp;nbsp;"extensions.my_ext";&lt;br /&gt;const&amp;nbsp;Cc&amp;nbsp;=&amp;nbsp;Components.classes;&amp;nbsp;&lt;br /&gt;const&amp;nbsp;Ci&amp;nbsp;=&amp;nbsp;Components.interfaces;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;var&amp;nbsp;my_ext&amp;nbsp;=&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;preferencesService&amp;nbsp;:&amp;nbsp;Cc["@mozilla.org/preferences-service;1"].&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;getService(Ci.nsIPrefBranch),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;observerService&amp;nbsp;:&amp;nbsp;Cc['@mozilla.org/observer-service;1'].&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;getService(Ci.nsIObserverService),&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;PLUGIN_UUID&amp;nbsp;:&amp;nbsp;"{a704f080-166f-12de-8c30-0206200c9a66}",&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;PAGE_FEEDBACK&amp;nbsp;:&amp;nbsp;"http://mysite.com/feedback",&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;uninstallObserver&amp;nbsp;:&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;observe:&amp;nbsp;function(aSubject,&amp;nbsp;aTopic,&amp;nbsp;aData)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;try&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;item&amp;nbsp;=&amp;nbsp;aSubject.QueryInterface(Ci.nsIUpdateItem);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;(item.id&amp;nbsp;!=&amp;nbsp;my_ext.PLUGIN_UUID)&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;(aData&amp;nbsp;==&amp;nbsp;"item-uninstalled")&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gBrowser.selectedTab&amp;nbsp;=&amp;nbsp;gBrowser.addTab(my_ext.PAGE_FEEDBACK);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;Remove&amp;nbsp;all&amp;nbsp;properties&amp;nbsp;that&amp;nbsp;was&amp;nbsp;installed&amp;nbsp;by&amp;nbsp;our&amp;nbsp;extension&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;my_ext.preferencesService.deleteBranch(MY_EXT_PREF_BRANCH);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;catch&amp;nbsp;(e)&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;},&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;addUninstallObserver&amp;nbsp;:&amp;nbsp;function()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;my_ext.observerService.addObserver(my_ext.uninstallObserver,&amp;nbsp;"em-action-requested",&amp;nbsp;false);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;my_ext.addUninstallObserver();&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-3199756050610863992?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/3199756050610863992/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=3199756050610863992" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/3199756050610863992?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/3199756050610863992?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2009/04/user-friendly-uninstall-process-of.html" title="User-friendly uninstall process of an extensions" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;AkUDQHo_cSp7ImA9WxVSFE8.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-667783890504313150</id><published>2009-01-08T06:38:00.000-08:00</published><updated>2009-01-08T07:24:31.449-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-08T07:24:31.449-08:00</app:edited><title>How to add icon in textbox</title><content type="html">Probably, most common place where you can use this trick is a toolbar for some site with search capability. Sure, that it will be nice to have search box on your toolbar like this:&lt;br&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_tXS938nEWRU/SWYSHw4Vm1I/AAAAAAAAAAo/FJDsbq4ocmM/s1600-h/SearchTextbox.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 24px;" src="http://1.bp.blogspot.com/_tXS938nEWRU/SWYSHw4Vm1I/AAAAAAAAAAo/FJDsbq4ocmM/s200/SearchTextbox.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5288934736982809426" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;I've found two different ways how to do this. The first way is to use XBL to define new component. It can be quite complicated for those developers who has no previous experience with it. Fortunately, there is another way which is more simple. &lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;textbox id="TB-Search"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;minwidth="200" width="200"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;onfocus="tb.searchBoxFocus(this);"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;onblur="tb.searchBoxBlur(this);"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;onkeypress="tb.keyHandler(event);"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;image id="TB-SearchImage"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/textbox&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;CSS definition for search image:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#TB-SearchImage {&lt;br /&gt;&amp;nbsp;&amp;nbsp;list-style-image: url("http://yoursite.com/favicon.ico");&lt;br /&gt;&amp;nbsp;&amp;nbsp;padding-right: 2px;&lt;br /&gt;&amp;nbsp;&amp;nbsp;padding-left: 0px;&lt;br /&gt;&amp;nbsp;&amp;nbsp;margin: 0px;&lt;br /&gt;&amp;nbsp;&amp;nbsp;border: 0px;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;That's it!&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-667783890504313150?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/667783890504313150/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=667783890504313150" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/667783890504313150?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/667783890504313150?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2009/01/how-to-add-icon-in-textbo.html" title="How to add icon in textbox" /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_tXS938nEWRU/SWYSHw4Vm1I/AAAAAAAAAAo/FJDsbq4ocmM/s72-c/SearchTextbox.JPG" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEAHRXsyeip7ImA9WxRQEkQ.&quot;"><id>tag:blogger.com,1999:blog-586113638993774234.post-4249892625935993543</id><published>2008-10-04T03:34:00.000-07:00</published><updated>2008-10-06T04:32:14.592-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-06T04:32:14.592-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="development" /><category scheme="http://www.blogger.com/atom/ns#" term="XUL" /><category scheme="http://www.blogger.com/atom/ns#" term="Firefox" /><title>How to add images to menuitem in button.</title><content type="html">Lets assume that we have button with &lt;span style=";font-family:courier new;"&gt;menupopup&lt;/span&gt;:&lt;br /&gt;&lt;span style=";font-family:courier new;"  &gt;&lt;pre&gt;&amp;lt;button type="menu" label="Main"&amp;gt;&lt;br /&gt;  &amp;lt;menupopup&amp;gt;&lt;br /&gt;    &amp;lt;menuitem id="miHomeId" label="Home Page"/&amp;gt;&lt;br /&gt;    &amp;lt;menuitem id="miAboutId" label="About"/&amp;gt;&lt;br /&gt;    &amp;lt;menuitem id="miContactId" label="Contact"/&amp;gt;&lt;br /&gt;  &amp;lt;/menupopup&amp;gt;&lt;br /&gt;&amp;lt;/button&amp;gt;&lt;/pre&gt;&lt;/span&gt;It will look something like this:&lt;br /&gt;&lt;br /&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_tXS938nEWRU/SOdsNcQwINI/AAAAAAAAAAU/pnvJ-sLQK_I/s200/withoutImages.JPG" alt="" id="BLOGGER_PHOTO_ID_5253286468531527890" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;And we need to add different icons to each &lt;span style=";font-family:courier new;"  &gt;menuitem&lt;/span&gt;. The first idea is to use &lt;span style=";font-family:courier new;"  &gt;list-style-image&lt;/span&gt; attribute.&lt;br /&gt;&lt;span style=";font-family:courier new;"&gt;&lt;pre&gt;#miHomeId {&lt;br /&gt;  list-style-image: url("chrome://toolbar/skin/Home.PNG");&lt;br /&gt;}&lt;/pre&gt;&lt;/span&gt;It is really strange, but it doesn't work. I've tried to find some examples where this problem is solved. But I have found nothing. So, I've found one interesting workaround:&lt;br /&gt;&lt;span style=";font-family:courier new;"  &gt;&lt;pre&gt;&amp;lt;button type="menu" label="Main"&amp;gt;&lt;br /&gt;  &amp;lt;menupopup&amp;gt;&lt;br /&gt;    &amp;lt;menuitem id="miHomeId"&amp;gt;&lt;br /&gt;      &amp;lt;img src="chrome://toolbar/skin/Home.PNG" id="imgHomeId"/&amp;gt;&lt;br /&gt;      &amp;lt;label value="Home Page"/&amp;gt;&lt;br /&gt;    &amp;lt;/menuitem&amp;gt;&lt;br /&gt;    &amp;lt;menuitem id="miAboutId"&amp;gt;&lt;br /&gt;      &amp;lt;img src="chrome://toolbar/skin/About.PNG" id="imgAboutId"/&amp;gt;&lt;br /&gt;      &amp;lt;label value="About"/&amp;gt;&lt;br /&gt;    &amp;lt;/menuitem&amp;gt;&lt;br /&gt;    &amp;lt;menuitem id="miContactId"&amp;gt;&lt;br /&gt;      &amp;lt;img src="chrome://toolbar/skin/Contact.PNG" id="imgContactId"/&amp;gt;&lt;br /&gt;      &amp;lt;label value="Contact"/&amp;gt;&lt;br /&gt;    &amp;lt;/menuitem&amp;gt;&lt;br /&gt;  &amp;lt;/menupopup&amp;gt;&lt;br /&gt;&amp;lt;/button&amp;gt;&lt;/pre&gt;&lt;/span&gt;And you just need to specify your images in CSS:&lt;br /&gt;&lt;span style=";font-family:courier new;"  &gt;&lt;pre&gt;#imgHomeId {&lt;br /&gt;  list-style-image: url("chrome://toolbar/skin/Home.PNG");&lt;br /&gt;}&lt;br /&gt;#imgAboutId {&lt;br /&gt;  list-style-image: url("chrome://toolbar/skin/About.PNG");&lt;br /&gt;}  &lt;br /&gt;#imgContactId {&lt;br /&gt;  list-style-image: url("chrome://toolbar/skin/Contact.PNG");&lt;br /&gt;}&lt;/pre&gt;&lt;/span&gt;Here is the result:&lt;br /&gt;&lt;br /&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_tXS938nEWRU/SOdsWQJ0S9I/AAAAAAAAAAc/17CGuZ7dYkU/s200/withImages.JPG" alt="" id="BLOGGER_PHOTO_ID_5253286619900038098" border="0" /&gt;&lt;div class="blogger-post-footer"&gt;This blog is about Firefox extension development. During my work in this area I've solved different problems. And I will be glad to share my experience with other developers. I hope that my blog will help someone to solve their problems.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/586113638993774234-4249892625935993543?l=firefoxdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://firefoxdev.blogspot.com/feeds/4249892625935993543/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=586113638993774234&amp;postID=4249892625935993543" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/4249892625935993543?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/586113638993774234/posts/default/4249892625935993543?v=2" /><link rel="alternate" type="text/html" href="http://firefoxdev.blogspot.com/2008/10/how-to-add-images-to-menuitem-in-button.html" title="How to add images to menuitem in button." /><author><name>devunion</name><uri>http://www.blogger.com/profile/10596118493941721790</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_tXS938nEWRU/SOdsNcQwINI/AAAAAAAAAAU/pnvJ-sLQK_I/s72-c/withoutImages.JPG" height="72" width="72" /><thr:total>3</thr:total></entry></feed>

