Category:Example code: Difference between revisions
From MozillaZine Knowledge Base
Jump to navigationJump to search
(→Other) |
(removed link to xulplanet) |
||
(45 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
{{up to|Development}} | {{up to|Development}} | ||
Articles in this category demonstrate the code to do certain things in Mozilla-based products (at this moment, mostly for use in extensions). | Articles in this category demonstrate the code to do certain things in Mozilla-based products (at this moment, mostly for use in [[Extension development|extensions]]). | ||
Development documentation is in process of being moved to [http://developer.mozilla.org/ Mozilla Development Center] (MDC). You can find more documentation there. | |||
==XUL== | ==XUL== | ||
*[ | * [http://developer.mozilla.org/en/docs/Creating_toolbar_buttons Creating toolbar buttons] (moved to Devmo) | ||
*[[Adding items to menus]] using overlays (talks about browser's context menu too) | * [[Adding items to menus]] using overlays (talks about browser's context menu too) | ||
*[[ | * [http://developer.mozilla.org/en/docs/Creating_a_Firefox_sidebar Creating a Firefox sidebar] | ||
* [http://developer.mozilla.org/en/docs/Code_snippets:Dialogs_and_Prompts#Describing_dialog_windows Creating dialog windows with XUL] | |||
* [http://developer.mozilla.org/en/docs/Dynamically_modifying_XUL-based_user_interface Dynamically modifying XUL-based user interface]. Talks about using DOM API to add, move, and delete widgets from UI at runtime. | |||
==JavaScript== | ==JavaScript== | ||
===Commonly used techniques=== | ===Commonly used techniques=== | ||
* | * [http://developer.mozilla.org/en/docs/JavaScript_Console How to log debug information to JavaScript Console]. | ||
* [[Dev : Extensions : Example Code : Calling Java from Javascript | Calling Java from Javascript]] | |||
* [[Dev : Extensions : Example Code : | |||
===XPCOM=== | ===XPCOM=== | ||
*[ | *[http://developer.mozilla.org/en/docs/Code_snippets:File_I/O Performing file IO] | ||
*[[Using observers]] for cross-window notifications | *[[Using observers]] for cross-window notifications | ||
*[ | *[http://developer.mozilla.org/en/docs/Code_snippets:Running_applications Running applications] | ||
*[ | *[http://developer.mozilla.org/en/docs/nsIFilePicker Using nsIFilePicker]] (Open, Save, Select Directory dialogs) | ||
*[[ | *[http://developer.mozilla.org/en/docs/nsIWindowMediator nsIWindowMediator] - enumerating existing windows. | ||
*[http://developer.mozilla.org/en/docs/nsIPromptService nsIPromptService] (privileged version of alert(), confirm(), prompt() plus their extended versions): [http://ihoss.not-a-blog.com/prompt.php some examples], [http://forums.mozillazine.org/viewtopic.php?t=236678 forum thread]. | |||
*Working with protocols: | |||
**[[Dev : Extending the Chrome Protocol]] | |||
**[http://www.nexgenmedia.net/docs/protocol/ Adding a New Protocol to Mozilla] by Doron Rosenberg. | |||
**[http://forums.mozillazine.org/viewtopic.php?p=2090958 Using nsIURIContentListener to listen for specific MIME types], e.g., application/x-bittorrent | |||
*[[Implementing XPCOM components in JavaScript]] | |||
===<tabbrowser> related=== | ===<tabbrowser> related=== | ||
*[[ | *[[Progress listeners|Using progress listeners]] | ||
*[[ | *[[On Page Load| Executing your code each time a page loads]] | ||
*[[Enumerating tabbrowser tabs|Enumerating tabbrowser tabs]] | *[[Enumerating tabbrowser tabs|Enumerating tabbrowser tabs]] | ||
*[[Reusing tabs for the same URL|Reusing tabs for the same URL]] | *[[Reusing tabs for the same URL|Reusing tabs for the same URL]] | ||
*[http://developer.mozilla.org/en/docs/Extension_Code_Snippets:Tabbed_Browser detecting tab selection, addition, removal] | |||
*[[Open page using tab settings|Open_page_using_tab_settings]] | |||
===XML Technologies in Mozilla=== | ===XML Technologies in Mozilla=== | ||
Moved [http://developer.mozilla.org/en/docs/Code_snippets:XML here] (MDC) | |||
===Other=== | ===Other=== | ||
*[[ | *[http://developer.mozilla.org/en/docs/Working_with_windows_in_chrome_code Working with windows in chrome code] article on Devmo. Discusses various development tasks involving working with windows. | ||
*[[Opening a new browser window (development)|Opening a new browser window]] | |||
*[[Inserting text at cursor]] | *[[Inserting text at cursor]] | ||
*[[Dev : Extensions : Example Code : Creating a XUL mailto: link | Creating a XUL mailto: link]] | *[[Dev : Extensions : Example Code : Creating a XUL mailto: link | Creating a XUL mailto: link]] | ||
*[[Adding files to an extension's uninstallation | Automatically deleting files when the user uninstalls your extension]] | *[[Adding files to an extension's uninstallation | Automatically deleting files when the user uninstalls your extension]] | ||
*[[Dev : Extensions : Example Code : Adding Drag and Drop to Statusbarpanel | Adding Drag and Drop to Statusbarpanel]] | *[[Dev : Extensions : Example Code : Adding Drag and Drop to Statusbarpanel | Adding Drag and Drop to Statusbarpanel]] | ||
*[[Creating sidebar|Creating sidebar extension]] | |||
*[[Sorting Trees]] | |||
*[[Dev : Extensions : Example Code : Encoding| Encoding strings]] | |||
*[[Getting Current URL]] | |||
*[http://developer.mozilla.org/en/docs/Code_snippets:Interaction_between_privileged_and_non-privileged_pages Using events to pass messages from content to chrome] | |||
*[[Dev : Extensions : Example Code : Using the scrollwheel | Using the scrollwheel]] | |||
===Techniques=== | ===Techniques=== | ||
* [[Differential inheritance]] in JavaScript using <code>__proto__</code> | * [[Differential inheritance]] in JavaScript using <code>__proto__</code> | ||
*Increasing security with [ | *Increasing security with [http://developer.mozilla.org/en/docs/XPCNativeWrapper XPCNativeWrapper] | ||
The alphabetical list of all articles and subcategories in this category follows. | The alphabetical list of all articles and subcategories in this category follows. |
Latest revision as of 18:40, 22 April 2015
- Up to Development
Articles in this category demonstrate the code to do certain things in Mozilla-based products (at this moment, mostly for use in extensions).
Development documentation is in process of being moved to Mozilla Development Center (MDC). You can find more documentation there.
XUL
- Creating toolbar buttons (moved to Devmo)
- Adding items to menus using overlays (talks about browser's context menu too)
- Creating a Firefox sidebar
- Creating dialog windows with XUL
- Dynamically modifying XUL-based user interface. Talks about using DOM API to add, move, and delete widgets from UI at runtime.
JavaScript
Commonly used techniques
XPCOM
- Performing file IO
- Using observers for cross-window notifications
- Running applications
- Using nsIFilePicker] (Open, Save, Select Directory dialogs)
- nsIWindowMediator - enumerating existing windows.
- nsIPromptService (privileged version of alert(), confirm(), prompt() plus their extended versions): some examples, forum thread.
- Working with protocols:
- Dev : Extending the Chrome Protocol
- Adding a New Protocol to Mozilla by Doron Rosenberg.
- Using nsIURIContentListener to listen for specific MIME types, e.g., application/x-bittorrent
- Implementing XPCOM components in JavaScript
- Using progress listeners
- Executing your code each time a page loads
- Enumerating tabbrowser tabs
- Reusing tabs for the same URL
- detecting tab selection, addition, removal
- Open_page_using_tab_settings
XML Technologies in Mozilla
Moved here (MDC)
Other
- Working with windows in chrome code article on Devmo. Discusses various development tasks involving working with windows.
- Opening a new browser window
- Inserting text at cursor
- Creating a XUL mailto: link
- Automatically deleting files when the user uninstalls your extension
- Adding Drag and Drop to Statusbarpanel
- Creating sidebar extension
- Sorting Trees
- Encoding strings
- Getting Current URL
- Using events to pass messages from content to chrome
- Using the scrollwheel
Techniques
- Differential inheritance in JavaScript using
__proto__
- Increasing security with XPCNativeWrapper
The alphabetical list of all articles and subcategories in this category follows.
Pages in category "Example code"
The following 8 pages are in this category, out of 8 total.