1,273
edits
Dandonkulous (talk | contribs) (Created page with '{{draft}} == JEP 16 - SlideBar == * Champion: Edward Lee <edilee at mozilla dot com> * Status: Implementing * Type: API Track * Created: 17 June 2009 * Reference Implementation…') |
Dandonkulous (talk | contribs) |
||
| Line 3: | Line 3: | ||
== JEP 16 - SlideBar == | == JEP 16 - SlideBar == | ||
* Champion: | * Champion: Daniel Buchner <daniel@mozilla.com> | ||
* Status: | * Status: Concept | ||
* Type: API Track | * Type: API Track | ||
* Created: | * Created: 2 Dec 2009 | ||
* Reference Implementation: jetpack. | * Reference Implementation: jetpack.addElement('window') | ||
* [[Labs/Jetpack/JEPs|JEP Index]] | * [[Labs/Jetpack/JEPs|JEP Index]] | ||
=== Introduction and Rationale === | === Introduction and Rationale === | ||
Window for Jetpack is a crucial API enhancement that allows developers using the Jetpack extension development platform to extend both functional and presentational capabilities of their Jetpacks. Window abilities are the gateway to a large, uncharted mass of applications that can be developed in concert with the other useful tools provided by Jetpack. | |||
=== Proposal === | === Proposal === | ||
A new Window instantiation: | |||
<code>jetpack. | <code>jetpack.addElement('window', {options})</code> | ||
Where <tt>options</tt> is a property hash: | Where <tt>options</tt> is a property hash: | ||
* <tt>icon</tt> <i>uri</i> - icon to show in the | * <tt>icon</tt> <i>uri</i> - icon to show in the Title section of the window | ||
* <tt>html</tt> <i>text/xml</i> - html content for the feature | * <tt>html</tt> <i>text/xml</i> - html content for the feature | ||
* <tt>url</tt> <i>uri</i> - url to load content for the feature | * <tt>url</tt> <i>uri</i> - url to load content for the feature | ||
* <tt>width</tt> <i>num</i> - width of the | * <tt>width</tt> <i>num</i> - initial width of the Window (320 - standard smartphone width resolution) | ||
* <tt> | * <tt>height</tt> <i>num</i> - initial height of the Window (480 - standard smartphone height resolution) | ||
* <tt> | * <tt>persist</tt> <i>bool</i> - will the Window stay open when a user closes the browser instance? | ||
* <tt> | * <tt>onFocus</tt> <i>func</i> - event triggered when the Window is focused | ||
* <tt> | * <tt>onBlur</tt> <i>func</i> - event triggered when the Window losses focus | ||
* <tt>onReady</tt> <i>func</i> - | * <tt>onReady</tt> <i>func</i> - event triggered when the Window's content is loaded and ready for manipulation. | ||
All events are passed the following property hash: | |||
* <tt>icon</tt> - node representing the icon in the SlideBar | * <tt>icon</tt> - node representing the icon in the SlideBar | ||
** <tt>icon. | ** <tt>icon.default()</tt> - reload icon to original icon | ||
* <tt>contentDocument</tt> - document element of the content area | * <tt>contentDocument</tt> - document element of the content area | ||
* <tt>position</tt> - an object that includes the Window's position on the screen: {x: 400, y: 500} | |||
* <tt> | * <tt>location</tt> - the URL of the window, http://, chrome:// | ||
=== Example === | === Example === | ||
Show mozilla.com in | Show mozilla.com in a Window and change the background color of the document when clicked. | ||
<pre class="brush:js;toolbar:false;"> | <pre class="brush:js;toolbar:false;"> | ||
jetpack. | jetpack.addElement('window', | ||
url: "http://www.mozilla.com/", | |||
width: 300, | |||
onFocus: function(window) { | |||
window.contentDocument.documentElement.style.background = '#ffffff'; | |||
}, | |||
onBlur: function(){ | |||
window.contentDocument.documentElement.style.background = '#ff0000'; | |||
} | |||
}); | }); | ||
</pre> | </pre> | ||
edits