Labs/Extensions2/Examples: Difference between revisions

No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<code>
== Possible API ==
 
ext = Extensions.get(version)
 
*ext.Chrome
**ContextMenu
***add
***get
***list
***remove
**StatusBarIcon
***add
***list
***remove
***get
**UrlBarIcon
***add
***list
***remove
***get
 
 
Ent.Chrome.
 
== Weather ==
 
<pre>
<addon>
  <style>
    #weatherBadge{ opacity: 0.9; }
    #weatherBadge:hover{ opacity: 1.0; }
   
    #weatherPanel{ background: transparent; /* more css here */ }
  </style>
 
  <button id="weatherBadge" img="sun.png">
 
  <div id="weatherPanel">
    <!-- Pretty pretty mockup here -->
  </div>
 
 
  <script>
    Browser.load(function(){
      JetPack.UI.statusBar
        .add("#weatherBadge");
        .hover( showWeatherPanel );
     
      setInterval( updateWeatherBadge, 60*60 );
    })
   
    function updateWeatherBadge(){
      var weatherApiUrl = "http://...";
     
      JetPack.ajax( weatherApiUrl, function(data){
        jQuery("#weatherBadge").attr({
        "img", data.weather.img,
        "text", data.weather.forecast
        });
       
        jQuery("#weatherPanel")... /* update the panel */
      });
     
    }
   
    function showWeatherPanel(){
      this.showPanel("#weatherPanel", {y:"+5px"})
    }
   
  </script>
</addon>
 
</pre>
 
== Content Filter ==
<pre>
<html>
<html>
<head>
<head>
Line 20: Line 95:
</body>
</body>
</html>
</html>
</code>
</pre>


== Snapshot ==


<pre>
<html>
<html>
<head>
<head>
Line 77: Line 154:
</body>
</body>
</html>
</html>
</pre>
577

edits