Labs/Jetpack/Reboot/JEP/Shell: Difference between revisions

From MozillaWiki
< Labs‎ | Jetpack‎ | Reboot‎ | JEP
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== JEP Shell - Example JEP ==
== JEP XXX - Shell JEP ==


* Champion: Testy McTest - mctest@mozilla.com
* Champion: Testy McTest - mctest@mozilla.com
* Status: Accepted/Pre-production
* Status: Accepted/In-Queue
**Status field can be Proposed or Accepted
* Bug Ticket: someTicket#
***Accepted detail flags are: Blocked, In-Queue, Pre-production, Production, Active, Deprecated
* Type: API
***Proposed detail flags are: Needs Review, Under Review, Needs Revision, Declined
* Difficulty: 4
* Type: Core
**Type field can be Core or API


=== Proposal ===
What does this JEP do in 1 sentence, additionally Who, What, When, Where, and Why is this JEP important.
=== Key Issues ===
What are the key issues to be considered within the context of this proposal?
=== Dependencies & Requirements ===
* A list of all known dependencies and requirements for this JEP
== API Methods (if applicable) ==
//THIS IS EXAMPLE CONTENT!!!
==== Page Mods <i>Initialization</i> ====
<pre class="brush:js;">
var myMods = new pageMod({
  'matches': ['*.google.com', 'jetpack.mozillalabs.com'],
  'includes': {
      'script': ['http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js'],
      'styles': ['http://yui.yahooapis.com/3.0.0/build/cssbase/base-min.css']
  },
  'styles': {
      'body': {
          'background': '#ffffff',
          'font-family': 'Trebuchet MS'
      }
  },
  'script': function(){
      $('container').addEvents({
          'click:relay(ul li)': function(){ this.setStyles('background','#000') },
          'mousenter:relay(ul li)': function(){ this.tween('background','#000') },
          'mouseleave:relay(ul li)': function(){ this.tween('background','#fff') }
      });
  }
});
</pre>
==== Page Mods Method: <i>add</i> ====
<b>Arguments:</b>
#<b>type</b> - (<i>string</i>) The type of modifier being added. Can be 'matches', 'includes', 'styles', or 'script'. If the only argument passed in is an object, Page Mods assumes multiple modifiers will be passed in.
#<b>data</b> -
#* matches: (<i>array</i>) an array of web site resource strings
#* includes: (<i>object</i>) 'script' or 'style' keyed nodes whose values are arrays of asset resource strings
#* styles: (<i>object</i>) an object whose keys are CSS selectors and whose values are objects composed of CSS property keys and values
#* script: (<i>function</i>) a function that will be injected into the page and called. By default, the function is bound with the target document's window object
<b>Returns:</b>
The Page Mods instance
<b>Notes:</b>


=== Proposal ===
Modifications passed to the Page Mods instance with this method will be added, and persist, on open and future documents matching all of the URL(s) currently on the 'matches' white-list.
* What will it do?
 
* What does it enable internally/externally?
<b>Examples:</b>
* How hard is it to implement?
 
<pre class="brush:js;">
myMods.add('matches', ['*.digg.com']);
 
myMods.add('includes', {
  'script': ['http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js'],
  'styles': ['http://yui.yahooapis.com/3.0.0/build/cssbase/base-min.css']
});
 
myMods.add('styles', {
  'body': {
      'background': '#ffffff',
      'font-family': 'Trebuchet MS'
  },
  'span.details': {
      'font-size': '7px'
  }
});


// Creating a function reference


=== Key Issues ===
var pageLog = function(){
* What are the most important items that need to be tackled in the JEP?
  console.log('I just logged a message with Page Mods!');
* What are areas that need further groups participation to solidify?
}


// Using a function reference enables removal of the script later, see
// the remove method below for more info.


=== Dependencies & Requirements ===
myMods.add('script', pageLog);
* Are there any Firefox platform bugs blocking it?
</pre>
* Does other Jetpack platform code need to be modified or added?
* Does its implementation affect any other projects or code?
* What is needed in the feature?
* What are some ideas on development/implementations paths?


== Use Cases ==


=== Internal Methods ===
# A list of add-ons and applications that would utilize this JEP
* What methods, mechanisms, or resources does this provide internally within the Jetpack platform code.


=== Common Actions ===


=== API Methods ===
* Common actions within add-ons or applications that would be reliant on such functionality?
* What are the pretty API wrapped methods externally exposed to Jetpack developers?

Revision as of 00:45, 10 February 2010

JEP XXX - Shell JEP

  • Champion: Testy McTest - mctest@mozilla.com
  • Status: Accepted/In-Queue
  • Bug Ticket: someTicket#
  • Type: API
  • Difficulty: 4

Proposal

What does this JEP do in 1 sentence, additionally Who, What, When, Where, and Why is this JEP important.

Key Issues

What are the key issues to be considered within the context of this proposal?

Dependencies & Requirements

  • A list of all known dependencies and requirements for this JEP

API Methods (if applicable)

//THIS IS EXAMPLE CONTENT!!!

Page Mods Initialization

var myMods = new pageMod({
  'matches': ['*.google.com', 'jetpack.mozillalabs.com'],
  'includes': {
      'script': ['http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js'],
      'styles': ['http://yui.yahooapis.com/3.0.0/build/cssbase/base-min.css']
  },
  'styles': {
      'body': {
          'background': '#ffffff',
          'font-family': 'Trebuchet MS'
      }
  },
  'script': function(){
      $('container').addEvents({
          'click:relay(ul li)': function(){ this.setStyles('background','#000') },
          'mousenter:relay(ul li)': function(){ this.tween('background','#000') },
          'mouseleave:relay(ul li)': function(){ this.tween('background','#fff') }
      });
  }
});

Page Mods Method: add

Arguments:

  1. type - (string) The type of modifier being added. Can be 'matches', 'includes', 'styles', or 'script'. If the only argument passed in is an object, Page Mods assumes multiple modifiers will be passed in.
  2. data -
    • matches: (array) an array of web site resource strings
    • includes: (object) 'script' or 'style' keyed nodes whose values are arrays of asset resource strings
    • styles: (object) an object whose keys are CSS selectors and whose values are objects composed of CSS property keys and values
    • script: (function) a function that will be injected into the page and called. By default, the function is bound with the target document's window object

Returns:

The Page Mods instance

Notes:

Modifications passed to the Page Mods instance with this method will be added, and persist, on open and future documents matching all of the URL(s) currently on the 'matches' white-list.

Examples:

myMods.add('matches', ['*.digg.com']);

myMods.add('includes', { 
  'script': ['http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js'],
  'styles': ['http://yui.yahooapis.com/3.0.0/build/cssbase/base-min.css']
});

myMods.add('styles', {
  'body': {
      'background': '#ffffff',
      'font-family': 'Trebuchet MS'
  },
  'span.details': {
      'font-size': '7px'
  }
});

// Creating a function reference

var pageLog = function(){
  console.log('I just logged a message with Page Mods!');
}

// Using a function reference enables removal of the script later, see
// the remove method below for more info.

myMods.add('script', pageLog);

Use Cases

  1. A list of add-ons and applications that would utilize this JEP

Common Actions

  • Common actions within add-ons or applications that would be reliant on such functionality?